cypress-repeat [![ci status][ci image]][ci url] [![renovate-app badge][renovate-badge]][renovate-app]
Run Cypress multiple times in a row, great at finding test flake
Read Wrap Cypress Using NPM Module API and Retry, Rerun, Repeat.
Install
npm i -D cypress-repeat
# or using Yarn
yarn add -D cypress-repeatThis module assumes the cypress dependency v5.3.0+ has been installed.
Use
npx cypress-repeat run -n <N> ... rest of "cypress run" argumentsWhich will run Cypresss <N times, exiting after the first failed run or after all runs finish successfully.
Until passes
You can flip the logic and run Cypress up to N times until the first successful exit
npx cypress-repeat run -n <N> --until-passes ... rest of "cypress run" argumentsRerun only failed Specs
You can rerun only the specs that failed
npx cypress-repeat run -n <N> --until-passes --rerun-failed-only ... rest of "cypress run" argumentsEnv variables
Every run has two utility variables injected
const n = Cypress.env('cypress_repeat_n') // total repeat attempts
const k = Cypress.env('cypress_repeat_k') // current attempt, starts with 1
// and is <= n