docs: add workers for ci (#23046)

This commit is contained in:
Debbie O'Brien 2023-05-17 17:38:03 +02:00 committed by GitHub
parent 2e5ddd4361
commit 94f928600d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.