Skip to content

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

fix(test runner): add an overload for test.skip(title, fn) (#8454)

Dmitry Gozmana479cb6f52d9
diff --git a/tests/playwright-test/test-modifiers.spec.ts b/tests/playwright-test/test-modifiers.spec.ts
index 690f527fc6..5714cc75f1 100644
--- a/tests/playwright-test/test-modifiers.spec.ts
+++ b/tests/playwright-test/test-modifiers.spec.ts
@@ -179,6 +179,10 @@ test('test modifiers should check types', async ({runTSC}) => {
// @ts-expect-error
test.skip(42);
});
+ test.skip('skipped', async ({}) => {
+ });
+ // @ts-expect-error
+ test.skip('skipped', 'skipped');
`,
});
expect(result.exitCode).toBe(0);
diff --git a/types/test.d.ts b/types/test.d.ts
index 4490d9938f..6abcc096bf 100644
--- a/types/test.d.ts
+++ b/types/test.d.ts
@@ -1626,6 +1626,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* skipped when the condition is `true`.
* @param testFunctionOrDescription When used with `test.skip('test', () => {})` notation, second argument is a test function. Otherwise it is an optional description that will be reflected in a test report.
*/
+ skip(title: string, testFunction: (args: TestArgs, testInfo: TestInfo) => Promise<void> | void): void;
skip(): void;
skip(condition: boolean): void;
skip(condition: boolean, description: string): void;
diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts
index 9cf4363f3f..db49461b58 100644
--- a/utils/generate_types/overrides-test.d.ts
+++ b/utils/generate_types/overrides-test.d.ts
@@ -227,6 +227,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
only: SuiteFunction;
};
};
+ skip(title: string, testFunction: (args: TestArgs, testInfo: TestInfo) => Promise<void> | void): void;
skip(): void;
skip(condition: boolean): void;
skip(condition: boolean, description: string): void;