Skip to content

Commit 085add5

Browse files
author
Blue F
authored
Merge pull request #20817 from sainthkh/issue-19985
fix: cy.root respect timeout option.
2 parents 4869a61 + a95eff5 commit 085add5

File tree

2 files changed

+14
-1
lines changed
  • packages/driver

2 files changed

+14
-1
lines changed

packages/driver/cypress/integration/commands/querying/root_spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ describe('src/cy/commands/querying', () => {
3535
cy.root().should('have.class', 'foo').and('have.class', 'bar')
3636
})
3737

38+
// https://github.com/cypress-io/cypress/issues/19985
39+
it('respects timeout option', (done) => {
40+
cy.on('fail', (err) => {
41+
expect(err.message).to.not.contain('4000ms')
42+
done()
43+
})
44+
45+
cy.root({ timeout: 50 }).should('contain', 'root world')
46+
})
47+
3848
describe('.log', () => {
3949
beforeEach(function () {
4050
this.logs = []

packages/driver/src/cy/commands/querying/root.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export default (Commands, Cypress, cy, state) => {
2929
return log(withinSubject)
3030
}
3131

32-
return cy.now('get', 'html', { log: false }).then(log)
32+
return cy.now('get', 'html', {
33+
log: false,
34+
timeout: options.timeout,
35+
}).then(log)
3336
},
3437
})
3538
}

0 commit comments

Comments
 (0)