-
Notifications
You must be signed in to change notification settings - Fork 153
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
How to test disappearance? #13
Comments
I actually don't know how to do this I'm afraid :-( If you could dig in a little bit and come up with a good solution that would be appreciated! Thank you! |
Not an ideal solution, but you can work around it using cypress
|
Actually I've done this since and the queryBy* queries work fine without the |
Hmm, for me it resolves instantly with the still existing element if there's no wait, even with a timeout since the element exists when |
Ah, right, that makes sense. My situation was slightly different. I think a wait is required here... I wonder how it would work with a normal |
Solution might be a config flag that inverts the behaviour. Definitely needs a clearer config flag than invert though... |
I feel like this is a problem that Cypress should solve honestly. |
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'm encountering the same issue. cy.get('loading-indicator').should('not.exist') // works
cy.getByTestId('loading-indicator').should('not.exist') // does not work
cy.queryByTestId('loading-indicator').should('not.exist') // does not work |
Remember that |
@DJTB could you use a combo of cy.route and cy.wait? I know for loading of data before testing a page I had to setup a |
#30 should fix this |
I am having a similar problem. In my case, I have a button that changes its text like this 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" |
cypress-testing-library
version: 2.2.0node
version: 9.4.0yarn
version: 1.7.0Relevant code or config
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:
What would be the proper way to test element disappearance with custom commands?
The text was updated successfully, but these errors were encountered: