-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Position: fixed, partially superposed divs, determined as not visible #3369
Comments
Thank you for providing a reproducible example! |
Hey @nerfologist Any reason for closing this issue? The error is still reproducible as of yesterday. |
@jennifer-shehane sorry I probably closed it by mistake while checking your answer on my mobile device (I'm clumsy) and obviously failed to notice it. Reopening! |
So, I've taken a look at this issue on visibility of the lefthand sidebar. This one is a bit tricky. Asserting that the entire #backdrop element is visible is.....kind of untrue. Since the element expands the entire width of the page, truly 70% of that element is being covered by another element. So, should Cypress determine that element as visible truly? What will be a more accurate test will be testing the elements within the #backdrop sidebar. For example, you can see below, I have a <!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="backdrop" style="width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.3); position: fixed; top: 0; left: 0;">
<span>VISIBLE</span>
<span style="position: absolute; left: 500px;">NOT VISIBLE</span>
</div>
<div id="side-drawer" style="width: 70%; height: 100%; background-color: palevioletred; position: fixed; top: 0; right: 0;">side drawer</div>
</body>
</html> it('recognizes elements within backdrop as visible or not', () => {
cy.visit('index.html');
cy.get('#backdrop>span').first().should('be.visible'); // passes
cy.get('#backdrop>span').last().should('be.visible'); // correctly fails
}); While I do not consider this a bug in Cypress, I would qualify this as unexpected behavior. I think this can be improved upon within the issue where we will print reasons why we qualify something as not visible: #677 I will be closing this issue and adding a note in the above linked issue to handle messaging around elements that are partially visible. |
Hello and thanks for your detailed analysis @jennifer-shehane, it makes sense and I agree with your observations. |
Hello, I'm developing a simple mobile layout based on a side menu and a backdrop.
Backdrop has:
Drawer has:
Here's the test
Current behavior:
The test fails with the following error:
Desired behavior:
The test should recognize both elements as visible, as the drawer is only partially covering the backdrop.
Steps to reproduce: (app code and test code)
The described layout can be found here: https://codesandbox.io/s/507owq3644
The test code is included in the description.
Versions
Cypress: 3.1.5
Operating system: macOS High Sierra 10.13.6
Browser: Version 72.0.3626.96 (Official Build) (64-bit)
Thanks for your work! 👍
The text was updated successfully, but these errors were encountered: