diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md index e84979477b..dabf03d71e 100644 --- a/docs/src/test-api/class-test.md +++ b/docs/src/test-api/class-test.md @@ -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 }); ``` diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 05a29f50ba..9ab9ae1612 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -4022,7 +4022,6 @@ export interface TestType { * // 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 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 { * // 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 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 { * // 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 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 { * // 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 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 { * // 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 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 * }); * ``` *