Skip to content

Instantly share code, notes, and snippets.

@alfredlucero
Last active August 5, 2020 16:48
Cypress Tips/Tricks - Consolidating Timeouts
// 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