Last active
August 5, 2020 16:48
Cypress Tips/Tricks - Consolidating Timeouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// timeouts.ts | |
// Consolidate your timeout values with something that scales so you don't end up with a bunch of arbitrary timeout values | |
// for separate selectors, requests, tasks, etc. for one off cases | |
// Your `cypress.json` configuration should have reasonable timeouts to cover most timeout cases though | |
export const timeouts = { | |
short: 15000, | |
medium: 30000, | |
long: 60000, | |
xlong: 120000, | |
xxlong: 240000, | |
}; | |
// In some .spec.ts | |
cy.get("[data-hook='test']", { timeout: timeouts.short }); | |
cy.task("someTask", {}, { timeout: timeouts.xlong }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment