Skip to content

Commit

Permalink
Merge pull request #20817 from sainthkh/issue-19985
Browse files Browse the repository at this point in the history
fix: cy.root respect timeout option.
  • Loading branch information
Blue F committed Mar 30, 2022
2 parents 4869a61 + a95eff5 commit 085add5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/driver/cypress/integration/commands/querying/root_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ describe('src/cy/commands/querying', () => {
cy.root().should('have.class', 'foo').and('have.class', 'bar')
})

// https://github.com/cypress-io/cypress/issues/19985
it('respects timeout option', (done) => {
cy.on('fail', (err) => {
expect(err.message).to.not.contain('4000ms')
done()
})

cy.root({ timeout: 50 }).should('contain', 'root world')
})

describe('.log', () => {
beforeEach(function () {
this.logs = []
Expand Down
5 changes: 4 additions & 1 deletion packages/driver/src/cy/commands/querying/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export default (Commands, Cypress, cy, state) => {
return log(withinSubject)
}

return cy.now('get', 'html', { log: false }).then(log)
return cy.now('get', 'html', {
log: false,
timeout: options.timeout,
}).then(log)
},
})
}

3 comments on commit 085add5

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 085add5 Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.4/linux-x64/develop-085add55ab5de8ad49e066aab97b747bcd71f7a5/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 085add5 Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.4/win32-x64/develop-085add55ab5de8ad49e066aab97b747bcd71f7a5/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 085add5 Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.5.4/darwin-x64/develop-085add55ab5de8ad49e066aab97b747bcd71f7a5/cypress.tgz

Please sign in to comment.