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
orreplay-firefox
)- Currently supported browser options are
replay-chromium
(Linux) orreplay-firefox
(maxOS, Linux)
- Pass the
--reporter
flag like this: --reporter=@replayio/playwright/reporter,line
For example, to use Replay Chromium, the command is:
yamlnpx 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.