feat: remove fail.only signature(no arguments)
This commit is contained in:
parent
479eadf9d9
commit
20d28eaf6e
82
packages/playwright/types/test.d.ts
vendored
82
packages/playwright/types/test.d.ts
vendored
|
|
@ -4421,88 +4421,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* @param description Optional description that will be reflected in a test report.
|
||||
*/
|
||||
(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
|
||||
/**
|
||||
* You can use `test.fail.only` to focus on a specific test that is expected to fail. This is particularly useful when
|
||||
* debugging a failing test or working on a specific issue.
|
||||
*
|
||||
* To declare a focused "failing" test:
|
||||
* - `test.fail.only(title, body)`
|
||||
* - `test.fail.only(title, details, body)`
|
||||
*
|
||||
* To conditionally focus a "failing" test:
|
||||
* - `test.fail.only(condition, description)`
|
||||
* - `test.fail.only(callback, description)`
|
||||
* - `test.fail.only()`
|
||||
*
|
||||
* **Usage**
|
||||
*
|
||||
* You can declare a focused failing test, so that Playwright runs only this test and ensures it actually fails.
|
||||
*
|
||||
* ```js
|
||||
* import { test, expect } from '@playwright/test';
|
||||
*
|
||||
* test.fail.only('focused failing test', async ({ page }) => {
|
||||
* // This test is expected to fail
|
||||
* expect(1).toBe(2);
|
||||
* });
|
||||
* test('not in the focused group', async ({ page }) => {
|
||||
* // This test will not run
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* If your focused failing test fails in some configurations, but not all, you can mark it as failing based on some
|
||||
* condition. We recommend passing a `description` argument in this case.
|
||||
*
|
||||
* ```js
|
||||
* import { test, expect } from '@playwright/test';
|
||||
*
|
||||
* test('fail in WebKit with focus', async ({ page, browserName }) => {
|
||||
* test.fail.only(browserName === 'webkit', 'This feature is not implemented for Mac yet');
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* You can mark all tests within a file or
|
||||
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
||||
* focused "should fail" based on some condition with a single `test.fail.only(callback, description)` call.
|
||||
*
|
||||
* ```js
|
||||
* import { test, expect } from '@playwright/test';
|
||||
*
|
||||
* test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
*
|
||||
* test('fail in WebKit 1', async ({ page }) => {
|
||||
* // ...
|
||||
* });
|
||||
* test('fail in WebKit 2', async ({ page }) => {
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* You can also call `test.fail.only()` without arguments inside the test body to always mark the test as failed and
|
||||
* focused. We recommend declaring a focused failing test with `test.fail.only(title, body)` instead.
|
||||
*
|
||||
* ```js
|
||||
* import { test, expect } from '@playwright/test';
|
||||
*
|
||||
* test('focused and always failing test', async ({ page }) => {
|
||||
* test.fail.only();
|
||||
* // This test is expected to fail
|
||||
* expect(1).toBe(2);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param title Test title.
|
||||
* @param details See [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) for test
|
||||
* details description.
|
||||
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
||||
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
||||
* @param condition Test is marked as "should fail" and focused when the condition is `true`.
|
||||
* @param callback A function that returns whether to mark as "should fail" and focused, based on test fixtures. Test or tests are
|
||||
* marked as "should fail" and focused when the return value is `true`.
|
||||
* @param description Optional description that will be reflected in a test report.
|
||||
*/
|
||||
(): void;
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
1
utils/generate_types/overrides-test.d.ts
vendored
1
utils/generate_types/overrides-test.d.ts
vendored
|
|
@ -121,7 +121,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
(title: string, details: TestDetails, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
||||
(condition: boolean, description?: string): void;
|
||||
(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
|
||||
(): void;
|
||||
}
|
||||
}
|
||||
slow(): void;
|
||||
|
|
|
|||
Loading…
Reference in a new issue