Skip to content

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

docs: improve execution modes (#35412)

Jean-François Greffier468ea7672d06
diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md
index eefaeb4246..aa200d18e3 100644
--- a/docs/src/test-api/class-test.md
+++ b/docs/src/test-api/class-test.md
@@ -469,7 +469,18 @@ Learn more about the execution modes [here](../test-parallel.md).
test('runs in parallel 2', async ({ page }) => {});
```
-* Running tests serially, retrying from the start.
+* Running tests in order, retrying each failed test independetly.
+
+ This is the default mode. It can be useful to set it explicitly to override project configuration that uses `fullyParallel`.
+
+ ```js
+ // Tests in this file run in order. Retries, if any, run independently.
+ test.describe.configure({ mode: 'default' });
+ test('runs first', async ({ page }) => {});
+ test('runs second', async ({ page }) => {});
+ ```
+
+* Running tests serially, retrying from the start. If one of the serial tests fails, all subsequent tests are skipped.
:::note
Running serially is not recommended. It is usually better to make your tests isolated, so they can be run independently.
diff --git a/docs/src/test-parallel-js.md b/docs/src/test-parallel-js.md
index 9643ed6f7a..d768c748e6 100644
--- a/docs/src/test-parallel-js.md
+++ b/docs/src/test-parallel-js.md
@@ -125,6 +125,17 @@ test('runs second', async () => {
});
```
+## Opt out of fully parallel mode
+
+If your configuration applies parallel mode to all tests using [`property: TestConfig.fullyParallel`], you might still want to run some tests with default settings. You can override the mode per describe:
+```js
+test.describe('runs in parallel with other describes', () => {
+ test.describe.configure({ mode: 'default' });
+ test('in order 1', async ({ page }) => {});
+ test('in order 2', async ({ page }) => {});
+});
+```
+
## Shard tests between multiple machines
Playwright Test can shard a test suite, so that it can be executed on multiple machines.
diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts
index 23f63b83df..27991cc5db 100644
--- a/packages/playwright/types/test.d.ts
+++ b/packages/playwright/types/test.d.ts
@@ -3542,7 +3542,20 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
* test('runs in parallel 2', async ({ page }) => {});
* ```
*
- * - Running tests serially, retrying from the start.
+ * - Running tests in order, retrying each failed test independetly.
+ *
+ * This is the default mode. It can be useful to set it explicitly to override project configuration that uses
+ * `fullyParallel`.
+ *
+ * ```js
+ * // Tests in this file run in order. Retries, if any, run independently.
+ * test.describe.configure({ mode: 'default' });
+ * test('runs first', async ({ page }) => {});
+ * test('runs second', async ({ page }) => {});
+ * ```
+ *
+ * - Running tests serially, retrying from the start. If one of the serial tests fails, all subsequent tests are
+ * skipped.
*
* **NOTE** Running serially is not recommended. It is usually better to make your tests isolated, so they can be
* run independently.