Skip to content
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

Visibility check not working for close elements #27514

Closed
daelmaak opened this issue Aug 10, 2023 · 4 comments · Fixed by #27586
Closed

Visibility check not working for close elements #27514

daelmaak opened this issue Aug 10, 2023 · 4 comments · Fixed by #27586
Labels
CT Issue related to component testing topic: visibility 👁

Comments

@daelmaak
Copy link

daelmaak commented Aug 10, 2023

Current behavior

The problem is best described with this simple example - it is a component-testing of ngx-gallery:

Screenshot 2023-08-10 at 11 00 58

The gallery here displays one image at a time. In the test, I slide from the 1st image to the 2nd one and check that the first one is not.be.visible after.

Cypress in this case checks the coordinates of the element in question and checks whether the element is outside of its parent position and if the parent also has overflow: hidden, it can conclude that the element in question indeed isn’t visible. Which should be my case exactly because one of the parents (viewer element) thinly wraps the current image and completely hides the others with the overflow: hidden.

But cypress thinks it is visible because of the < from the line I shared in the link is not sufficient. It has to be <= in order to work correctly. In my case, the rightmost x-position of the 1st image is compared to the leftmost x-position of the parent, and both have the value of 50px. This looks like the images overlap by 1px, but they don’t, they are placed neatly next to each other. So due to cypress’s implementation of finding the x-positions, <= needs to be used instead of <. I am happy to implement this fix if you'd like.

Desired behavior

Cypress recognizes that the 2 elements - images - are only "touching" but not overlapping and the 1st is therefore not visible.

Test code to reproduce

https://github.com/daelmaak/ngx-gallery/blob/test/introduce-cypress-for-component-testing/libs/gallery/src/lib/components/viewer/viewer.component.cy.ts

Cypress Version

12.16

Node version

20.5.0

Operating System

macOS 13.5

Debug Logs

No response

Other

No response

@canourrea23
Copy link
Contributor

#27586

@daelmaak
Copy link
Author

daelmaak commented Aug 18, 2023 via email

@daelmaak
Copy link
Author

daelmaak commented Oct 8, 2023

Hi @jordanpowell88, could you please have a look at #27586? It's been pending for quite some time now due to some failing checks.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 8, 2023

Released in 13.5.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.5.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CT Issue related to component testing topic: visibility 👁
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants