Make sure you have an existing npm install or yarn command to install project dependencies:
npm install # or yarn
Create another test script in package.json for running tests with Replay, and replace your current test script in your CI workflow file:
"scripts": { "cy:run": "cypress run", // original test script "cy:run:replay": "RECORD_REPLAY_METADATA_FILE=$(mktemp) cypress run --browser='Replay Chromium'" // new test script }
Lastly, add a new step in the workflow for uploading the replays once they’re generated. Run the scripts below, providing your own API key:
npm i -g @replayio/replay replay metadata --init --keys source --warn replay upload-all --api-key <api key>
Lastly, add your API key to your Secrets. To get an API key, create a new Replay team and generate an API key β€” instructions can be found here.
If you run into any problems, consult our troubleshooting guide here.