Skip to content

Latest commit

 

History

History
 
 

fundamentals__timeout

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Test timeout

The example shows how to stop a test if it takes too long to execute, similar to Mocha's timeout option. The timeout function is in cypress/integration/timeout.js.

You can set timeout inside the test only, see cypress/integration/spec.js

// this test fails after two seconds due to timeout
it('does not finish long tests', () => {
  testTimeout(2 * 1000)
  cy.wait(10 * 1000)
})

Test is too long

You can set global timeout that applies to every test, see cypress/integration/all-tests-spec.js using Cypress.on('test:before:run' ... event