Playwright · Reliable end-to-end tests
How does parallelization work in Playwright?
Short answer
Playwright runs test files in parallel across worker processes. Each worker has its own browser, and each test gets its own context. Use fullyParallel to parallelize tests within a file too.
Parallelism is based on worker processes. By default, test files are distributed across workers and can run at the same time, while tests inside a file run in order. Each worker launches its own browser and reuses it for its assigned tests.
The scheduling model
- Test files are the default parallel unit
fullyParallel: truealso runs individual tests in a file in parallelworkerscaps how many processes run at once- Worker-scoped fixtures are shared within a worker, not across workers
- Each test still gets a fresh context, regardless of worker reuse
import { defineConfig } from "@playwright/test";
export default defineConfig({
fullyParallel: true,
workers: process.env.CI ? 4 : undefined,
});npx playwright test --workers=4
npx playwright test --fully-parallel
npx playwright test tests/checkout.spec.ts --workers=1Parallelism multiplies shared-state bugs. If two workers use the same login or the same seeded record, they will collide more often than in a serial run. Fix the data strategy before increasing workers, or the suite will look flaky only on fast machines.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the default parallel unit?
- 2What does fullyParallel change?
- 3Why can more workers make a suite slower?
- 4How does worker scope interact with parallelism?
Say it in the interview
By default Playwright parallelizes at the test-file level across worker processes, and each worker has its own browser. Setting fullyParallel also parallelizes tests within a file, and the workers option caps concurrency. Every test still gets a fresh context. I fix shared test data before raising worker counts, because parallelism exposes collisions that serial runs hide, and more workers can actually be slower under server or database contention.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Playwright mock interview and get scored feedback on depth, clarity and confidence.