logo

Cypress Wrapper Node API

The @replayio/cypress package includes an optional wrapper around cypress.run() which exposes a few additional features. run() accepts all the same parameters as cypress.run() as well as the following Replay-specific options:
  • mode - The wrapper runs in one of three modes
    • 'record' - The default mode which records all tests
    • 'record-on-retry' - The whole suite is run one without recording. Any failures are accumulated and re-ran with recording enabled
    • 'stress' - Runs the suite multiple times with recording to capture flaky tests. Also see --count.
    • 'diagnostic' -Runs the suite in a diagnostic mode which runs multiple times with various flags set to adjust Replayโ€™s behaviors to isolate problems.
  • count - When running with mode: 'stress', setting count controls how many times the run is repeated
  • 'level' - When running with mode: 'diagnostic', level can be set to 'basic' or 'full' to control which diagnostics are ran.
  • timeout - Configures the time in milliseconds each iteration of cypress.run() is allowed to run
javascript
import { run } from '@replayio/cypress' // Runs cypress/e2e/my-test-spect.ts in record-on-retry mode // with a 10s timeout for each attempt. run({ mode: "record-on-retry", spec: "cypress/e2e/my-test-spec.ts", timeout: 10000 }).then(() => { console.log("Done!"); });
Share