-
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
getBy* with .should('not.exist') #30
Comments
Hmmm... this test as an assertion that an element does not exist and it works (even without the timeout argument. The timeout arg is there because otherwise Cypress will wait a full 4 seconds to make sure the element doesn't appear). Am I missing something? Probably... |
it works if the |
Oh right, that makes sense. A workaround would be to |
I'm thinking Cypress should support hooking into the retry mechanism for custom commands. Filed an issue to discuss: cypress-io/cypress#3109 |
Super, thanks! |
It might be theoretically possible to emulate the The magic appears to be in this implicit "should('exist')" that yields retry control to the next assertion if it is defined https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/commands/querying.coffee#L339-L348 Instead of This action could be dispatched cc @bahmutov |
I'd be fine if anyone wants to try to make that happen. Then we can switch over to a built-in API when it becomes available. |
The behavior of cypress-testing-library's
getBy
queries is a bit different than the cypress built-in .get() method: the built-in will retryshould('not.exist')
until it times out, but thegetBy
queries timeout on the query. One workaround is to change togetBy
toqueryBy
, but this requires a little bit of extra dom-testing-library knowledge that can confuse people coming from Cypress, and still doesn't retry.Alternative
Idea
It might make sense for
queryBy*
to actually be aliased togetBy*
in the cypress context?EDIT: actually the .should() chain should really trigger a retry of the parent command. Maybe custom commands don't hook into .should correctly?
Related to #23, cypress-io/cypress#3109
The text was updated successfully, but these errors were encountered: