-
Notifications
You must be signed in to change notification settings - Fork 25
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
Cypress throw an error when returning true
inside the cy.waitUntil callback
#338
Comments
Actually I found a workaround: Instead of returning a boolean, I'm doing an assertion: cy.waitUntil(() => {
return obtainResults("*css_selector**")).its("exist").should("eq", true);
}); And no more errors ! 🎉 But I don't know if it's the actual fix as it's a bit tricky |
I don't know how you are going to use cy.get('body')
.waitUntil(($body) => $body.find('*css_selector**').length)
.then((numberOfElements) => {
// consume numberOfElements
})
cy.get('body')
.waitUntil(($body) => !!$body.find('*css_selector**').length)
.then((exist) => {
// consume exist
}) or, even simpler cy.waitUntil(() => Cypress.$('*css_selector**').length).then((numberOfElements) => {
// consume numberOfElements
})
cy.waitUntil(() => !!Cypress.$('*css_selector**').length).then((exist) => {
// consume exist
}) please let me know if:
Thanks 😊 |
@NoriSte Yes indeed, your solutions are nice, thanks for the feedback, I appreciate it a lot. :) |
You're more than welcome. I know that I haven't answered your "why does cypress throw this error?" question... But I tried to think from the outside because your code seemed (at least to me) to be unnecessarily complex 😊 |
Hello !
I'm using Cypress version
9.2.0
(latest) and cypress-wait-until version1.7.2
.When I'm using
cy.waitUntil( () => condition )
, it works nice when the condition is falsy but as long as it become truthy, the test fail and cypress returns the following error:Something is failing inside the source code... why ? is the wait-until broken after release v9 from Cypress ?
Here more details of my code which is failing:
The text was updated successfully, but these errors were encountered: