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

cy.root ignores timeout option #19985

Closed
marcandre opened this issue Jan 31, 2022 · 3 comments · Fixed by #20817
Closed

cy.root ignores timeout option #19985

marcandre opened this issue Jan 31, 2022 · 3 comments · Fixed by #20817
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug

Comments

@marcandre
Copy link

marcandre commented Jan 31, 2022

Current behavior

Passing a timeout option to cy.root has no effect.

Desired behavior

Like get and al., it should retry for the given timeout duration.

Note: there's a separate bug with root not retrying at all when called from within. This seems different but may be related.

Test code to reproduce

From this demo:

describe("page", () => {
  beforeEach(() => {
    cy.visit("https://example.cypress.io");
    delayedHelloAfter(7);
  });

  it("`root` retries using the default so this test fails (good)", () => {
    cy.root().should("contain", "Hello");
  });

  it("`root` does not respect the `timeout` options so this test fails too (bad)", () => {
    cy.root({ timeout: 10000 }).should("contain", "Hello");
  });
  it("get('html') does respect the `timeout` options so this test passes (good)", () => {
    cy.get("html", { timeout: 10000 }).should("contain", "Hello");
  });
});

function delayedHelloAfter(seconds) {
  cy.window().then((w) => {
    w.eval(`setTimeout(() => {
        document.querySelector('.banner .container').innerHTML = '<p> Hello, world!</p>'
      }, ${seconds} * 1000)
      console.log("ok")
      `);
  });
}

Cypress Version

9.3.1 & 9.4.0

Other

No response

@sainthkh
Copy link
Contributor

Confirmed that this fails.

Thank you for the reproducible example.

@sainthkh sainthkh added stage: ready for work The issue is reproducible and in scope pkg/driver This is due to an issue in the packages/driver directory labels Mar 25, 2022
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope labels Mar 29, 2022
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Mar 30, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 30, 2022

The code for this is done in cypress-io/cypress#20817, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 11, 2022

Released in 9.5.4.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.5.4, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants