Skip to main content
Version: 1.23

WorkerInfo

WorkerInfo contains information about the worker that is running tests. It is available to test.beforeAll(hookFunction) and test.afterAll(hookFunction) hooks and worker-scoped fixtures.

import { test, expect } from '@playwright/test';

test.beforeAll(async ({ browserName }, workerInfo) => {
console.log(`Running ${browserName} in worker #${workerInfo.workerIndex}`);
});

workerInfo.config

Processed configuration from the configuration file.

workerInfo.parallelIndex

The index of the worker between 0 and workers - 1. It is guaranteed that workers running at the same time have a different parallelIndex. When a worker is restarted, for example after a failure, the new worker process has the same parallelIndex.

Also available as process.env.TEST_PARALLEL_INDEX. Learn more about parallelism and sharding with Playwright Test.

workerInfo.project

Processed project configuration from the configuration file.

workerInfo.workerIndex

The unique index of the worker process that is running the test. When a worker is restarted, for example after a failure, the new worker process gets a new unique workerIndex.

Also available as process.env.TEST_WORKER_INDEX. Learn more about parallelism and sharding with Playwright Test.