feat: update overrides-test.d.ts

This commit is contained in:
Pengoose 2024-10-12 17:54:16 +09:00 committed by pengoosedev
parent b1609e50d4
commit b0ccd000e0
2 changed files with 961 additions and 425 deletions

View file

@ -3549,6 +3549,82 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* @param description Optional description that will be reflected in a test report. * @param description Optional description that will be reflected in a test report.
*/ */
fixme(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void; fixme(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
/**
* Marks a test as "should fail". Playwright runs this test and ensures that it is actually failing. This is useful
* for documentation purposes to acknowledge that some functionality is broken until it is fixed.
*
* To declare a "failing" test:
* - `test.fail(title, body)`
* - `test.fail(title, details, body)`
*
* To annotate test as "failing" at runtime:
* - `test.fail(condition, description)`
* - `test.fail(callback, description)`
* - `test.fail()`
*
* **Usage**
*
* You can declare a test as failing, so that Playwright ensures it actually fails.
*
* ```js
* import { test, expect } from '@playwright/test';
*
* test.fail('not yet ready', async ({ page }) => {
* // ...
* });
* ```
*
* If your test fails in some configurations, but not all, you can mark the test as failing inside the test body based
* on some condition. We recommend passing a `description` argument in this case.
*
* ```js
* import { test, expect } from '@playwright/test';
*
* test('fail in WebKit', async ({ page, browserName }) => {
* test.fail(browserName === 'webkit', 'This feature is not implemented for Mac yet');
* // ...
* });
* ```
*
* You can mark all tests in a file or
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
* "should fail" based on some condition with a single `test.fail(callback, description)` call.
*
* ```js
* import { test, expect } from '@playwright/test';
*
* test.fail(({ 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()` without arguments inside the test body to always mark the test as failed. We
* recommend declaring a failing test with `test.fail(title, body)` instead.
*
* ```js
* import { test, expect } from '@playwright/test';
*
* test('less readable', async ({ page }) => {
* test.fail();
* // ...
* });
* ```
*
* @param title Test title.
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) 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" when the condition is `true`.
* @param callback A function that returns whether to mark as "should fail", based on test fixtures. Test or tests are marked as
* "should fail" when the return value is `true`.
* @param description Optional description that will be reflected in a test report.
*/
fail: { fail: {
/** /**
* Marks a test as "should fail". Playwright runs this test and ensures that it is actually failing. This is useful * Marks a test as "should fail". Playwright runs this test and ensures that it is actually failing. This is useful
@ -3935,48 +4011,499 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* @param description Optional description that will be reflected in a test report. * @param description Optional description that will be reflected in a test report.
*/ */
(): void; (): void;
only: {
/** /**
* Focuses the test marked as "should fail". Playwright runs this test and ensures that it is actually failing. * You can use `test.fail.only` to focus on a specific test that is expected to fail. This is particularly useful when
* This is useful for debugging purposes to focus on a specific failing test. * debugging a failing test or working on a specific issue.
* *
* To declare a "failing" test and focus on it: * To declare a focused "failing" test:
* - `test.fail.only(title, body)` * - `test.fail.only(title, body)`
* - `test.fail.only(title, details, 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** * **Usage**
* *
* You can declare and focus on a failing test: * You can declare a focused failing test, so that Playwright runs only this test and ensures it actually fails.
* *
* ```js * ```js
* import { test, expect } from '@playwright/test'; * import { test, expect } from '@playwright/test';
* *
* test.fail.only('focus on failing test', async ({ page }) => { * test.fail.only('focused failing test', async ({ page }) => {
* // Test code that is expected to fail * // 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 title Test title.
* @param body Test body. * @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.
*/
only: {
/**
* 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.
*/ */
(title: string, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void; (title: string, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
/** /**
* Focuses the test marked as "should fail" with additional details. Playwright runs this test and ensures that it is actually failing. * 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 * ```js
* import { test, expect } from '@playwright/test'; * import { test, expect } from '@playwright/test';
* *
* test.fail.only('focus on failing test', { timeout: 5000 }, async ({ page }) => { * test.fail.only('focused failing test', async ({ page }) => {
* // Test code that is expected to fail * // 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 title Test title.
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-fail) for test details description. * @param details See [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) for test
* @param body Test body. * 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.
*/ */
(title: string, details: TestDetails, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void; (title: string, details: TestDetails, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): 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.
*/
(condition: 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.
*/
(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;
}
} }
/** /**
* Marks a test as "slow". Slow test will be given triple the default timeout. * Marks a test as "slow". Slow test will be given triple the default timeout.

View file

@ -110,11 +110,20 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
fixme(): void; fixme(): void;
fixme(condition: boolean, description?: string): void; fixme(condition: boolean, description?: string): void;
fixme(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void; fixme(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
fail(title: string, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void; fail: {
fail(title: string, details: TestDetails, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void; (title: string, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
fail(condition: boolean, description?: string): void; (title: string, details: TestDetails, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
fail(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void; (condition: boolean, description?: string): void;
fail(): void; (callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
(): void;
only: {
(title: string, body: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
(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; slow(): void;
slow(condition: boolean, description?: string): void; slow(condition: boolean, description?: string): void;
slow(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void; slow(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;