Installation
Run the following in your project directory:
npm i @replayio/cypress
This installs the Replay Browsers on your machine and provides functionality for recording tests with Replay.
Configuration
Cypress v. 10+
In your Cypress config file, import
cypressReplay
from @replayio/cypress
.Then, add
cypressReplay
inside setupNodeEvents
.The examples below correspond to the configuration examples in the Cypress docs.
CommonJS syntax
javascriptconst { defineConfig } = require("cypress"); const cypressReplay = require("@replayio/cypress"); module.exports = defineConfig({ e2e: { screenshotOnRunFailure: false, video: false, setupNodeEvents(on, config) { cypressReplay.default(on, config); return config; }, }, });
ESM Module syntax
typescriptimport { defineConfig } from "cypress"; import cypressReplay from "@replayio/cypress"; export default defineConfig({ e2e: { screenshotOnRunFailure: false, video: false, setupNodeEvents(on, config) { cypressReplay(on, config); return config; }, }, });
Cypress legacy versions
In your Cypress plugins file, add the following code:
javascriptconst cypressReplay = require("@replayio/cypress"); module.exports = (on, config) => { cypressReplay.default(on, config); return config; };
Screenshots and Videos
In these examples,
video
and screenshotOnRunFailure
are set to false
. This is not required, but recommended to improve performance. Screenshots and videos typically arenโt needed when you already have a replay!
Once configured, continue to Recording Tests.