From a417629b2cb9f55097db64fa6026b8b903c35c0f Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 18:35:29 -0500 Subject: [PATCH 01/16] add `skipAfterAnyFailure` option (default: true) (#1) --- packages/playwright/src/common/config.ts | 1 + packages/playwright/src/worker/workerMain.ts | 7 +++++-- packages/playwright/types/test.d.ts | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index 4578c3771a..07eddc1591 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -88,6 +88,7 @@ export class FullConfigInternal { userConfig.metadata = userConfig.metadata || {}; this.config = { + skipAfterAnyFailure: userConfig.skipAfterAnyFailure ?? true, configFile: resolvedConfigFile, rootDir: pathResolve(configDir, userConfig.testDir) || configDir, forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false), diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 8ff6d31fd0..7c89ac8526 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -393,6 +393,9 @@ export class WorkerMain extends ProcessRunner { // After hooks get an additional timeout. const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; + + const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.config.skipAfterAnyFailure; + await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; @@ -425,7 +428,7 @@ export class WorkerMain extends ProcessRunner { // In case of failure the worker will be stopped and we have to make sure that afterAll // hooks run before worker fixtures teardown. for (const suite of reversedSuites) { - if (!nextSuites.has(suite) || testInfo._isFailure()) { + if (!nextSuites.has(suite) || FAILURE_AND_SkIP_NOW) { try { await this._runAfterAllHooksForSuite(suite, testInfo); } catch (error) { @@ -440,7 +443,7 @@ export class WorkerMain extends ProcessRunner { checkForFloatingPromises('afterAll/afterEach hooks'); - if (testInfo._isFailure()) + if (FAILURE_AND_SkIP_NOW) this._isStopped = true; if (this._isStopped) { diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 4c2766232d..c527d0b680 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -792,6 +792,8 @@ type LiteralUnion = T | (U & { zz_IGNORE_ME?: never }); * */ interface TestConfig { + skipAfterAnyFailure: boolean; + /** * Playwright Test supports running multiple test projects at the same time. See * [TestProject](https://playwright.dev/docs/api/class-testproject) for more information. From 37d396284fc9fd49adfa924a71ca28e384b4f84e Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 18:59:04 -0500 Subject: [PATCH 02/16] fix types Signed-off-by: Alex Schwartz --- packages/playwright/types/test.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index c527d0b680..ba413ea6e7 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -792,8 +792,6 @@ type LiteralUnion = T | (U & { zz_IGNORE_ME?: never }); * */ interface TestConfig { - skipAfterAnyFailure: boolean; - /** * Playwright Test supports running multiple test projects at the same time. See * [TestProject](https://playwright.dev/docs/api/class-testproject) for more information. @@ -1527,6 +1525,8 @@ interface TestConfig { total: number; }; + skipAfterAnyFailure: boolean; + /** * **NOTE** Use * [testConfig.snapshotPathTemplate](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template) @@ -1842,6 +1842,8 @@ export type Metadata = { [key: string]: any }; * [TestConfig](https://playwright.dev/docs/api/class-testconfig) instead. */ export interface FullConfig { + skipAfterAnyFailure: boolean; + /** * List of resolved projects. */ From f411c0da4771b387ddbb3e15d58eac67af84fe49 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:00:49 -0500 Subject: [PATCH 03/16] take two Signed-off-by: Alex Schwartz --- packages/playwright/types/test.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index ba413ea6e7..95dd6365b1 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1525,7 +1525,7 @@ interface TestConfig { total: number; }; - skipAfterAnyFailure: boolean; + skipAfterAnyFailure?: boolean; /** * **NOTE** Use From 90e962f250e75b1d5f8a5fa2773ddebc500ebc64 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:02:11 -0500 Subject: [PATCH 04/16] Update test.d.ts Signed-off-by: Alex Schwartz --- packages/playwright/types/test.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 95dd6365b1..cb46adeea2 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1842,7 +1842,7 @@ export type Metadata = { [key: string]: any }; * [TestConfig](https://playwright.dev/docs/api/class-testconfig) instead. */ export interface FullConfig { - skipAfterAnyFailure: boolean; + skipAfterAnyFailure?: boolean; /** * List of resolved projects. From 9989b955a01728e83d39ee16bed8ceba820282d4 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:15:23 -0500 Subject: [PATCH 05/16] Update test.d.ts Signed-off-by: Alex Schwartz --- packages/playwright/types/test.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index cb46adeea2..14f2f75f02 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1842,8 +1842,6 @@ export type Metadata = { [key: string]: any }; * [TestConfig](https://playwright.dev/docs/api/class-testconfig) instead. */ export interface FullConfig { - skipAfterAnyFailure?: boolean; - /** * List of resolved projects. */ From aa5fed6eb3c69905aa3bd54f7560db6080b5309f Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:16:38 -0500 Subject: [PATCH 06/16] Update config.ts Signed-off-by: Alex Schwartz --- packages/playwright/src/common/config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index 07eddc1591..e443f86a29 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -49,6 +49,7 @@ export class FullConfigInternal { readonly projects: FullProjectInternal[] = []; readonly singleTSConfigPath?: string; readonly populateGitInfo: boolean; + readonly skipAfterAnyFailure: boolean; cliArgs: string[] = []; cliGrep: string | undefined; cliGrepInvert: string | undefined; @@ -87,8 +88,9 @@ export class FullConfigInternal { // so that plugins such as gitCommitInfoPlugin can populate metadata once. userConfig.metadata = userConfig.metadata || {}; + this.skipAfterAnyFailure = userConfig.skipAfterAnyFailure ?? true; + this.config = { - skipAfterAnyFailure: userConfig.skipAfterAnyFailure ?? true, configFile: resolvedConfigFile, rootDir: pathResolve(configDir, userConfig.testDir) || configDir, forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false), From 0b5b2be88a91c05ea9b243ab3e2229fda81d9a21 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:17:15 -0500 Subject: [PATCH 07/16] Update workerMain.ts Signed-off-by: Alex Schwartz --- packages/playwright/src/worker/workerMain.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 7c89ac8526..140a39a20d 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.config.skipAfterAnyFailure; + const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.skipAfterAnyFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; From 1aebad3ffe36863f1d8a26cdc0b7c92426167400 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:47:00 -0500 Subject: [PATCH 08/16] type fixes (#2) --- docs/src/test-api/class-fullconfig.md | 4 ++++ docs/src/test-api/class-testconfig.md | 3 +++ packages/playwright/src/common/config.ts | 4 +--- packages/playwright/src/worker/workerMain.ts | 2 +- packages/playwright/types/test.d.ts | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/src/test-api/class-fullconfig.md b/docs/src/test-api/class-fullconfig.md index 923c9fa858..5af11cf24f 100644 --- a/docs/src/test-api/class-fullconfig.md +++ b/docs/src/test-api/class-fullconfig.md @@ -109,6 +109,10 @@ Base directory for all relative paths used in the reporters. - type: <[null]|[Object]> - `total` <[int]> The total number of shards. - `current` <[int]> The index of the shard to execute, one-based. + +## property: FullConfig.skipAfterAnyFailure +* since: v1.51 +- type: <[boolean]> See [`property: TestConfig.shard`]. diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 0acafa16c5..04a7dca6db 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -506,6 +506,9 @@ export default defineConfig({ }); ``` +## property: TestConfig.skipAfterAnyFailure? +* since: v1.51 +- type: <[boolean]> ## property: TestConfig.testDir * since: v1.10 diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index e443f86a29..bcb8442e03 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -49,7 +49,6 @@ export class FullConfigInternal { readonly projects: FullProjectInternal[] = []; readonly singleTSConfigPath?: string; readonly populateGitInfo: boolean; - readonly skipAfterAnyFailure: boolean; cliArgs: string[] = []; cliGrep: string | undefined; cliGrepInvert: string | undefined; @@ -88,8 +87,6 @@ export class FullConfigInternal { // so that plugins such as gitCommitInfoPlugin can populate metadata once. userConfig.metadata = userConfig.metadata || {}; - this.skipAfterAnyFailure = userConfig.skipAfterAnyFailure ?? true; - this.config = { configFile: resolvedConfigFile, rootDir: pathResolve(configDir, userConfig.testDir) || configDir, @@ -108,6 +105,7 @@ export class FullConfigInternal { quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false), projects: [], shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null), + skipAfterAnyFailure: userConfig.skipAfterAnyFailure ?? true, updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'), updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, 'patch'), version: require('../../package.json').version, diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 140a39a20d..7c89ac8526 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.skipAfterAnyFailure; + const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.config.skipAfterAnyFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 14f2f75f02..8de3cc17a5 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1949,6 +1949,8 @@ export interface FullConfig { current: number; }; + skipAfterAnyFailure: boolean; + /** * See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots). */ From 7e724fda1908f9f7c5eab94f0f6cbe3d467b7d25 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 19:53:58 -0500 Subject: [PATCH 09/16] oops Signed-off-by: Alex Schwartz --- docs/src/test-api/class-fullconfig.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/test-api/class-fullconfig.md b/docs/src/test-api/class-fullconfig.md index 5af11cf24f..c52a7307bb 100644 --- a/docs/src/test-api/class-fullconfig.md +++ b/docs/src/test-api/class-fullconfig.md @@ -109,13 +109,13 @@ Base directory for all relative paths used in the reporters. - type: <[null]|[Object]> - `total` <[int]> The total number of shards. - `current` <[int]> The index of the shard to execute, one-based. - + +See [`property: TestConfig.shard`]. + ## property: FullConfig.skipAfterAnyFailure * since: v1.51 - type: <[boolean]> -See [`property: TestConfig.shard`]. - ## property: FullConfig.updateSnapshots * since: v1.10 - type: <[UpdateSnapshots]<"all"|"changed"|"missing"|"none">> From aa91317c96de569f013013fca5ff3d44c8fd87f7 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Fri, 21 Feb 2025 20:01:34 -0500 Subject: [PATCH 10/16] try again (#3) --- docs/src/test-api/class-fullconfig.md | 4 ---- packages/playwright/src/common/config.ts | 4 +++- packages/playwright/src/worker/workerMain.ts | 2 +- packages/playwright/types/test.d.ts | 2 -- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/src/test-api/class-fullconfig.md b/docs/src/test-api/class-fullconfig.md index c52a7307bb..923c9fa858 100644 --- a/docs/src/test-api/class-fullconfig.md +++ b/docs/src/test-api/class-fullconfig.md @@ -112,10 +112,6 @@ Base directory for all relative paths used in the reporters. See [`property: TestConfig.shard`]. -## property: FullConfig.skipAfterAnyFailure -* since: v1.51 -- type: <[boolean]> - ## property: FullConfig.updateSnapshots * since: v1.10 - type: <[UpdateSnapshots]<"all"|"changed"|"missing"|"none">> diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index bcb8442e03..e443f86a29 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -49,6 +49,7 @@ export class FullConfigInternal { readonly projects: FullProjectInternal[] = []; readonly singleTSConfigPath?: string; readonly populateGitInfo: boolean; + readonly skipAfterAnyFailure: boolean; cliArgs: string[] = []; cliGrep: string | undefined; cliGrepInvert: string | undefined; @@ -87,6 +88,8 @@ export class FullConfigInternal { // so that plugins such as gitCommitInfoPlugin can populate metadata once. userConfig.metadata = userConfig.metadata || {}; + this.skipAfterAnyFailure = userConfig.skipAfterAnyFailure ?? true; + this.config = { configFile: resolvedConfigFile, rootDir: pathResolve(configDir, userConfig.testDir) || configDir, @@ -105,7 +108,6 @@ export class FullConfigInternal { quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false), projects: [], shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null), - skipAfterAnyFailure: userConfig.skipAfterAnyFailure ?? true, updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'), updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, 'patch'), version: require('../../package.json').version, diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 7c89ac8526..140a39a20d 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.config.skipAfterAnyFailure; + const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.skipAfterAnyFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 8de3cc17a5..14f2f75f02 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1949,8 +1949,6 @@ export interface FullConfig { current: number; }; - skipAfterAnyFailure: boolean; - /** * See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots). */ From d9da8c2cc0ea6f31f250ea0cd30ec259e6d232cd Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:24:59 -0500 Subject: [PATCH 11/16] Recreate worker (#4) --- docs/src/test-api/class-testconfig.md | 2 +- packages/playwright/src/common/config.ts | 4 ++-- packages/playwright/src/worker/workerMain.ts | 2 +- packages/playwright/types/test.d.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index 04a7dca6db..e7e3c9e21b 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -506,7 +506,7 @@ export default defineConfig({ }); ``` -## property: TestConfig.skipAfterAnyFailure? +## property: TestConfig.recreateWorkerAfterFailure? * since: v1.51 - type: <[boolean]> diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index e443f86a29..3ee2ec12ea 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -49,7 +49,7 @@ export class FullConfigInternal { readonly projects: FullProjectInternal[] = []; readonly singleTSConfigPath?: string; readonly populateGitInfo: boolean; - readonly skipAfterAnyFailure: boolean; + readonly recreateWorkerAfterFailure: boolean; cliArgs: string[] = []; cliGrep: string | undefined; cliGrepInvert: string | undefined; @@ -88,7 +88,7 @@ export class FullConfigInternal { // so that plugins such as gitCommitInfoPlugin can populate metadata once. userConfig.metadata = userConfig.metadata || {}; - this.skipAfterAnyFailure = userConfig.skipAfterAnyFailure ?? true; + this.recreateWorkerAfterFailure = userConfig.recreateWorkerAfterFailure ?? true; this.config = { configFile: resolvedConfigFile, diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 140a39a20d..5d7e3a31f6 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.skipAfterAnyFailure; + const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.recreateWorkerAfterFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 14f2f75f02..c4b4f57069 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1525,7 +1525,7 @@ interface TestConfig { total: number; }; - skipAfterAnyFailure?: boolean; + recreateWorkerAfterFailure?: boolean; /** * **NOTE** Use From a768716cb9b21fb43dec40ee275ca18bb3dfcac1 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:31:40 -0500 Subject: [PATCH 12/16] Update test.d.ts Signed-off-by: Alex Schwartz --- packages/playwright/types/test.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index c4b4f57069..da82c0828d 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1422,6 +1422,8 @@ interface TestConfig { */ quiet?: boolean; + recreateWorkerAfterFailure?: boolean; + /** * The number of times to repeat each test, useful for debugging flaky tests. * @@ -1525,8 +1527,6 @@ interface TestConfig { total: number; }; - recreateWorkerAfterFailure?: boolean; - /** * **NOTE** Use * [testConfig.snapshotPathTemplate](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template) From 0a3f376b8e8b0c68d763ae28334c90d310562eb9 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:32:17 -0500 Subject: [PATCH 13/16] Update class-testconfig.md Signed-off-by: Alex Schwartz --- docs/src/test-api/class-testconfig.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index e7e3c9e21b..f878f17985 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -401,6 +401,10 @@ export default defineConfig({ }); ``` +## property: TestConfig.recreateWorkerAfterFailure? +* since: v1.51 +- type: <[boolean]> + ## property: TestConfig.repeatEach * since: v1.10 - type: ?<[int]> @@ -506,10 +510,6 @@ export default defineConfig({ }); ``` -## property: TestConfig.recreateWorkerAfterFailure? -* since: v1.51 -- type: <[boolean]> - ## property: TestConfig.testDir * since: v1.10 - type: ?<[string]> From a78f91514730cca09b8000841558aeeba07e7144 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:42:27 -0500 Subject: [PATCH 14/16] Update class-testconfig.md Signed-off-by: Alex Schwartz --- docs/src/test-api/class-testconfig.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/test-api/class-testconfig.md b/docs/src/test-api/class-testconfig.md index f878f17985..d3690f859c 100644 --- a/docs/src/test-api/class-testconfig.md +++ b/docs/src/test-api/class-testconfig.md @@ -510,6 +510,7 @@ export default defineConfig({ }); ``` + ## property: TestConfig.testDir * since: v1.10 - type: ?<[string]> From 579d8652db6c1ed2e6696a84265324a15977309e Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:44:24 -0500 Subject: [PATCH 15/16] Update workerMain.ts Signed-off-by: Alex Schwartz --- packages/playwright/src/worker/workerMain.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index 5d7e3a31f6..f2284e5bec 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_SkIP_NOW = testInfo._isFailure() && this._config.recreateWorkerAfterFailure; + const FAILURE_AND_CREATE_WORKER = testInfo._isFailure() && this._config.recreateWorkerAfterFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; @@ -428,7 +428,7 @@ export class WorkerMain extends ProcessRunner { // In case of failure the worker will be stopped and we have to make sure that afterAll // hooks run before worker fixtures teardown. for (const suite of reversedSuites) { - if (!nextSuites.has(suite) || FAILURE_AND_SkIP_NOW) { + if (!nextSuites.has(suite) || FAILURE_AND_CREATE_WORKER) { try { await this._runAfterAllHooksForSuite(suite, testInfo); } catch (error) { @@ -443,7 +443,7 @@ export class WorkerMain extends ProcessRunner { checkForFloatingPromises('afterAll/afterEach hooks'); - if (FAILURE_AND_SkIP_NOW) + if (FAILURE_AND_CREATE_WORKER) this._isStopped = true; if (this._isStopped) { From 84791086b21b1ea75c3362f9d91a1d27a61a4079 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Sat, 22 Feb 2025 08:45:28 -0500 Subject: [PATCH 16/16] last time oops Signed-off-by: Alex Schwartz --- packages/playwright/src/worker/workerMain.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts index f2284e5bec..96c69f345b 100644 --- a/packages/playwright/src/worker/workerMain.ts +++ b/packages/playwright/src/worker/workerMain.ts @@ -394,7 +394,7 @@ export class WorkerMain extends ProcessRunner { const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout); const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 }; - const FAILURE_AND_CREATE_WORKER = testInfo._isFailure() && this._config.recreateWorkerAfterFailure; + const FAILURE_AND_RECREATE_WORKER = testInfo._isFailure() && this._config.recreateWorkerAfterFailure; await testInfo._runAsStage({ title: 'After Hooks', stepInfo: { category: 'hook' } }, async () => { let firstAfterHooksError: Error | undefined; @@ -428,7 +428,7 @@ export class WorkerMain extends ProcessRunner { // In case of failure the worker will be stopped and we have to make sure that afterAll // hooks run before worker fixtures teardown. for (const suite of reversedSuites) { - if (!nextSuites.has(suite) || FAILURE_AND_CREATE_WORKER) { + if (!nextSuites.has(suite) || FAILURE_AND_RECREATE_WORKER) { try { await this._runAfterAllHooksForSuite(suite, testInfo); } catch (error) { @@ -443,7 +443,7 @@ export class WorkerMain extends ProcessRunner { checkForFloatingPromises('afterAll/afterEach hooks'); - if (FAILURE_AND_CREATE_WORKER) + if (FAILURE_AND_RECREATE_WORKER) this._isStopped = true; if (this._isStopped) {