docs: update fail.only docs
This commit is contained in:
parent
20d28eaf6e
commit
2f0f1836c1
|
|
@ -1032,6 +1032,7 @@ An object containing fixtures and/or options. Learn more about [fixtures format]
|
|||
|
||||
|
||||
|
||||
|
||||
## method: Test.fail
|
||||
* since: v1.10
|
||||
|
||||
|
|
@ -1149,7 +1150,6 @@ To declare a focused "failing" test:
|
|||
To conditionally focus a "failing" test:
|
||||
* `test.fail.only(condition, description)`
|
||||
* `test.fail.only(callback, description)`
|
||||
* `test.fail.only()`
|
||||
|
||||
**Usage**
|
||||
|
||||
|
|
@ -1160,24 +1160,12 @@ 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 [`method: Test.describe`] group as focused "should fail" based on some condition with a single `test.fail.only(callback, description)` call.
|
||||
|
||||
```js
|
||||
|
|
@ -1186,22 +1174,10 @@ import { test, expect } from '@playwright/test';
|
|||
test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
|
||||
test('fail in WebKit 1', async ({ page }) => {
|
||||
// ...
|
||||
// This test will not run
|
||||
});
|
||||
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);
|
||||
// This test will not run
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
|||
155
packages/playwright/types/test.d.ts
vendored
155
packages/playwright/types/test.d.ts
vendored
|
|
@ -4022,7 +4022,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* To conditionally focus a "failing" test:
|
||||
* - `test.fail.only(condition, description)`
|
||||
* - `test.fail.only(callback, description)`
|
||||
* - `test.fail.only()`
|
||||
*
|
||||
* **Usage**
|
||||
*
|
||||
|
|
@ -4033,25 +4032,12 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
*
|
||||
* 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.
|
||||
|
|
@ -4062,23 +4048,10 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
*
|
||||
* test('fail in WebKit 1', async ({ page }) => {
|
||||
* // ...
|
||||
* // This test will not run
|
||||
* });
|
||||
* 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);
|
||||
* // This test will not run
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
|
|
@ -4104,7 +4077,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* To conditionally focus a "failing" test:
|
||||
* - `test.fail.only(condition, description)`
|
||||
* - `test.fail.only(callback, description)`
|
||||
* - `test.fail.only()`
|
||||
*
|
||||
* **Usage**
|
||||
*
|
||||
|
|
@ -4115,25 +4087,12 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
*
|
||||
* 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.
|
||||
|
|
@ -4144,23 +4103,10 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
*
|
||||
* test('fail in WebKit 1', async ({ page }) => {
|
||||
* // ...
|
||||
* // This test will not run
|
||||
* });
|
||||
* 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);
|
||||
* // This test will not run
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
|
|
@ -4186,7 +4132,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* To conditionally focus a "failing" test:
|
||||
* - `test.fail.only(condition, description)`
|
||||
* - `test.fail.only(callback, description)`
|
||||
* - `test.fail.only()`
|
||||
*
|
||||
* **Usage**
|
||||
*
|
||||
|
|
@ -4197,25 +4142,12 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
*
|
||||
* 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.
|
||||
|
|
@ -4226,23 +4158,10 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
*
|
||||
* test('fail in WebKit 1', async ({ page }) => {
|
||||
* // ...
|
||||
* // This test will not run
|
||||
* });
|
||||
* 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);
|
||||
* // This test will not run
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
|
|
@ -4268,7 +4187,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* To conditionally focus a "failing" test:
|
||||
* - `test.fail.only(condition, description)`
|
||||
* - `test.fail.only(callback, description)`
|
||||
* - `test.fail.only()`
|
||||
*
|
||||
* **Usage**
|
||||
*
|
||||
|
|
@ -4279,25 +4197,12 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
*
|
||||
* 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.
|
||||
|
|
@ -4308,23 +4213,10 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
*
|
||||
* test('fail in WebKit 1', async ({ page }) => {
|
||||
* // ...
|
||||
* // This test will not run
|
||||
* });
|
||||
* 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);
|
||||
* // This test will not run
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
|
|
@ -4350,7 +4242,6 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* To conditionally focus a "failing" test:
|
||||
* - `test.fail.only(condition, description)`
|
||||
* - `test.fail.only(callback, description)`
|
||||
* - `test.fail.only()`
|
||||
*
|
||||
* **Usage**
|
||||
*
|
||||
|
|
@ -4361,25 +4252,12 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
*
|
||||
* 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.
|
||||
|
|
@ -4390,23 +4268,10 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|||
* test.fail.only(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
||||
*
|
||||
* test('fail in WebKit 1', async ({ page }) => {
|
||||
* // ...
|
||||
* // This test will not run
|
||||
* });
|
||||
* 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);
|
||||
* // This test will not run
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue