Cypress · Middle · Question 27 of 77
How do you test that a session expires after 30 minutes of inactivity?
- 1
cy.clock()thency.tick(30 * 60 * 1000)and assert logout - 2Change the session timeout to one second in production
- 3Run the test for 30 minutes on the CI server
Show the answer
Correct answer: cy.clock() then cy.tick(30 * 60 * 1000) and assert logout
Explanation
Fake timers make long waits instant. Install the clock before visiting, so the app picks it up.