Record your Playwright tests with Replay and automatically upload replays of failed tests.
Use with @replayio/playwright
Using action-playwright
in your GitHub Actions workflow is the easiest way to get started recording your Playwright tests in CI.
The action:
- Ensures Replay Browsers are installed on the CI machine
- 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
- Comments on the initiating pull request with links to the test run and replays
First, add replayio/playwright
and configure using instructions in the Recording Automated Tests guide.
Then:
- Log into app.replay.io
- Create a Team API key (Personal API keys can be used, but have a limit of 10 recordings)
- Store the API key as a GitHub Repository Secret named
RECORD_REPLAY_API_KEY
- Add the configuration below to your existing workflow (or start a new one with the complete example below)
- Install the Replay GitHub App to add comments to your Pull Requests with links to replays of your tests
- uses: replayio/action-playwright@v0.7.0
with:
api-key: ${{ secrets.RECORD_REPLAY_API_KEY }}
project: replay-firefox
Required | Name | Description | Default |
---|---|---|---|
✅ | api-key |
The Replay API Key used to upload recordings | |
project |
The @playwright/test project to run |
||
public |
When true, make replays public on upload | false |
|
command |
The command to run your playwright tests | npx playwright test |
|
working-directory |
The relative working directory for the app | . |
|
upload-all |
Upload all recordings instead of only recordings of failed tests | false |
Note: This action appends arguments to your
command
to configure a custom reporter. If you're using a command likenpm
to runplaywright test
, you may need to include--
at the end to allow those arguments to pass to Playwright.
# .github/workflow/ci.yml
name: Playwright Tests
on:
pull_request:
jobs:
playwright-tests:
name: Playwright tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bahmutov/npm-install@v1
# with:
# working-directory: .
- uses: replayio/action-playwright@v0.7.0
with:
# An optional command to run your tests.
command: npx playwright test
# When true, replays will be accessible to anyone with the link.
# This is useful for open source projects that want to collaborate
# with external users.
public: true
# The `@playwright/test` project to use. This should point to a project
# that uses a Replay runtime.
project: replay-firefox
# An API key (usually a Team API Key) to use to upload replays.
# Configure this via GitHub repo settings.
api-key: ${{ secrets.RECORD_REPLAY_API_KEY }}
# An optional working directory which is useful if the project being
# tested resides in a subdirectory of the repository
working-directory: .