From a1316f4e2b7ae984ef02657087e5b9d263fab8ac Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Thu, 26 Sep 2024 16:10:35 -0700 Subject: [PATCH] fix(testing): add support for playwright --last-failed --last-failed allows running only the failed tests from the previous run example: playwright test --last-failed Closes #28096 --- docs/generated/packages/playwright/executors/playwright.json | 4 ++++ .../playwright/src/executors/playwright/playwright.impl.ts | 3 ++- packages/playwright/src/executors/playwright/schema.json | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/generated/packages/playwright/executors/playwright.json b/docs/generated/packages/playwright/executors/playwright.json index a6d210aad88a1d..21155b9b5414e2 100644 --- a/docs/generated/packages/playwright/executors/playwright.json +++ b/docs/generated/packages/playwright/executors/playwright.json @@ -24,6 +24,10 @@ "type": "boolean", "description": "Run tests with Playwright Inspector. Shortcut for 'PWDEBUG=1' environment variable and '--timeout=0',--max-failures=1 --headed --workers=1' options" }, + "failedOnly": { + "type": "boolean", + "description": "Run only the tests that failed in the last run" + }, "forbidOnly": { "type": "boolean", "description": "Fail if test.only is called" diff --git a/packages/playwright/src/executors/playwright/playwright.impl.ts b/packages/playwright/src/executors/playwright/playwright.impl.ts index 5ea711aba536f6..14d03c9fb42d3b 100644 --- a/packages/playwright/src/executors/playwright/playwright.impl.ts +++ b/packages/playwright/src/executors/playwright/playwright.impl.ts @@ -1,4 +1,3 @@ -import { execSync, fork } from 'child_process'; import { ExecutorContext, getPackageManagerCommand, @@ -6,6 +5,7 @@ import { output, workspaceRoot, } from '@nx/devkit'; +import { execSync, fork } from 'child_process'; export interface PlaywrightExecutorSchema { /* @@ -15,6 +15,7 @@ export interface PlaywrightExecutorSchema { browser?: 'all' | 'chromium' | 'firefox' | 'webkit' | string; config?: string; debug?: boolean; + failedOnly?: boolean; forbidOnly?: boolean; fullyParallel?: boolean; grep?: string; diff --git a/packages/playwright/src/executors/playwright/schema.json b/packages/playwright/src/executors/playwright/schema.json index 8b2c1c39996a1c..37eb2a55a7393b 100644 --- a/packages/playwright/src/executors/playwright/schema.json +++ b/packages/playwright/src/executors/playwright/schema.json @@ -21,6 +21,10 @@ "type": "boolean", "description": "Run tests with Playwright Inspector. Shortcut for 'PWDEBUG=1' environment variable and '--timeout=0',--max-failures=1 --headed --workers=1' options" }, + "failedOnly": { + "type": "boolean", + "description": "Run only the tests that failed in the last run" + }, "forbidOnly": { "type": "boolean", "description": "Fail if test.only is called"