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

Improve UI when el not actionable by distinctly displaying stale elements vs hidden elements #696

Closed
brian-mann opened this issue Sep 29, 2017 · 3 comments
Labels
pkg/driver This is due to an issue in the packages/driver directory type: enhancement Requested enhancement of existing feature

Comments

@brian-mann
Copy link
Member

The visibility algorithm correctly identifies detached elements as "hidden".

But when determining and providing the reason its hidden, we get an error message about the effective width and height being 0.

Since detached elements do not actually displace any content, this is technically correct, but miscommunicates the reason why.

We should provide a better error message in this circumstance and also add a new UI icon for detached elements (as opposed to just hidden).

Here's an example.

In this situation I've caused the element to be removed after the cy.get() but during the .click()

This test should correctly fail but the error message sends me down the wrong path.

screen shot 2017-09-29 at 11 07 44 am

Here's a suggestion where instead of displaying the invisibility icon, we add a new icon and tooltip to indicate that this element has become detached.

screen shot 2017-09-29 at 11 11 19 am

@brian-mann
Copy link
Member Author

Another idea here is to either add a mutation observer, or just override removeChild so we could detect the very instant a DOM element is detached so we could immediately fail a chain of commands, since there is no way to recover.

@brian-mann brian-mann changed the title Improve visibility errors + UI by distinctly displaying stale elements vs effective width + height Improve visibility errors + UI by distinctly displaying stale elements vs hidden elements Sep 29, 2017
@jennifer-shehane jennifer-shehane added the pkg/driver This is due to an issue in the packages/driver directory label Oct 2, 2017
@jennifer-shehane jennifer-shehane added stage: ready for work The issue is reproducible and in scope type: enhancement Requested enhancement of existing feature labels Sep 14, 2018
@tnrich
Copy link
Contributor

tnrich commented Apr 12, 2019

@brian-mann is there a way to tell a chain of commands to re-run? Such that if the element is removed after a .get() but before a .click() we could have cypress re-run both the .get() and the .click() ?

Thanks!

@jennifer-shehane jennifer-shehane changed the title Improve visibility errors + UI by distinctly displaying stale elements vs hidden elements Improve UI when el not actionable by distinctly displaying stale elements vs hidden elements Jun 11, 2019
@jennifer-shehane
Copy link
Member

This has already been delivered - we correctly error that the element has been detached from the DOM instead of showing the 0x0 error.

@jennifer-shehane jennifer-shehane removed the stage: ready for work The issue is reproducible and in scope label Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

3 participants