Skip to content

[Feature]: Pre-warm a spare Playwright test worker pool to reduce cold-start gaps between tests #38737

@yevon

Description

@yevon

🚀 Feature Request

Problem / motivation

When running Playwright Test with multiple workers, each worker has a noticeable “cold start” before it begins executing its first test job (process spawn + loading config/tests + worker-scoped fixture setup + first browser launch). In my environment this is ~3–6 seconds per worker, and it can feel even slower when launching from the CLI.

There are also small idle gaps during the run when a worker finishes and the next assignment requires initialization work before the next tests begin.

Proposed behavior (how it would work)

At start, Playwright spawns workers + warmWorkers worker processes.

Only workers are allowed to run tests concurrently (so CPU/parallelism is still controlled).

The extra warmWorkers sit idle after completing worker initialization (including worker-scoped fixtures / first browser launch if feasible).

When an active worker finishes its current assignment, the dispatcher can immediately schedule the next work item onto a warm worker (or promote a warm worker to active), so the next test work starts immediately, without a cold-start penalty.

The pool keeps warmWorkers “ready” in the background by replenishing spares as needed.

Example

What I’d like to see

Add an option to pre-warm additional “spare” workers so that scheduling can immediately pick up new jobs without waiting for worker initialization.

Proposed API

CLI

npx playwright test --workers=4 --warm-workers=4
# Concurrency stays at 4, but 4 extra workers are kept "hot" and ready.

Config

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  workers: 4,
  warmWorkers: 4, // new option
});

Motivation

Reduce tests execution time significantly when the number of tests is high.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions