Quick Start
Running Playwright tests in Parallel in GitHub Actions using Matrix Workflow
Quick Start
The example workflow file below shows how to run Playwright tests in GitHub actions. It assumes the repository already reports to Currents locally, as set up in Quick Start, so npm ci installs @currents/playwright.
Store the Record Key as the CURRENTS_RECORD_KEY repository secret and the Project ID as the CURRENTS_PROJECT_ID repository variable (Settings → Secrets and variables → Actions). Pull requests from forks get no secrets, so their runs don't reach Currents.
To record without storing the Record Key, give the job permissions: id-token: write and leave out CURRENTS_RECORD_KEY: @currents/playwright 2.8.0 or later exchanges the job's OIDC token for a short-lived record key. See Record from CI with an OIDC token instead of a record key. With npx playwright test, this needs Playwright 1.62 or later; on an older Playwright, run npx pwc.
The workflow above is the simplest way to get started. As the test suite grows, parallelization helps keep execution time fast.
Parallelization
The GitHub Actions matrix execution strategy can create multiple containers that run Playwright tests in parallel.
Each container receives a unique set of tests. This makes the browser test suite finish faster and gives feedback sooner.

This can be done with Playwright Sharding. Playwright can split tests between multiple CI machines using the --shard CLI flag. The examples below show how to set up sharding and orchestration.
Examples
The example repository showcases running Playwright tests in GitHub Actions. We've included several config files to exemplify the workflows:
test-basic-pwc.yml - run Playwright tests in parallel using 3 shards of GitHub Actions Matrix and
pwccommand.test-basic-reporter.yml - run Playwright tests in parallel run using 3 shards of GitHub Actions Matrix and configuring Currents Reporter in
playwright.config.ts.test-or8n.yml - run Playwright tests in parallel Playwright using Orchestration Setup and GitHub Actions Matrix. Currents Orchestration speeds up CI runs by up to 40% (compared to native sharding) by optimally balancing tests between the available machines.
reruns-or8n.yml - Orchestration failed-only reruns.
argos-example.yml - run Playwright tests in parallel using Currents Orchestration, use Argos CI for visual testing.
Last updated
Was this helpful?