How to Tune Playwright Workers and Parallelism in GitHub Actions
workers sets how many test files run at once; on shared CI runners a fixed low count is more stable than autodetect.
Enable fullyParallel and set workers explicitly (often 1 or 2 in CI) since a hosted runner has limited CPU, then scale out with sharding across jobs instead.
playwright.config.ts
playwright.config.ts
import { defineConfig } from '@playwright/test'
export default defineConfig({
fullyParallel: true,
workers: process.env.CI ? 2 : undefined,
})Override per run
.github/workflows/ci.yml
- run: npx playwright test --workers=1Gotchas
- Too many workers on a 2-core runner causes timeouts that look like flakiness.
- For real scale, keep workers low per job and add shards across matrix jobs.
Related guides
How to Shard Playwright Tests Across a Matrix in GitHub ActionsSplit a Playwright suite across parallel GitHub Actions jobs with --shard and a matrix, then merge the blob r…
How to Set Time Budgets and Timeouts for E2E Tests in GitHub ActionsBound E2E runtime in GitHub Actions with a job timeout plus per-test and expect timeouts in Playwright, so a…