How to test disappearance?
See original GitHub issuecypress-testing-library
version: 2.2.0node
version: 9.4.0yarn
version: 1.7.0
Relevant code or config
// I have a table with users, and I want to test user deletion
cy.getByTestId(`user-id-${userId}`).within(() => {
cy.getByText('Remove').click();
});
cy.getByTestId(`user-id-${userId}`).should('not.exist');
What you did: I’ve tried to use cypress-testing-library custom commands with should(‘not.exist’) expectation.
What happened: The expectation failed, because cypress does not wait until the row/element disappeared.
On the other hand the following works as expected:
cy.getByTestId(`user-id-${invitee.userId}`).within(() => {
cy.getByText('Remove').click();
});
cy.get(`[data-testid="user-id-${invitee.userId}"`).should('not.exist');
What would be the proper way to test element disappearance with custom commands?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Appearance and Disappearance - Testing Library
Appearance and Disappearance. Sometimes you need to test that an element is present and then disappears or vice versa.
Read more >Blocked Tear Ducts: Dye Disappearance Test - Topic Overview
A fluorescein dye disappearance test is used in children and adults to find out whether tears are draining normally from the eyes into...
Read more >How to Diagnose the Missing Data Mechanism
The only true way to distinguish between MNAR and MAR is to measure some of that missing data. It's a common practice among...
Read more >Fluorescein Dye Disappearance Test: A Reliable Test in Asses...
Fluorescein dye disappearance test (FDDT), first described by Jacobs 1 (named dye test) and then documented by Zappia and Milder, 2 measures the...
Read more >Fluorescein dye disappearance
Related: FDDT, fluorescein dye disappearance test. Oculoplastics/Orbit. View Full Image · Image License and Citation Guidelines · Add to My Bookmarks.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the radio silence. I figured out that the following works as expected:
So we ended up overwriting cypress-testing-library commands by wrapping up subject:
My plan was to investigate this further and eventually open a pr with a fix but it won`t happen at least for one month.
I hope this is helpful at least.
I am having a similar problem. In my case, I have a button that changes its text like this “SAVE” => “SAVING” [duration unknown] => “SAVE” or (error case) “SAVE” => “SAVING” [duration unknown] => “COULD NOT SAVE”
The “SAVING” state can take some time to change. Is there a way to detect when the “SAVING” text is gone and then assert that the text changed to “SAVE”