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

Great use of wait-until if you have detached dom problems #312

Closed
teebu opened this issue Sep 22, 2021 · 1 comment
Closed

Great use of wait-until if you have detached dom problems #312

teebu opened this issue Sep 22, 2021 · 1 comment

Comments

@teebu
Copy link

teebu commented Sep 22, 2021

I want to share this solution to my problems.

cy.waitUntil(() =>
      cy.get('.someSelector')
        .as('someAlias')
        .wait(10) // for some reason this is needed, otherwise next line returns `true` even if click() fails due to detached element in the next step
        .then($el => Cypress.dom.isAttached($el)),
    { timeout: 1000, interval: 10 })

      .get('@someAlias')
      .click()
@NoriSte
Copy link
Owner

NoriSte commented Sep 23, 2021

Thanks for sharing, I keep this issue as a reference in case other users land here asking something similar 😊

I hope Cypress fixes this behavior soon 😊

@NoriSte NoriSte closed this as completed Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants