The
@replayio/cypress
plugin includes a cypress runner that includes diagnostic modes to help identify issues with the Replay browsers. The runner uses cypressโs module API to invoke cypress multiple times with different environment variables to adjust the behavior of the Replay browser.shellnpx @replayio/cypress run --mode <mode> <...other cypress parameters>
Record on Retry
shellnpx @replayio/cypress run --mode record-on-retry
Runs the test suite once with recording disabled and if any specs fail, those are re-ran with recording enabled.
Stress
shellnpx @replayio/cypress run --mode stress
Runs the test suite 10 times regardless of test result
Diagnostics
shellnpx @replayio/cypress run --mode diagnostics --level basic
Basic
When level is set to
basic
, the test suite is run 3 times:- Recording disabled
- Recording enabled
- Recording enabled with debug assertions disabled
Full
When level is set to
full
, the test suite is run many times (currently 38) with each run disabling a different browser feature. Due to the number of runs, this should often be limited to a specific spec file that is failing.shellnpx @replayio/cypress run --mode diagnostics --level full --spec cypress/e2e/failing-spec.ts
Running a test case multiple times in development
If you want to quickly reproduce a flaky test, you can also re-run the test case in a loop several times as well. This strategy can sometimes be easier if you want to quickly record a flake locally.
javascriptdescribe('Verify "Login" is visible. Test: '+i, () => { for (let i = 0; i < 3 ; i++) { it('finds the Login link in the header', () => { //Place code inside the loop that you want to repeat }) } })