Have questions? Weโre here to help! Contact us in Discord or at support@replay.io.
To record tests and upload replays in other CI providers, youโll need to complete the following steps in your workflow.
Install dependencies
@replayio/cypress
must be installed in your CI environment before the tests execute.If your workflow has an existing
npm ci
or yarn
command to install project dependencies, then you are all set. If not, youโll need to add a step to install all project dependencies, or you can manually install just the Replay package directly with
npm i @replayio/cypress
.Installing Replay Browsers
By default,
@replayio/cypress
also installs the required Replay Browsers. However, if you have a setting to suppress browser installations during npm ci
or yarn
, youโll need to also manually install the Replay Browsers in your workflow using:npx @replayio/cypress install
Update test run command
Your existing test run command (for example,
npx cypress run
) must be updated to include the name of a Replay Browser and required environment variables to record. You should make this update wherever your run command is defined, typically in
package.json
or directly in the workflow file.Pass the following with your run command to record with Replay:
RECORD_REPLAY_METADATA_FILE=$(mktemp)
RECORD_ALL_CONTENT=1
if using โReplay Firefoxโ
--browser "Browser Name"
(either โReplay Chromiumโ or โReplay Firefoxโ)
For example, to record with โReplay Firefoxโ, use the following command:
bashRECORD_ALL_CONTENT=1 RECORD_REPLAY_METADATA_FILE=$(mktemp) npx cypress run --browser "Replay Chromium"
If you donโt specify a browser, the Cypress default Electron will be used.
Upload replays
Use the
@replayio/replay
CLI in your workflow to add source control metadata and upload replays to your team. - Install the CLI
- Add metadata for all replays generated during the test run
- Upload replays with your API Key
Example
shellnpm i -g @replayio/replay replay metadata --init --keys source --warn replay upload-all --api-key <api key>
You can also set
RECORD_REPLAY_API_KEY
as an environment variable instead of passing to the upload-all
command. This allows you to store the API Key in your CI provider to keep it secure.The Replay CLI provides other commands and options, such as filtering which replays are uploaded.