logo

Recording with GitHub Actions

๐Ÿ‘‰
Use of GitHub Actions is not required to enable Pull Request Comments in GitHub.

Using the Replay action-playwright

Using Replayโ€™s action-playwright in your GitHub Actions workflow is the easiest way to get started recording your Playwright tests in CI.
The action:
  • Runs your tests with the browser set for a given project
  • Uploads replays from the test run to the team associated with the given API key
๐Ÿšง
If your workflow does not have a step to install project dependencies, youโ€™ll need to add a step to install @replayio/playwright before using action-playwright.
This action should not be used in combination with other actions that execute a test run command.
๐Ÿ’ก
Once youโ€™ve recorded, view test results and replays using the Test Suite Dashboard and Pull Request Comments.

Using other GitHub Actions

If youโ€™d like to use a different action or workflow step to execute your tests, you can still configure GitHub Actions to record and upload replays.
If your workflow does not have a step to install project dependencies, youโ€™ll need to add a step to install @replayio/playwright before using action-playwright.
bash
- name: Install Replay Playwright run: npx @replayio/playwright install

Recording replays

Your existing test run command (for example, npx playwright test) 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 --project flag, and your selected browser option:
    • --project project-name (replay-chromium or replay-firefox )
    • Currently supported browser options are replay-chromium (Linux) or replay-firefox (maxOS, Linux)
  • Pass the --reporter flag like this:
    • --reporter=@replayio/playwright/reporter,line
For example, to use Replay Chromium, the command is:
yaml
npx playwright test --project replay-chromium --reporter=@replayio/playwright/reporter,line
If you donโ€™t specify a project, all projects defined in your config will run.

Uploading replays

Use replayio/action-upload to upload replays generated during the test run.
bash
- name: Upload replays if: ${{ always() }} uses: replayio/action-upload@v0.5.1 with: public: true api-key: ${{ secrets.RECORD_REPLAY_API_KEY }}
You can also use the @replayio/replay CLI to upload replays. See instructions here.
๐Ÿ’ก
Once youโ€™ve recorded, view test results and replays using the Test Suite Dashboard and Pull Request Comments.