Update types, address comments
This commit is contained in:
parent
dc833d7347
commit
0f707affa1
|
|
@ -1779,8 +1779,9 @@ Maximum time in milliseconds for the step to finish. Defaults to `0` (no timeout
|
||||||
|
|
||||||
Marks a test step as "should fail". Playwright runs this test step and ensures that it actually fails. This is useful for documentation purposes to acknowledge that some functionality is broken until it is fixed.
|
Marks a test step as "should fail". Playwright runs this test step and ensures that it actually fails. This is useful for documentation purposes to acknowledge that some functionality is broken until it is fixed.
|
||||||
|
|
||||||
To declare a "failing" step:
|
:::note
|
||||||
* `test.step.fail(title, body)`
|
If the step exceeds the timeout, a [TimeoutError] is thrown. This indicates the step did not fail as expected.
|
||||||
|
:::
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
|
|
||||||
|
|
@ -1791,7 +1792,7 @@ import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
test('my test', async ({ page }) => {
|
test('my test', async ({ page }) => {
|
||||||
// ...
|
// ...
|
||||||
await test.step.fail('not yet ready', async () => {
|
await test.step.fail('currently failing', async () => {
|
||||||
// ...
|
// ...
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -1833,9 +1834,6 @@ Maximum time in milliseconds for the step to finish. Defaults to `0` (no timeout
|
||||||
|
|
||||||
Mark a test step as "fixme", with the intention to fix it. Playwright will not run the step.
|
Mark a test step as "fixme", with the intention to fix it. Playwright will not run the step.
|
||||||
|
|
||||||
To declare a "fixme" step:
|
|
||||||
* `test.step.fixme(title, body)`
|
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
|
|
||||||
You can declare a test step as failing, so that Playwright ensures it actually fails.
|
You can declare a test step as failing, so that Playwright ensures it actually fails.
|
||||||
|
|
|
||||||
13
packages/playwright/types/test.d.ts
vendored
13
packages/playwright/types/test.d.ts
vendored
|
|
@ -5714,9 +5714,6 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
||||||
/**
|
/**
|
||||||
* Mark a test step as "fixme", with the intention to fix it. Playwright will not run the step.
|
* Mark a test step as "fixme", with the intention to fix it. Playwright will not run the step.
|
||||||
*
|
*
|
||||||
* To declare a "fixme" step:
|
|
||||||
* - `test.step.fixme(title, body)`
|
|
||||||
*
|
|
||||||
* **Usage**
|
* **Usage**
|
||||||
*
|
*
|
||||||
* You can declare a test step as failing, so that Playwright ensures it actually fails.
|
* You can declare a test step as failing, so that Playwright ensures it actually fails.
|
||||||
|
|
@ -5736,13 +5733,13 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
||||||
* @param body Step body.
|
* @param body Step body.
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
fixme(title: string, body: () => void | Promise<void>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
fixme(title: string, body: () => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Marks a test step as "should fail". Playwright runs this test step and ensures that it actually fails. This is
|
* Marks a test step as "should fail". Playwright runs this test step and ensures that it actually fails. This is
|
||||||
* useful for documentation purposes to acknowledge that some functionality is broken until it is fixed.
|
* useful for documentation purposes to acknowledge that some functionality is broken until it is fixed.
|
||||||
*
|
*
|
||||||
* To declare a "failing" step:
|
* **NOTE** If the step exceeds the timeout, a [TimeoutError](https://playwright.dev/docs/api/class-timeouterror) is
|
||||||
* - `test.step.fail(title, body)`
|
* thrown. This indicates the step did not fail as expected.
|
||||||
*
|
*
|
||||||
* **Usage**
|
* **Usage**
|
||||||
*
|
*
|
||||||
|
|
@ -5753,7 +5750,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
||||||
*
|
*
|
||||||
* test('my test', async ({ page }) => {
|
* test('my test', async ({ page }) => {
|
||||||
* // ...
|
* // ...
|
||||||
* await test.step.fail('not yet ready', async () => {
|
* await test.step.fail('currently failing', async () => {
|
||||||
* // ...
|
* // ...
|
||||||
* });
|
* });
|
||||||
* });
|
* });
|
||||||
|
|
@ -5763,7 +5760,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
||||||
* @param body Step body.
|
* @param body Step body.
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
fail(title: string, body: () => void | Promise<void>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
fail(title: string, body: () => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* `expect` function can be used to create test assertions. Read more about [test assertions](https://playwright.dev/docs/test-assertions).
|
* `expect` function can be used to create test assertions. Read more about [test assertions](https://playwright.dev/docs/test-assertions).
|
||||||
|
|
|
||||||
|
|
@ -1519,7 +1519,7 @@ test('test.step.fail and test.step.fixme should work', async ({ runInlineTest })
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { reporter: '', workers: 1, timeout: 3000 });
|
}, { reporter: '' });
|
||||||
|
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
expect(result.report.stats.expected).toBe(1);
|
expect(result.report.stats.expected).toBe(1);
|
||||||
|
|
@ -1553,7 +1553,7 @@ test('timeout inside test.step.fail is an error', async ({ runInlineTest }) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { reporter: '', workers: 2, timeout: 1000 });
|
}, { reporter: '', timeout: 2500 });
|
||||||
|
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
expect(result.report.stats.unexpected).toBe(1);
|
expect(result.report.stats.unexpected).toBe(1);
|
||||||
|
|
@ -1563,7 +1563,7 @@ test.step |outer step 2 @ a.test.ts:4
|
||||||
test.step | inner step 2 @ a.test.ts:5
|
test.step | inner step 2 @ a.test.ts:5
|
||||||
hook |After Hooks
|
hook |After Hooks
|
||||||
hook |Worker Cleanup
|
hook |Worker Cleanup
|
||||||
|Test timeout of 1000ms exceeded.
|
|Test timeout of 2500ms exceeded.
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1583,7 +1583,7 @@ test('skip test.step.fixme body', async ({ runInlineTest }) => {
|
||||||
expect(didRun).toBe(false);
|
expect(didRun).toBe(false);
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
}, { reporter: '', workers: 1, timeout: 1000 });
|
}, { reporter: '' });
|
||||||
|
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
expect(result.report.stats.expected).toBe(1);
|
expect(result.report.stats.expected).toBe(1);
|
||||||
|
|
|
||||||
|
|
@ -212,20 +212,16 @@ test('step.fail and step.fixme return void ', async ({ runTSC }) => {
|
||||||
test('test step.fail', async ({ }) => {
|
test('test step.fail', async ({ }) => {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const bad1: string = await test.step.fail('my step', () => { });
|
const bad1: string = await test.step.fail('my step', () => { });
|
||||||
// @ts-expect-error
|
const good: void = await test.step.fail('my step', async () => {
|
||||||
const bad2: void = await test.step.fail('my step', async () => {
|
return 2024;
|
||||||
return 10;
|
|
||||||
});
|
});
|
||||||
const good: void = await test.step.fail('my step', async () => { });
|
|
||||||
});
|
});
|
||||||
test('test step.fixme', async ({ }) => {
|
test('test step.fixme', async ({ }) => {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const bad1: string = await test.step.fixme('my step', () => { });
|
const bad1: string = await test.step.fixme('my step', () => { });
|
||||||
// @ts-expect-error
|
const good: void = await test.step.fixme('my step', async () => {
|
||||||
const bad2: void = await test.step.fixme('my step', async () => {
|
return 2024;
|
||||||
return 10;
|
|
||||||
});
|
});
|
||||||
const good: void = await test.step.fixme('my step', async () => { });
|
|
||||||
});
|
});
|
||||||
`
|
`
|
||||||
});
|
});
|
||||||
|
|
|
||||||
4
utils/generate_types/overrides-test.d.ts
vendored
4
utils/generate_types/overrides-test.d.ts
vendored
|
|
@ -164,8 +164,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
||||||
use(fixtures: Fixtures<{}, {}, TestArgs, WorkerArgs>): void;
|
use(fixtures: Fixtures<{}, {}, TestArgs, WorkerArgs>): void;
|
||||||
step: {
|
step: {
|
||||||
<T>(title: string, body: () => T | Promise<T>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<T>;
|
<T>(title: string, body: () => T | Promise<T>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<T>;
|
||||||
fixme(title: string, body: () => void | Promise<void>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
fixme(title: string, body: () => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
||||||
fail(title: string, body: () => void | Promise<void>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
fail(title: string, body: () => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
||||||
}
|
}
|
||||||
expect: Expect<{}>;
|
expect: Expect<{}>;
|
||||||
extend<T extends {}, W extends {} = {}>(fixtures: Fixtures<T, W, TestArgs, WorkerArgs>): TestType<TestArgs & T, WorkerArgs & W>;
|
extend<T extends {}, W extends {} = {}>(fixtures: Fixtures<T, W, TestArgs, WorkerArgs>): TestType<TestArgs & T, WorkerArgs & W>;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue