Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: add workers for ci (#23046)

Debbie O'Brien94f928600d5f
diff --git a/docs/src/ci.md b/docs/src/ci.md
index bca0803c19..5ac5ad99fd 100644
--- a/docs/src/ci.md
+++ b/docs/src/ci.md
@@ -6,7 +6,6 @@ title: "Continuous Integration"
Playwright tests can be executed in CI environments. We have created sample
configurations for common CI providers.
-<!-- TOC -->
## Introduction
@@ -50,6 +49,21 @@ configurations for common CI providers.
dotnet test
```
+## Workers
+* langs: js
+
+We recommend setting [workers](./api/class-testconfig.md#test-config-workers) to "1" in CI environments to prioritize stability and reproducibility. Running tests sequentially ensures each test gets the full system resources, avoiding potential conflicts. However, if you have a powerful self-hosted CI system, you may enable [parallel](./test-parallel.md) tests. For wider parallelization, consider [sharding](./test-parallel.md#shard-tests-between-multiple-machines) - distributing tests across multiple CI jobs.
+
+```js title="playwright.config.ts"
+import { defineConfig, devices } from '@playwright/test';
+
+export default defineConfig({
+ // Opt out of parallel tests on CI.
+ workers: process.env.CI ? 1 : undefined,
+});
+```
+
+
## CI configurations
The [Command line tools](./browsers#install-system-dependencies) can be used to install all operating system dependencies on GitHub Actions.