Run Cypress multiple times in a row
npm install cypress-repeat> Run Cypress multiple times in a row, great at finding test flake
Read Wrap Cypress Using NPM Module API and Retry, Rerun, Repeat.
``shell`
npm i -D cypress-repeator using Yarn
yarn add -D cypress-repeat
This module assumes the cypress dependency v5.3.0+ has been installed.
`shell`
npx cypress-repeat run -n
Which will run Cypresss times, exiting after the first failed run or after all runs finish successfully.
You can flip the logic and run Cypress up to N times until the first successful exit
`shell`
npx cypress-repeat run -n $3
You can rerun only the specs that failed
`shell`
npx cypress-repeat run -n
Every run has two utility variables injected
`js`
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
Run this script with environment variable DEBUG=cypress-repeat` to see verbose logs
This NPM module retries the entire Cypress run, if you need to retry just the failed tests, use the Test Retries.
[ci image]: https://github.com/bahmutov/cypress-repeat/workflows/ci/badge.svg?branch=main
[ci url]: https://github.com/bahmutov/cypress-repeat/actions
[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
[renovate-app]: https://renovateapp.com/