Skip to content
Latchkey

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=1

Gotchas

  • 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

Run this faster and cheaper on Latchkey managed runners. Start free →