@smoothdeploy/playwright 1.62.1 → 1.63.0-beta-1791031101000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/testActions.js +1 -0
- package/lib/common/index.js +44 -75
- package/lib/common/index.js.txt +10 -10
- package/lib/index.js +36 -25
- package/lib/matchers/expect.js +50 -44
- package/lib/matchers/expect.js.txt +3 -3
- package/lib/mcp/test/browserBackend.js +12 -2
- package/lib/program.js +2 -3
- package/lib/runner/index.js +767 -321
- package/lib/runner/index.js.txt +23 -21
- package/lib/transform/babelBundle.js +4 -5
- package/lib/transform/babelBundle.js.txt +2 -2
- package/lib/transform/esmLoader.js +9 -30
- package/lib/transform/esmLoader.js.txt +3 -3
- package/lib/worker/workerProcessEntry.js +26 -13
- package/lib/worker/workerProcessEntry.js.txt +3 -3
- package/package.json +2 -5
- package/types/test.d.ts +237 -11
- package/types/testReporter.d.ts +52 -1
package/types/test.d.ts
CHANGED
|
@@ -19,9 +19,13 @@ import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions,
|
|
|
19
19
|
export * from 'playwright-core';
|
|
20
20
|
|
|
21
21
|
export type BlobReporterOptions = { outputDir?: string, fileName?: string };
|
|
22
|
-
export type
|
|
23
|
-
export type
|
|
22
|
+
export type DotReporterOptions = { omitTags?: boolean };
|
|
23
|
+
export type LineReporterOptions = { omitTags?: boolean };
|
|
24
|
+
export type ListReporterOptions = { printSteps?: boolean, printFailuresInline?: boolean, omitTags?: boolean };
|
|
25
|
+
export type GitHubReporterOptions = { omitTags?: boolean };
|
|
26
|
+
export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean, includeRetries?: boolean, omitTags?: boolean };
|
|
24
27
|
export type JsonReporterOptions = { outputFile?: string };
|
|
28
|
+
export type PerfettoReporterOptions = { outputFile?: string };
|
|
25
29
|
export type HtmlReporterOptions = {
|
|
26
30
|
outputFolder?: string;
|
|
27
31
|
open?: 'always' | 'never' | 'on-failure';
|
|
@@ -37,12 +41,13 @@ export type HtmlReporterOptions = {
|
|
|
37
41
|
|
|
38
42
|
export type ReporterDescription = Readonly<
|
|
39
43
|
['blob'] | ['blob', BlobReporterOptions] |
|
|
40
|
-
['dot'] |
|
|
41
|
-
['line'] |
|
|
44
|
+
['dot'] | ['dot', DotReporterOptions] |
|
|
45
|
+
['line'] | ['line', LineReporterOptions] |
|
|
42
46
|
['list'] | ['list', ListReporterOptions] |
|
|
43
|
-
['github'] |
|
|
47
|
+
['github'] | ['github', GitHubReporterOptions] |
|
|
44
48
|
['junit'] | ['junit', JUnitReporterOptions] |
|
|
45
49
|
['json'] | ['json', JsonReporterOptions] |
|
|
50
|
+
['perfetto'] | ['perfetto', PerfettoReporterOptions] |
|
|
46
51
|
['html'] | ['html', HtmlReporterOptions] |
|
|
47
52
|
['null'] |
|
|
48
53
|
[string] | [string, any]
|
|
@@ -914,7 +919,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
914
919
|
* ```
|
|
915
920
|
*
|
|
916
921
|
*/
|
|
917
|
-
reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html', string> | ReporterDescription[];
|
|
922
|
+
reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html'|'perfetto', string> | ReporterDescription[];
|
|
918
923
|
/**
|
|
919
924
|
* Global options for all tests, for example
|
|
920
925
|
* [testOptions.browserName](https://playwright.dev/docs/api/class-testoptions#test-options-browser-name). Learn more
|
|
@@ -2719,6 +2724,7 @@ export type TestAnnotation = TestDetailsAnnotation & {
|
|
|
2719
2724
|
export type TestDetails = {
|
|
2720
2725
|
tag?: string | string[];
|
|
2721
2726
|
annotation?: TestDetailsAnnotation | TestDetailsAnnotation[];
|
|
2727
|
+
lock?: string | string[];
|
|
2722
2728
|
}
|
|
2723
2729
|
|
|
2724
2730
|
type TestBody<TestArgs> = (args: TestArgs, testInfo: TestInfo) => Promise<unknown> | unknown;
|
|
@@ -2810,6 +2816,26 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
2810
2816
|
* [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
|
|
2811
2817
|
*
|
|
2812
2818
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
2819
|
+
*
|
|
2820
|
+
* **Locks**
|
|
2821
|
+
*
|
|
2822
|
+
* You can declare named locks to prevent specific tests from running at the same time, while all other tests continue
|
|
2823
|
+
* to run in parallel. Tests that share a lock name never run concurrently, even when they are declared in different
|
|
2824
|
+
* files or belong to different [projects](https://playwright.dev/docs/test-projects). This is useful when a few tests access a shared
|
|
2825
|
+
* resource that does not support concurrent access.
|
|
2826
|
+
*
|
|
2827
|
+
* ```js
|
|
2828
|
+
* import { test, expect } from '@playwright/test';
|
|
2829
|
+
*
|
|
2830
|
+
* test('update user settings', {
|
|
2831
|
+
* lock: 'user-settings',
|
|
2832
|
+
* }, async ({ page }) => {
|
|
2833
|
+
* // This test never runs concurrently with other tests
|
|
2834
|
+
* // that declare the 'user-settings' lock.
|
|
2835
|
+
* });
|
|
2836
|
+
* ```
|
|
2837
|
+
*
|
|
2838
|
+
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
2813
2839
|
* @param title Test title.
|
|
2814
2840
|
* @param details Additional test details.
|
|
2815
2841
|
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
@@ -2887,6 +2913,26 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
2887
2913
|
* [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
|
|
2888
2914
|
*
|
|
2889
2915
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
2916
|
+
*
|
|
2917
|
+
* **Locks**
|
|
2918
|
+
*
|
|
2919
|
+
* You can declare named locks to prevent specific tests from running at the same time, while all other tests continue
|
|
2920
|
+
* to run in parallel. Tests that share a lock name never run concurrently, even when they are declared in different
|
|
2921
|
+
* files or belong to different [projects](https://playwright.dev/docs/test-projects). This is useful when a few tests access a shared
|
|
2922
|
+
* resource that does not support concurrent access.
|
|
2923
|
+
*
|
|
2924
|
+
* ```js
|
|
2925
|
+
* import { test, expect } from '@playwright/test';
|
|
2926
|
+
*
|
|
2927
|
+
* test('update user settings', {
|
|
2928
|
+
* lock: 'user-settings',
|
|
2929
|
+
* }, async ({ page }) => {
|
|
2930
|
+
* // This test never runs concurrently with other tests
|
|
2931
|
+
* // that declare the 'user-settings' lock.
|
|
2932
|
+
* });
|
|
2933
|
+
* ```
|
|
2934
|
+
*
|
|
2935
|
+
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
2890
2936
|
* @param title Test title.
|
|
2891
2937
|
* @param details Additional test details.
|
|
2892
2938
|
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
@@ -3023,6 +3069,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3023
3069
|
* ```
|
|
3024
3070
|
*
|
|
3025
3071
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3072
|
+
*
|
|
3073
|
+
* **Locks**
|
|
3074
|
+
*
|
|
3075
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3076
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3077
|
+
*
|
|
3078
|
+
* ```js
|
|
3079
|
+
* import { test, expect } from '@playwright/test';
|
|
3080
|
+
*
|
|
3081
|
+
* test.describe('two tests with a lock', {
|
|
3082
|
+
* lock: 'user-settings',
|
|
3083
|
+
* }, () => {
|
|
3084
|
+
* test('one', async ({ page }) => {
|
|
3085
|
+
* // ...
|
|
3086
|
+
* });
|
|
3087
|
+
*
|
|
3088
|
+
* test('two', async ({ page }) => {
|
|
3089
|
+
* // ...
|
|
3090
|
+
* });
|
|
3091
|
+
* });
|
|
3092
|
+
* ```
|
|
3093
|
+
*
|
|
3026
3094
|
* @param title Group title.
|
|
3027
3095
|
* @param details Additional details for all tests in the group.
|
|
3028
3096
|
* @param callback A callback that is run immediately when calling
|
|
@@ -3118,6 +3186,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3118
3186
|
* ```
|
|
3119
3187
|
*
|
|
3120
3188
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3189
|
+
*
|
|
3190
|
+
* **Locks**
|
|
3191
|
+
*
|
|
3192
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3193
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3194
|
+
*
|
|
3195
|
+
* ```js
|
|
3196
|
+
* import { test, expect } from '@playwright/test';
|
|
3197
|
+
*
|
|
3198
|
+
* test.describe('two tests with a lock', {
|
|
3199
|
+
* lock: 'user-settings',
|
|
3200
|
+
* }, () => {
|
|
3201
|
+
* test('one', async ({ page }) => {
|
|
3202
|
+
* // ...
|
|
3203
|
+
* });
|
|
3204
|
+
*
|
|
3205
|
+
* test('two', async ({ page }) => {
|
|
3206
|
+
* // ...
|
|
3207
|
+
* });
|
|
3208
|
+
* });
|
|
3209
|
+
* ```
|
|
3210
|
+
*
|
|
3121
3211
|
* @param title Group title.
|
|
3122
3212
|
* @param details Additional details for all tests in the group.
|
|
3123
3213
|
* @param callback A callback that is run immediately when calling
|
|
@@ -3213,6 +3303,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3213
3303
|
* ```
|
|
3214
3304
|
*
|
|
3215
3305
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3306
|
+
*
|
|
3307
|
+
* **Locks**
|
|
3308
|
+
*
|
|
3309
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3310
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3311
|
+
*
|
|
3312
|
+
* ```js
|
|
3313
|
+
* import { test, expect } from '@playwright/test';
|
|
3314
|
+
*
|
|
3315
|
+
* test.describe('two tests with a lock', {
|
|
3316
|
+
* lock: 'user-settings',
|
|
3317
|
+
* }, () => {
|
|
3318
|
+
* test('one', async ({ page }) => {
|
|
3319
|
+
* // ...
|
|
3320
|
+
* });
|
|
3321
|
+
*
|
|
3322
|
+
* test('two', async ({ page }) => {
|
|
3323
|
+
* // ...
|
|
3324
|
+
* });
|
|
3325
|
+
* });
|
|
3326
|
+
* ```
|
|
3327
|
+
*
|
|
3216
3328
|
* @param title Group title.
|
|
3217
3329
|
* @param details Additional details for all tests in the group.
|
|
3218
3330
|
* @param callback A callback that is run immediately when calling
|
|
@@ -3308,6 +3420,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3308
3420
|
* ```
|
|
3309
3421
|
*
|
|
3310
3422
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3423
|
+
*
|
|
3424
|
+
* **Locks**
|
|
3425
|
+
*
|
|
3426
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3427
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3428
|
+
*
|
|
3429
|
+
* ```js
|
|
3430
|
+
* import { test, expect } from '@playwright/test';
|
|
3431
|
+
*
|
|
3432
|
+
* test.describe('two tests with a lock', {
|
|
3433
|
+
* lock: 'user-settings',
|
|
3434
|
+
* }, () => {
|
|
3435
|
+
* test('one', async ({ page }) => {
|
|
3436
|
+
* // ...
|
|
3437
|
+
* });
|
|
3438
|
+
*
|
|
3439
|
+
* test('two', async ({ page }) => {
|
|
3440
|
+
* // ...
|
|
3441
|
+
* });
|
|
3442
|
+
* });
|
|
3443
|
+
* ```
|
|
3444
|
+
*
|
|
3311
3445
|
* @param title Group title.
|
|
3312
3446
|
* @param details Additional details for all tests in the group.
|
|
3313
3447
|
* @param callback A callback that is run immediately when calling
|
|
@@ -6593,7 +6727,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
6593
6727
|
* @param body Step body.
|
|
6594
6728
|
* @param options
|
|
6595
6729
|
*/
|
|
6596
|
-
<T>(title: string, body: (step: TestStepInfo) => T | Promise<T>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<T>;
|
|
6730
|
+
<T>(title: string, body: (step: TestStepInfo) => T | Promise<T>, options?: { box?: boolean, location?: Location, timeout?: number, params?: { [key: string]: any }, subtitle?: string }): Promise<T>;
|
|
6597
6731
|
/**
|
|
6598
6732
|
* Mark a test step as "skip" to temporarily disable its execution, useful for steps that are currently failing and
|
|
6599
6733
|
* planned for a near-term fix. Playwright will not run the step. See also
|
|
@@ -6621,7 +6755,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
6621
6755
|
* @param body Step body.
|
|
6622
6756
|
* @param options
|
|
6623
6757
|
*/
|
|
6624
|
-
skip(title: string, body: (step: TestStepInfo) => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
|
6758
|
+
skip(title: string, body: (step: TestStepInfo) => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number, params?: { [key: string]: any }, subtitle?: string }): Promise<void>;
|
|
6625
6759
|
}
|
|
6626
6760
|
/**
|
|
6627
6761
|
* `expect` function can be used to create test assertions. Read more about [test assertions](https://playwright.dev/docs/test-assertions).
|
|
@@ -6741,6 +6875,9 @@ export type Fixtures<T extends {} = {}, W extends {} = {}, PT extends {} = {}, P
|
|
|
6741
6875
|
type BrowserName = 'chromium' | 'firefox' | 'webkit';
|
|
6742
6876
|
type BrowserChannel = Exclude<LaunchOptions['channel'], undefined>;
|
|
6743
6877
|
type ColorScheme = Exclude<BrowserContextOptions['colorScheme'], undefined>;
|
|
6878
|
+
type Contrast = Exclude<BrowserContextOptions['contrast'], undefined>;
|
|
6879
|
+
type ForcedColors = Exclude<BrowserContextOptions['forcedColors'], undefined>;
|
|
6880
|
+
type ReducedMotion = Exclude<BrowserContextOptions['reducedMotion'], undefined>;
|
|
6744
6881
|
type ClientCertificate = Exclude<BrowserContextOptions['clientCertificates'], undefined>[0];
|
|
6745
6882
|
type ExtraHTTPHeaders = Exclude<BrowserContextOptions['extraHTTPHeaders'], undefined>;
|
|
6746
6883
|
type Proxy = Exclude<BrowserContextOptions['proxy'], undefined>;
|
|
@@ -7079,7 +7216,7 @@ export interface PlaywrightWorkerOptions {
|
|
|
7079
7216
|
*
|
|
7080
7217
|
* Learn more about [recording trace](https://playwright.dev/docs/test-use-options#recording-options).
|
|
7081
7218
|
*/
|
|
7082
|
-
trace: TraceMode | /** deprecated */ 'retry-with-trace' | { mode: TraceMode, snapshots?: boolean, screenshots?: boolean, sources?: boolean, attachments?: boolean };
|
|
7219
|
+
trace: TraceMode | /** deprecated */ 'retry-with-trace' | { mode: TraceMode, snapshots?: boolean | { dom?: boolean, aria?: boolean, screen?: boolean }, screenshots?: boolean, sources?: boolean, attachments?: boolean };
|
|
7083
7220
|
/**
|
|
7084
7221
|
* Whether to record video for each test. Defaults to `'off'`. The initial run of a test is the "first run";
|
|
7085
7222
|
* subsequent runs caused by [retries](https://playwright.dev/docs/test-retries) are "retries".
|
|
@@ -7223,6 +7360,26 @@ export interface PlaywrightTestOptions {
|
|
|
7223
7360
|
*
|
|
7224
7361
|
*/
|
|
7225
7362
|
colorScheme: ColorScheme;
|
|
7363
|
+
/**
|
|
7364
|
+
* Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
|
|
7365
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
7366
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
|
|
7367
|
+
*
|
|
7368
|
+
* **Usage**
|
|
7369
|
+
*
|
|
7370
|
+
* ```js
|
|
7371
|
+
* // playwright.config.ts
|
|
7372
|
+
* import { defineConfig } from '@playwright/test';
|
|
7373
|
+
*
|
|
7374
|
+
* export default defineConfig({
|
|
7375
|
+
* use: {
|
|
7376
|
+
* contrast: 'more',
|
|
7377
|
+
* },
|
|
7378
|
+
* });
|
|
7379
|
+
* ```
|
|
7380
|
+
*
|
|
7381
|
+
*/
|
|
7382
|
+
contrast: Contrast;
|
|
7226
7383
|
/**
|
|
7227
7384
|
* TLS Client Authentication allows the server to request a client certificate and verify it.
|
|
7228
7385
|
*
|
|
@@ -7300,6 +7457,26 @@ export interface PlaywrightTestOptions {
|
|
|
7300
7457
|
*
|
|
7301
7458
|
*/
|
|
7302
7459
|
extraHTTPHeaders: ExtraHTTPHeaders | undefined;
|
|
7460
|
+
/**
|
|
7461
|
+
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
|
7462
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
7463
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'none'`.
|
|
7464
|
+
*
|
|
7465
|
+
* **Usage**
|
|
7466
|
+
*
|
|
7467
|
+
* ```js
|
|
7468
|
+
* // playwright.config.ts
|
|
7469
|
+
* import { defineConfig } from '@playwright/test';
|
|
7470
|
+
*
|
|
7471
|
+
* export default defineConfig({
|
|
7472
|
+
* use: {
|
|
7473
|
+
* forcedColors: 'active',
|
|
7474
|
+
* },
|
|
7475
|
+
* });
|
|
7476
|
+
* ```
|
|
7477
|
+
*
|
|
7478
|
+
*/
|
|
7479
|
+
forcedColors: ForcedColors;
|
|
7303
7480
|
/**
|
|
7304
7481
|
* **Usage**
|
|
7305
7482
|
*
|
|
@@ -7340,6 +7517,9 @@ export interface PlaywrightTestOptions {
|
|
|
7340
7517
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
|
7341
7518
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
|
7342
7519
|
*
|
|
7520
|
+
* Pass an array to use different credentials for different origins. The first entry that matches the request origin
|
|
7521
|
+
* is used, and entries with no origin match any request.
|
|
7522
|
+
*
|
|
7343
7523
|
* **Usage**
|
|
7344
7524
|
*
|
|
7345
7525
|
* ```js
|
|
@@ -7357,7 +7537,7 @@ export interface PlaywrightTestOptions {
|
|
|
7357
7537
|
* ```
|
|
7358
7538
|
*
|
|
7359
7539
|
*/
|
|
7360
|
-
httpCredentials: HTTPCredentials | undefined;
|
|
7540
|
+
httpCredentials: HTTPCredentials | HTTPCredentials[] | undefined;
|
|
7361
7541
|
/**
|
|
7362
7542
|
* Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.
|
|
7363
7543
|
*
|
|
@@ -7495,6 +7675,26 @@ export interface PlaywrightTestOptions {
|
|
|
7495
7675
|
*
|
|
7496
7676
|
*/
|
|
7497
7677
|
proxy: Proxy | undefined;
|
|
7678
|
+
/**
|
|
7679
|
+
* Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See
|
|
7680
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
7681
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
|
|
7682
|
+
*
|
|
7683
|
+
* **Usage**
|
|
7684
|
+
*
|
|
7685
|
+
* ```js
|
|
7686
|
+
* // playwright.config.ts
|
|
7687
|
+
* import { defineConfig } from '@playwright/test';
|
|
7688
|
+
*
|
|
7689
|
+
* export default defineConfig({
|
|
7690
|
+
* use: {
|
|
7691
|
+
* reducedMotion: 'reduce',
|
|
7692
|
+
* },
|
|
7693
|
+
* });
|
|
7694
|
+
* ```
|
|
7695
|
+
*
|
|
7696
|
+
*/
|
|
7697
|
+
reducedMotion: ReducedMotion;
|
|
7498
7698
|
/**
|
|
7499
7699
|
* Learn more about [storage state and auth](https://playwright.dev/docs/auth).
|
|
7500
7700
|
*
|
|
@@ -7797,11 +7997,17 @@ export interface PlaywrightWorkerArgs {
|
|
|
7797
7997
|
browser: Browser;
|
|
7798
7998
|
}
|
|
7799
7999
|
|
|
8000
|
+
export interface Stories {}
|
|
8001
|
+
|
|
7800
8002
|
type StoryProps<Story> =
|
|
7801
8003
|
Story extends (props: infer Props) => any ? Props :
|
|
7802
8004
|
Story extends new (...args: any[]) => { $props: infer Props } ? Props :
|
|
7803
8005
|
Story extends new (props: infer Props, ...args: any[]) => any ? Props :
|
|
7804
8006
|
Story;
|
|
8007
|
+
type StoryId = keyof Stories | (string & {});
|
|
8008
|
+
type StoryPropsFor<Id> = Id extends keyof Stories ? StoryProps<Stories[Id]> : Record<string, any>;
|
|
8009
|
+
// Explicit mount<typeof Story>() wins over the id lookup; the indexed access keeps Story from being inferred from props.
|
|
8010
|
+
type MountProps<Story, Id> = [Story] extends [never] ? StoryPropsFor<Id> : StoryProps<[Story][Story extends any ? 0 : never]>;
|
|
7805
8011
|
|
|
7806
8012
|
/**
|
|
7807
8013
|
* Playwright Test is based on the concept of the [test fixtures](https://playwright.dev/docs/test-fixtures). Test fixtures are used to
|
|
@@ -7935,7 +8141,7 @@ export interface PlaywrightTestArgs {
|
|
|
7935
8141
|
* exported story name, for example `'components/Button/Primary'`.
|
|
7936
8142
|
* @param props Optional plain, serializable props passed to the story.
|
|
7937
8143
|
*/
|
|
7938
|
-
mount: <Story =
|
|
8144
|
+
mount: <Story = never, Id extends StoryId = StoryId>(storyId: Id, props?: MountProps<Story, Id>) => Promise<Locator & { update(props?: MountProps<Story, Id>): Promise<void>, unmount(): Promise<void> }>;
|
|
7939
8145
|
}
|
|
7940
8146
|
|
|
7941
8147
|
type ExcludeProps<A, B> = {
|
|
@@ -10613,6 +10819,26 @@ export interface TestStepInfo {
|
|
|
10613
10819
|
*/
|
|
10614
10820
|
skip(condition: boolean, description?: string): void;
|
|
10615
10821
|
|
|
10822
|
+
/**
|
|
10823
|
+
* The list of annotations applicable to the current test step.
|
|
10824
|
+
*/
|
|
10825
|
+
annotations: Array<{
|
|
10826
|
+
/**
|
|
10827
|
+
* Annotation type, for example `'skip'`.
|
|
10828
|
+
*/
|
|
10829
|
+
type: string;
|
|
10830
|
+
|
|
10831
|
+
/**
|
|
10832
|
+
* Optional description.
|
|
10833
|
+
*/
|
|
10834
|
+
description?: string;
|
|
10835
|
+
|
|
10836
|
+
/**
|
|
10837
|
+
* Optional location in the source where the annotation is added.
|
|
10838
|
+
*/
|
|
10839
|
+
location?: Location;
|
|
10840
|
+
}>;
|
|
10841
|
+
|
|
10616
10842
|
/**
|
|
10617
10843
|
* The full title path starting with the test file name, including the step titles. See also
|
|
10618
10844
|
* [testInfo.titlePath](https://playwright.dev/docs/api/class-testinfo#test-info-title-path).
|
package/types/testReporter.d.ts
CHANGED
|
@@ -351,6 +351,7 @@ export interface JSONReportTestResult {
|
|
|
351
351
|
|
|
352
352
|
export interface JSONReportTestStep {
|
|
353
353
|
title: string;
|
|
354
|
+
subtitle?: string;
|
|
354
355
|
duration: number;
|
|
355
356
|
error: TestError | undefined;
|
|
356
357
|
steps?: JSONReportTestStep[];
|
|
@@ -875,6 +876,34 @@ export interface TestStep {
|
|
|
875
876
|
*/
|
|
876
877
|
location?: Location;
|
|
877
878
|
|
|
879
|
+
/**
|
|
880
|
+
* Step-dependent parameters, when available. For example, steps produced by the Playwright API calls contain the
|
|
881
|
+
* target `locator` and the call arguments such as `url`, while
|
|
882
|
+
* [test.step(title, body[, options])](https://playwright.dev/docs/api/class-test#test-step) steps contain the
|
|
883
|
+
* parameters passed by the test author.
|
|
884
|
+
*
|
|
885
|
+
* ```js
|
|
886
|
+
* // { locator: 'getByRole(\'button\')' }
|
|
887
|
+
* await page.getByRole('button').click();
|
|
888
|
+
*
|
|
889
|
+
* // { url: 'https://example.com' }
|
|
890
|
+
* await page.goto('https://example.com');
|
|
891
|
+
*
|
|
892
|
+
* // { locator: 'getByLabel(\'Password\')', value: 'secret' }
|
|
893
|
+
* await page.getByLabel('Password').fill('secret');
|
|
894
|
+
*
|
|
895
|
+
* // { orderId: 42 }
|
|
896
|
+
* await test.step('checkout', async () => {
|
|
897
|
+
* // ...
|
|
898
|
+
* }, { params: { orderId: 42 } });
|
|
899
|
+
* ```
|
|
900
|
+
*
|
|
901
|
+
* To keep the reports small, Playwright API calls only report a curated set of arguments per call, and long string
|
|
902
|
+
* values are truncated. Unbounded arguments such as the page content, evaluated expressions or request bodies are
|
|
903
|
+
* never reported.
|
|
904
|
+
*/
|
|
905
|
+
params?: { [key: string]: any; };
|
|
906
|
+
|
|
878
907
|
/**
|
|
879
908
|
* Parent step, if any.
|
|
880
909
|
*/
|
|
@@ -891,7 +920,29 @@ export interface TestStep {
|
|
|
891
920
|
steps: Array<TestStep>;
|
|
892
921
|
|
|
893
922
|
/**
|
|
894
|
-
* User-friendly test step title.
|
|
923
|
+
* User-friendly test step subtitle that complements the title, when available. For Playwright API calls, it is the
|
|
924
|
+
* target locator or the navigation url. For example, a `Click` step has the clicked locator as a subtitle.
|
|
925
|
+
* [test.step(title, body[, options])](https://playwright.dev/docs/api/class-test#test-step) steps carry the subtitle
|
|
926
|
+
* passed by the test author. User interfaces typically render the subtitle next to the title or on a separate line.
|
|
927
|
+
*
|
|
928
|
+
* ```js
|
|
929
|
+
* // title `Click`, subtitle `getByRole('button')`
|
|
930
|
+
* await page.getByRole('button').click();
|
|
931
|
+
*
|
|
932
|
+
* // title `Navigate`, subtitle `example.com/index.html`
|
|
933
|
+
* await page.goto('https://example.com/index.html');
|
|
934
|
+
*
|
|
935
|
+
* // title `Add to cart`, subtitle `SKU 42`
|
|
936
|
+
* await test.step('Add to cart', async () => {
|
|
937
|
+
* // ...
|
|
938
|
+
* }, { subtitle: 'SKU 42' });
|
|
939
|
+
* ```
|
|
940
|
+
*
|
|
941
|
+
*/
|
|
942
|
+
subtitle?: string;
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* User-friendly test step title, for example `Click` or `Navigate`.
|
|
895
946
|
*/
|
|
896
947
|
title: string;
|
|
897
948
|
}
|