Parallel Execution & Sharding in Playwright

From the Playwright cheat sheet ยท Parallelism & Sharding ยท verified Jul 2026

Parallel Execution & Sharding

Configure parallel workers and split test suites across CI machines

typescript
import { defineConfig } from '@playwright/test';

export default defineConfig({
  fullyParallel: true,          // Parallelize within files too
  workers: process.env.CI ? 1 : undefined, // Default: half CPU cores
});

// Shard from CLI
// npx playwright test --shard=1/4
// npx playwright test --shard=2/4
๐Ÿ’ก fullyParallel: true runs tests within a single file in parallel โ€” not just across files
โšก Sharding splits the full test suite across CI machines โ€” combine with GitHub Actions matrix
๐Ÿ“Œ Use describe.configure({ mode: "serial" }) when tests in a block depend on each other
๐ŸŸข Default worker count is half your CPU cores โ€” set workers: 1 on CI to reduce flakiness
parallelshardingworkersci
Back to the full Playwright cheat sheet