-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: elements with opacity: 0 are not visible #8244
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to have a test case for testing something changing opacity. I feel like the most common use case is someone having an element with opacity: 100
, click something which triggers the element to have opacity: 0
. So we'd want to make sure that when they assert 'el is not visible' that it waits for opacity to reach 0 and passes. I think this will work from the code that's written, but a test would be nice to confirm.
Is the ignoreOpacity
option meant to be user facing? It seems it's just hard coded to be false
. Why is it there at all?
Looks good to me otherwise. I think Brian had some notes about the mocha assertions and opacity that he wanted to make sure was covered. Not sure if y'all touched base on that.
@jennifer-shehane Just added a test for that. Regarding Adding this additional parameter seemed to be the easiest and cleanest way of achieving the desired behavior. Outside of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@panzarino It seems that the sizzle selector calls into the isHidden
method, calling it with the element, context (document), and xml. This xml is evaluating to false
, which was always setting the ignoreOpacity
option to false
on these calls.
Since updating the logic to try and accept an object, it's always set to false
when using the :hidden
selectors, so I don't think this option is being read in correctly.
Put a debugger
in isHidden
method - see that 3rd arg is always called with false
from sizzle: https://github.com/cypress-io/cypress/blob/issue-4474/packages/driver/src/dom/visibility.js#L23:L23
Maybe I'm misunderstanding something about the implementation.
@jennifer-shehane Looks like jQuery always calls the selector with 3 parameters, the element, a context (which is always the document), a a third |
I just checked on the page https://demoqa.com/automation-practice-form, and I see that: one element has opacity: 0, but it is still visible to my eyes Version Cypress: 13.0.0 |
I think its not fixed properly. As same issue I am facing. I tried to assert a checkbox, which is clearly visible to my eye. But cypress is throwing element is not visible as opacity:0 |
@NityaQA Please open a new issue filling out the issue template |
User facing changelog
BREAKING CHANGE: Elements with
opacity: 0
are no longer considered to be visible. This includes elements with an ancestor that hasopacity: 0
since a child element can never have a computed opacity greater than that of an ancestor.Additional details
This is a breaking change since it has the potential to change the behavior of existing tests that rely on elements with
opacity: 0
to be visible.Docs PR: cypress-io/cypress-documentation#3071
PR Tasks
cypress-documentation
?type definitions
?