GitHub actions
This page covers running Replay-recorded Playwright tests on GitHub Actions: a minimal workflow, how to add Replay to an existing workflow, and how to control which recordings upload.
If you have not configured playwright.config.ts yet, start with Record your Playwright tests.
Simple setup
A working setup needs three things:
- The Replay reporter and
replay-chromiumproject inplaywright.config.ts. - A workflow that installs the Replay browser before running tests.
REPLAY_API_KEYavailable to the test step.
playwright.config.ts
playwright.config.ts1import { PlaywrightTestConfig } from "@playwright/test";2import { devices as replayDevices, replayReporter } from "@replayio/playwright";34const config: PlaywrightTestConfig = {5 reporter: [6 replayReporter({7 apiKey: process.env.REPLAY_API_KEY,8 upload: true,9 }),10 ["line"],11 ],12 projects: [13 {14 name: "replay-chromium",15 use: { ...replayDevices["Replay Chromium"] },16 },17 ],18};19export default config;
.github/workflows/e2e.yml
.github/workflows/e2e.yml1name: End-to-end tests2on:3 pull_request:4 push:5 branches: [main]6jobs:7 e2e-tests:8 runs-on: ubuntu-22.049 steps:10 - name: Checkout11 uses: actions/checkout@v412 # If you're using Yarn or PNPM, use the appropriate install command here13 - name: Install dependencies14 run: npm ci15 - name: Install Replay Chromium16 run: npx replayio install17 - name: Run Playwright tests18 run: npx playwright test --project replay-chromium19 env:20 REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}
Add the workspace API key to Settings → Secrets and variables → Actions as REPLAY_API_KEY so the job can upload to your workspace.
Adding Replay to an existing workflow
Replay does not replace your existing test workflow—it only adds two things and wires the API key into the test step.
- Add
npx replayio installbefore tests run. If you previously installed Playwright's browsers (npx playwright install), keep that step only if you also run non-Replay projects; otherwise the Replay browser is enough. Chromium being preinstalled on the runner does not cover Replay—you still need this step. - Pass
REPLAY_API_KEYto the step that runs tests viaenv:(usingsecrets.REPLAY_API_KEY). - Run with
--project replay-chromiumif your config defines more than one project. Without--project, Playwright runs all of them.
Leave the rest alone: checkout, dependency install, database setup, preview-deployment waits, etc. are application concerns and stay as-is.
If your tests depend on a preview deployment (Vercel, Netlify, Cloudflare, etc.), the wait-for-deployment step still belongs before the Playwright run. Replay does not change that ordering.
Controlling which recordings upload
Upload behavior is configured on replayReporter in playwright.config.ts—not in YAML. The reporter handles uploads during the test run, so you do not need a separate "upload" step.
For full coverage of upload options, see Upload strategies. The most common patterns are below.
Upload only failed tests
playwright.config.ts1import { PlaywrightTestConfig } from "@playwright/test";2import { devices as replayDevices, replayReporter } from "@replayio/playwright";34const config: PlaywrightTestConfig = {5 reporter: [6 replayReporter({7 apiKey: process.env.REPLAY_API_KEY,8 upload: {9 statusThreshold: "failed",10 },11 }),12 ["line"],13 ],14 projects: [15 {16 name: "replay-chromium",17 use: { ...replayDevices["Replay Chromium"] },18 },19 ],20};21export default config;
The workflow YAML stays identical to Simple setup above.
Uploading both failed and passed tests makes side-by-side comparison easier when you debug. See Upload strategies for the full set of options, including failed-and-flaky and minimizeUploads.
Setting recording visibility
Uploaded recordings are private by default. Visibility is managed in the Replay app at the recording or workspace level after upload—it is not a replayReporter option.
If your workflow still uses the legacy replayio/action-upload GitHub Action, that action accepts a public input. New Playwright setups should rely on replayReporter for uploads instead.
Troubleshooting CI runs
- Tests run but no recordings appear — Confirm
REPLAY_API_KEYis set in the test step'senv, and that theRun Playwright testsstep uses--project replay-chromium. Look for the[replay.io]log lines at the end of the test step. - Workflow logs show "None of the configured projects ran using Replay Chromium" — The CLI did not target the Replay project. Add or fix
--project replay-chromium. npx replayio installfails — Re-run with verbose logging, and confirm the runner has network access to download the Replay browser.- Recordings only appear from your local machine — Double-check that the secret is named
REPLAY_API_KEY(case-sensitive) and thatsecrets.REPLAY_API_KEYis referenced correctly in the workflow.