@playwright/test 1.35.0-alpha-jun-5-2023 → 1.35.0-alpha-jun-7-2023
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/.eslintrc.js +13 -1
- package/ThirdPartyNotices.txt +1 -61
- package/lib/cli.js +5 -2
- package/lib/common/process.js +1 -1
- package/lib/index.js +2 -2
- package/lib/matchers/toMatchSnapshot.js +6 -0
- package/lib/reporters/github.js +1 -1
- package/lib/reporters/html.js +4 -11
- package/lib/reporters/internalReporter.js +6 -1
- package/lib/reporters/merge.js +6 -2
- package/lib/runner/dispatcher.js +5 -5
- package/lib/runner/runner.js +2 -2
- package/lib/runner/uiMode.js +55 -68
- package/lib/util.js +19 -2
- package/lib/utilsBundle.js +1 -3
- package/lib/utilsBundleImpl.js +36 -36
- package/lib/worker/testInfo.js +1 -1
- package/lib/worker/workerMain.js +3 -3
- package/package.json +2 -2
- package/types/test.d.ts +119 -89
- package/types/testReporter.d.ts +16 -14
package/types/test.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ type UseOptions<TestArgs, WorkerArgs> = { [K in keyof WorkerArgs]?: WorkerArgs[K
|
|
|
37
37
|
*
|
|
38
38
|
* `TestProject` encapsulates configuration specific to a single project. Projects are configured in
|
|
39
39
|
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects) specified in the
|
|
40
|
-
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of
|
|
41
|
-
* top-level
|
|
40
|
+
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of {@link TestProject} are available in
|
|
41
|
+
* the top-level {@link TestConfig}, in which case they are shared between all projects.
|
|
42
42
|
*
|
|
43
43
|
* Here is an example configuration that runs every test in Chromium, Firefox and WebKit, both Desktop and Mobile
|
|
44
44
|
* versions.
|
|
@@ -85,7 +85,7 @@ export interface Project<TestArgs = {}, WorkerArgs = {}> extends TestProject {
|
|
|
85
85
|
/**
|
|
86
86
|
* Options for all tests in this project, for example
|
|
87
87
|
* [testOptions.browserName](https://playwright.dev/docs/api/class-testoptions#test-options-browser-name). Learn more
|
|
88
|
-
* about [configuration](https://playwright.dev/docs/test-configuration) and see [available options]
|
|
88
|
+
* about [configuration](https://playwright.dev/docs/test-configuration) and see [available options]{@link TestOptions}.
|
|
89
89
|
*
|
|
90
90
|
* ```js
|
|
91
91
|
* // playwright.config.ts
|
|
@@ -115,8 +115,8 @@ export interface Project<TestArgs = {}, WorkerArgs = {}> extends TestProject {
|
|
|
115
115
|
*
|
|
116
116
|
* `TestProject` encapsulates configuration specific to a single project. Projects are configured in
|
|
117
117
|
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects) specified in the
|
|
118
|
-
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of
|
|
119
|
-
* top-level
|
|
118
|
+
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of {@link TestProject} are available in
|
|
119
|
+
* the top-level {@link TestConfig}, in which case they are shared between all projects.
|
|
120
120
|
*
|
|
121
121
|
* Here is an example configuration that runs every test in Chromium, Firefox and WebKit, both Desktop and Mobile
|
|
122
122
|
* versions.
|
|
@@ -418,7 +418,7 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
|
|
|
418
418
|
/**
|
|
419
419
|
* Options for all tests in this project, for example
|
|
420
420
|
* [testOptions.browserName](https://playwright.dev/docs/api/class-testoptions#test-options-browser-name). Learn more
|
|
421
|
-
* about [configuration](https://playwright.dev/docs/test-configuration) and see [available options]
|
|
421
|
+
* about [configuration](https://playwright.dev/docs/test-configuration) and see [available options]{@link TestOptions}.
|
|
422
422
|
*
|
|
423
423
|
* ```js
|
|
424
424
|
* // playwright.config.ts
|
|
@@ -446,12 +446,12 @@ type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });
|
|
|
446
446
|
|
|
447
447
|
/**
|
|
448
448
|
* Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout`
|
|
449
|
-
* or `testDir`. These options are described in the
|
|
449
|
+
* or `testDir`. These options are described in the {@link TestConfig} object in the
|
|
450
450
|
* [configuration file](https://playwright.dev/docs/test-configuration).
|
|
451
451
|
*
|
|
452
452
|
* Playwright Test supports running multiple test projects at the same time. Project-specific options should be put to
|
|
453
|
-
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects), but top-level
|
|
454
|
-
*
|
|
453
|
+
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects), but top-level {@link
|
|
454
|
+
* TestConfig} can also define base options shared between all projects.
|
|
455
455
|
*
|
|
456
456
|
* ```js
|
|
457
457
|
* // playwright.config.ts
|
|
@@ -570,7 +570,7 @@ interface TestConfig {
|
|
|
570
570
|
*/
|
|
571
571
|
webServer?: TestConfigWebServer | TestConfigWebServer[];
|
|
572
572
|
/**
|
|
573
|
-
*
|
|
573
|
+
* Playwright transpiler configuration.
|
|
574
574
|
*
|
|
575
575
|
* **Usage**
|
|
576
576
|
*
|
|
@@ -580,7 +580,7 @@ interface TestConfig {
|
|
|
580
580
|
*
|
|
581
581
|
* export default defineConfig({
|
|
582
582
|
* build: {
|
|
583
|
-
* external: '**\/*bundle.js',
|
|
583
|
+
* external: ['**\/*bundle.js'],
|
|
584
584
|
* },
|
|
585
585
|
* });
|
|
586
586
|
* ```
|
|
@@ -588,8 +588,8 @@ interface TestConfig {
|
|
|
588
588
|
*/
|
|
589
589
|
build?: {
|
|
590
590
|
/**
|
|
591
|
-
* Paths to exclude from the transpilation expressed as glob patterns. Typically heavy JS bundles your
|
|
592
|
-
*
|
|
591
|
+
* Paths to exclude from the transpilation expressed as a list of glob patterns. Typically heavy JS bundles that your
|
|
592
|
+
* test uses are listed here.
|
|
593
593
|
*/
|
|
594
594
|
external?: Array<string>;
|
|
595
595
|
};
|
|
@@ -965,7 +965,8 @@ interface TestConfig {
|
|
|
965
965
|
preserveOutput?: "always"|"never"|"failures-only";
|
|
966
966
|
|
|
967
967
|
/**
|
|
968
|
-
* Playwright Test supports running multiple test projects at the same time. See
|
|
968
|
+
* Playwright Test supports running multiple test projects at the same time. See {@link TestProject} for more
|
|
969
|
+
* information.
|
|
969
970
|
*
|
|
970
971
|
* **Usage**
|
|
971
972
|
*
|
|
@@ -1355,12 +1356,12 @@ interface TestConfig {
|
|
|
1355
1356
|
|
|
1356
1357
|
/**
|
|
1357
1358
|
* Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout`
|
|
1358
|
-
* or `testDir`. These options are described in the
|
|
1359
|
+
* or `testDir`. These options are described in the {@link TestConfig} object in the
|
|
1359
1360
|
* [configuration file](https://playwright.dev/docs/test-configuration).
|
|
1360
1361
|
*
|
|
1361
1362
|
* Playwright Test supports running multiple test projects at the same time. Project-specific options should be put to
|
|
1362
|
-
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects), but top-level
|
|
1363
|
-
*
|
|
1363
|
+
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects), but top-level {@link
|
|
1364
|
+
* TestConfig} can also define base options shared between all projects.
|
|
1364
1365
|
*
|
|
1365
1366
|
* ```js
|
|
1366
1367
|
* // playwright.config.ts
|
|
@@ -1377,7 +1378,8 @@ interface TestConfig {
|
|
|
1377
1378
|
*/
|
|
1378
1379
|
export interface Config<TestArgs = {}, WorkerArgs = {}> extends TestConfig {
|
|
1379
1380
|
/**
|
|
1380
|
-
* Playwright Test supports running multiple test projects at the same time. See
|
|
1381
|
+
* Playwright Test supports running multiple test projects at the same time. See {@link TestProject} for more
|
|
1382
|
+
* information.
|
|
1381
1383
|
*
|
|
1382
1384
|
* **Usage**
|
|
1383
1385
|
*
|
|
@@ -1397,7 +1399,7 @@ export interface Config<TestArgs = {}, WorkerArgs = {}> extends TestConfig {
|
|
|
1397
1399
|
/**
|
|
1398
1400
|
* Global options for all tests, for example
|
|
1399
1401
|
* [testOptions.browserName](https://playwright.dev/docs/api/class-testoptions#test-options-browser-name). Learn more
|
|
1400
|
-
* about [configuration](https://playwright.dev/docs/test-configuration) and see [available options]
|
|
1402
|
+
* about [configuration](https://playwright.dev/docs/test-configuration) and see [available options]{@link TestOptions}.
|
|
1401
1403
|
*
|
|
1402
1404
|
* **Usage**
|
|
1403
1405
|
*
|
|
@@ -1420,12 +1422,12 @@ export type Metadata = { [key: string]: any };
|
|
|
1420
1422
|
|
|
1421
1423
|
/**
|
|
1422
1424
|
* Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout`
|
|
1423
|
-
* or `testDir`. These options are described in the
|
|
1425
|
+
* or `testDir`. These options are described in the {@link TestConfig} object in the
|
|
1424
1426
|
* [configuration file](https://playwright.dev/docs/test-configuration).
|
|
1425
1427
|
*
|
|
1426
1428
|
* Playwright Test supports running multiple test projects at the same time. Project-specific options should be put to
|
|
1427
|
-
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects), but top-level
|
|
1428
|
-
*
|
|
1429
|
+
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects), but top-level {@link
|
|
1430
|
+
* TestConfig} can also define base options shared between all projects.
|
|
1429
1431
|
*
|
|
1430
1432
|
* ```js
|
|
1431
1433
|
* // playwright.config.ts
|
|
@@ -1633,7 +1635,8 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1633
1635
|
*/
|
|
1634
1636
|
preserveOutput: 'always' | 'never' | 'failures-only';
|
|
1635
1637
|
/**
|
|
1636
|
-
* Playwright Test supports running multiple test projects at the same time. See
|
|
1638
|
+
* Playwright Test supports running multiple test projects at the same time. See {@link TestProject} for more
|
|
1639
|
+
* information.
|
|
1637
1640
|
*
|
|
1638
1641
|
* **Usage**
|
|
1639
1642
|
*
|
|
@@ -1860,7 +1863,7 @@ export type TestStatus = 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interru
|
|
|
1860
1863
|
|
|
1861
1864
|
/**
|
|
1862
1865
|
* `WorkerInfo` contains information about the worker that is running tests and is available to worker-scoped
|
|
1863
|
-
* fixtures. `WorkerInfo` is a subset of
|
|
1866
|
+
* fixtures. `WorkerInfo` is a subset of {@link TestInfo} that is available in many other places.
|
|
1864
1867
|
*/
|
|
1865
1868
|
export interface WorkerInfo {
|
|
1866
1869
|
/**
|
|
@@ -2419,7 +2422,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
2419
2422
|
* ```
|
|
2420
2423
|
*
|
|
2421
2424
|
* @param title Test title.
|
|
2422
|
-
* @param testFunction Test function that takes one or two arguments: an object with fixtures and optional
|
|
2425
|
+
* @param testFunction Test function that takes one or two arguments: an object with fixtures and optional {@link TestInfo}.
|
|
2423
2426
|
*/
|
|
2424
2427
|
only: TestFunction<TestArgs & WorkerArgs>;
|
|
2425
2428
|
/**
|
|
@@ -2689,7 +2692,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
2689
2692
|
* ```
|
|
2690
2693
|
*
|
|
2691
2694
|
* @param title Test title.
|
|
2692
|
-
* @param testFunction Test function that takes one or two arguments: an object with fixtures and optional
|
|
2695
|
+
* @param testFunction Test function that takes one or two arguments: an object with fixtures and optional {@link TestInfo}.
|
|
2693
2696
|
*/
|
|
2694
2697
|
skip(title: string, testFunction: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
2695
2698
|
/**
|
|
@@ -2794,7 +2797,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
2794
2797
|
* ```
|
|
2795
2798
|
*
|
|
2796
2799
|
* @param title Test title.
|
|
2797
|
-
* @param testFunction Test function that takes one or two arguments: an object with fixtures and optional
|
|
2800
|
+
* @param testFunction Test function that takes one or two arguments: an object with fixtures and optional {@link TestInfo}.
|
|
2798
2801
|
*/
|
|
2799
2802
|
fixme(title: string, testFunction: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
2800
2803
|
/**
|
|
@@ -3061,8 +3064,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
3061
3064
|
* each test in the group. If multiple `beforeEach` hooks are added, they will run in the order of their
|
|
3062
3065
|
* registration.
|
|
3063
3066
|
*
|
|
3064
|
-
* You can access all the same
|
|
3065
|
-
* of useful information. For example, you can navigate the page before starting the test.
|
|
3067
|
+
* You can access all the same {@link Fixtures} as the test function itself, and also the {@link TestInfo} object that
|
|
3068
|
+
* gives a lot of useful information. For example, you can navigate the page before starting the test.
|
|
3066
3069
|
*
|
|
3067
3070
|
* You can use [test.afterEach(hookFunction)](https://playwright.dev/docs/api/class-test#test-after-each) to teardown
|
|
3068
3071
|
* any resources set up in `beforeEach`.
|
|
@@ -3083,7 +3086,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
3083
3086
|
* });
|
|
3084
3087
|
* ```
|
|
3085
3088
|
*
|
|
3086
|
-
* @param hookFunction Hook function that takes one or two arguments: an object with fixtures and optional
|
|
3089
|
+
* @param hookFunction Hook function that takes one or two arguments: an object with fixtures and optional {@link TestInfo}.
|
|
3087
3090
|
*/
|
|
3088
3091
|
beforeEach(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void;
|
|
3089
3092
|
/**
|
|
@@ -3095,8 +3098,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
3095
3098
|
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1) group, runs after each
|
|
3096
3099
|
* test in the group. If multiple `afterEach` hooks are added, they will run in the order of their registration.
|
|
3097
3100
|
*
|
|
3098
|
-
* You can access all the same
|
|
3099
|
-
* of useful information. For example, you can check whether the test succeeded or failed.
|
|
3101
|
+
* You can access all the same {@link Fixtures} as the test function itself, and also the {@link TestInfo} object that
|
|
3102
|
+
* gives a lot of useful information. For example, you can check whether the test succeeded or failed.
|
|
3100
3103
|
*
|
|
3101
3104
|
* **Usage**
|
|
3102
3105
|
*
|
|
@@ -3116,7 +3119,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
3116
3119
|
* });
|
|
3117
3120
|
* ```
|
|
3118
3121
|
*
|
|
3119
|
-
* @param hookFunction Hook function that takes one or two arguments: an object with fixtures and optional
|
|
3122
|
+
* @param hookFunction Hook function that takes one or two arguments: an object with fixtures and optional {@link TestInfo}.
|
|
3120
3123
|
*/
|
|
3121
3124
|
afterEach(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void;
|
|
3122
3125
|
/**
|
|
@@ -3153,7 +3156,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
3153
3156
|
* });
|
|
3154
3157
|
* ```
|
|
3155
3158
|
*
|
|
3156
|
-
* @param hookFunction Hook function that takes one or two arguments: an object with worker fixtures and optional
|
|
3159
|
+
* @param hookFunction Hook function that takes one or two arguments: an object with worker fixtures and optional {@link TestInfo}.
|
|
3157
3160
|
*/
|
|
3158
3161
|
beforeAll(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void;
|
|
3159
3162
|
/**
|
|
@@ -3177,7 +3180,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
|
|
|
3177
3180
|
* });
|
|
3178
3181
|
* ```
|
|
3179
3182
|
*
|
|
3180
|
-
* @param hookFunction Hook function that takes one or two arguments: an object with worker fixtures and optional
|
|
3183
|
+
* @param hookFunction Hook function that takes one or two arguments: an object with worker fixtures and optional {@link TestInfo}.
|
|
3181
3184
|
*/
|
|
3182
3185
|
afterAll(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void;
|
|
3183
3186
|
/**
|
|
@@ -3396,7 +3399,8 @@ type ConnectOptions = {
|
|
|
3396
3399
|
};
|
|
3397
3400
|
|
|
3398
3401
|
/**
|
|
3399
|
-
* Playwright Test provides many options to configure test environment,
|
|
3402
|
+
* Playwright Test provides many options to configure test environment, {@link Browser}, {@link BrowserContext} and
|
|
3403
|
+
* more.
|
|
3400
3404
|
*
|
|
3401
3405
|
* These options are usually provided in the [configuration file](https://playwright.dev/docs/test-configuration) through
|
|
3402
3406
|
* [testConfig.use](https://playwright.dev/docs/api/class-testconfig#test-config-use) and
|
|
@@ -3434,7 +3438,7 @@ type ConnectOptions = {
|
|
|
3434
3438
|
export interface PlaywrightWorkerOptions {
|
|
3435
3439
|
/**
|
|
3436
3440
|
* Name of the browser that runs tests. Defaults to `'chromium'`. Most of the time you should set `browserName` in
|
|
3437
|
-
* your
|
|
3441
|
+
* your {@link TestConfig}:
|
|
3438
3442
|
*
|
|
3439
3443
|
* **Usage**
|
|
3440
3444
|
*
|
|
@@ -3633,7 +3637,8 @@ export type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' |
|
|
|
3633
3637
|
export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
|
|
3634
3638
|
|
|
3635
3639
|
/**
|
|
3636
|
-
* Playwright Test provides many options to configure test environment,
|
|
3640
|
+
* Playwright Test provides many options to configure test environment, {@link Browser}, {@link BrowserContext} and
|
|
3641
|
+
* more.
|
|
3637
3642
|
*
|
|
3638
3643
|
* These options are usually provided in the [configuration file](https://playwright.dev/docs/test-configuration) through
|
|
3639
3644
|
* [testConfig.use](https://playwright.dev/docs/api/class-testconfig#test-config-use) and
|
|
@@ -4181,10 +4186,10 @@ export interface PlaywrightTestOptions {
|
|
|
4181
4186
|
* ```
|
|
4182
4187
|
*
|
|
4183
4188
|
* Given the test above, Playwright Test will set up the `page` fixture before running the test, and tear it down
|
|
4184
|
-
* after the test has finished. `page` fixture provides a
|
|
4189
|
+
* after the test has finished. `page` fixture provides a {@link Page} object that is available to the test.
|
|
4185
4190
|
*
|
|
4186
4191
|
* Playwright Test comes with builtin fixtures listed below, and you can add your own fixtures as well. Playwright
|
|
4187
|
-
* Test also [provides options]
|
|
4192
|
+
* Test also [provides options]{@link TestOptions} to configure
|
|
4188
4193
|
* [fixtures.browser](https://playwright.dev/docs/api/class-fixtures#fixtures-browser),
|
|
4189
4194
|
* [fixtures.context](https://playwright.dev/docs/api/class-fixtures#fixtures-context) and
|
|
4190
4195
|
* [fixtures.page](https://playwright.dev/docs/api/class-fixtures#fixtures-page).
|
|
@@ -4192,10 +4197,10 @@ export interface PlaywrightTestOptions {
|
|
|
4192
4197
|
export interface PlaywrightWorkerArgs {
|
|
4193
4198
|
playwright: typeof import('playwright-core');
|
|
4194
4199
|
/**
|
|
4195
|
-
*
|
|
4196
|
-
* efficient. However, each test runs in an isolated
|
|
4200
|
+
* {@link Browser} instance is shared between all tests in the [same worker](https://playwright.dev/docs/test-parallel) - this makes testing
|
|
4201
|
+
* efficient. However, each test runs in an isolated {@link BrowserContext} and gets a fresh environment.
|
|
4197
4202
|
*
|
|
4198
|
-
* Learn how to [configure browser](https://playwright.dev/docs/test-configuration) and see [available options]
|
|
4203
|
+
* Learn how to [configure browser](https://playwright.dev/docs/test-configuration) and see [available options]{@link TestOptions}.
|
|
4199
4204
|
*
|
|
4200
4205
|
* **Usage**
|
|
4201
4206
|
*
|
|
@@ -4227,20 +4232,21 @@ export interface PlaywrightWorkerArgs {
|
|
|
4227
4232
|
* ```
|
|
4228
4233
|
*
|
|
4229
4234
|
* Given the test above, Playwright Test will set up the `page` fixture before running the test, and tear it down
|
|
4230
|
-
* after the test has finished. `page` fixture provides a
|
|
4235
|
+
* after the test has finished. `page` fixture provides a {@link Page} object that is available to the test.
|
|
4231
4236
|
*
|
|
4232
4237
|
* Playwright Test comes with builtin fixtures listed below, and you can add your own fixtures as well. Playwright
|
|
4233
|
-
* Test also [provides options]
|
|
4238
|
+
* Test also [provides options]{@link TestOptions} to configure
|
|
4234
4239
|
* [fixtures.browser](https://playwright.dev/docs/api/class-fixtures#fixtures-browser),
|
|
4235
4240
|
* [fixtures.context](https://playwright.dev/docs/api/class-fixtures#fixtures-context) and
|
|
4236
4241
|
* [fixtures.page](https://playwright.dev/docs/api/class-fixtures#fixtures-page).
|
|
4237
4242
|
*/
|
|
4238
4243
|
export interface PlaywrightTestArgs {
|
|
4239
4244
|
/**
|
|
4240
|
-
* Isolated
|
|
4241
|
-
* test gets a fresh environment, even when multiple tests run in a single
|
|
4245
|
+
* Isolated {@link BrowserContext} instance, created for each test. Since contexts are isolated between each other,
|
|
4246
|
+
* every test gets a fresh environment, even when multiple tests run in a single {@link Browser} for maximum
|
|
4247
|
+
* efficiency.
|
|
4242
4248
|
*
|
|
4243
|
-
* Learn how to [configure context](https://playwright.dev/docs/test-configuration) and see [available options]
|
|
4249
|
+
* Learn how to [configure context](https://playwright.dev/docs/test-configuration) and see [available options]{@link TestOptions}.
|
|
4244
4250
|
*
|
|
4245
4251
|
* Default [fixtures.page](https://playwright.dev/docs/api/class-fixtures#fixtures-page) belongs to this context.
|
|
4246
4252
|
*
|
|
@@ -4256,7 +4262,7 @@ export interface PlaywrightTestArgs {
|
|
|
4256
4262
|
*/
|
|
4257
4263
|
context: BrowserContext;
|
|
4258
4264
|
/**
|
|
4259
|
-
* Isolated
|
|
4265
|
+
* Isolated {@link Page} instance, created for each test. Pages are isolated between tests due to
|
|
4260
4266
|
* [fixtures.context](https://playwright.dev/docs/api/class-fixtures#fixtures-context) isolation.
|
|
4261
4267
|
*
|
|
4262
4268
|
* This is the most common fixture used in a test.
|
|
@@ -4278,7 +4284,7 @@ export interface PlaywrightTestArgs {
|
|
|
4278
4284
|
*/
|
|
4279
4285
|
page: Page;
|
|
4280
4286
|
/**
|
|
4281
|
-
* Isolated
|
|
4287
|
+
* Isolated {@link APIRequestContext} instance for each test.
|
|
4282
4288
|
*
|
|
4283
4289
|
* **Usage**
|
|
4284
4290
|
*
|
|
@@ -4324,8 +4330,8 @@ type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
|
4324
4330
|
type ExtraMatchers<T, Type, Matchers> = T extends Type ? Matchers : IfAny<T, Matchers, {}>;
|
|
4325
4331
|
|
|
4326
4332
|
/**
|
|
4327
|
-
* The
|
|
4328
|
-
* the tests. A new instance of
|
|
4333
|
+
* The {@link GenericAssertions} class provides assertion methods that can be used to make assertions about any values
|
|
4334
|
+
* in the tests. A new instance of {@link GenericAssertions} is created by calling
|
|
4329
4335
|
* [expect(value)](https://playwright.dev/docs/api/class-playwrightassertions#playwright-assertions-expect-generic):
|
|
4330
4336
|
*
|
|
4331
4337
|
* ```js
|
|
@@ -4824,8 +4830,8 @@ export {};
|
|
|
4824
4830
|
|
|
4825
4831
|
|
|
4826
4832
|
/**
|
|
4827
|
-
* The
|
|
4828
|
-
*
|
|
4833
|
+
* The {@link APIResponseAssertions} class provides assertion methods that can be used to make assertions about the
|
|
4834
|
+
* {@link APIResponse} in the tests.
|
|
4829
4835
|
*
|
|
4830
4836
|
* ```js
|
|
4831
4837
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4864,8 +4870,8 @@ interface APIResponseAssertions {
|
|
|
4864
4870
|
}
|
|
4865
4871
|
|
|
4866
4872
|
/**
|
|
4867
|
-
* The
|
|
4868
|
-
* state in the tests.
|
|
4873
|
+
* The {@link LocatorAssertions} class provides assertion methods that can be used to make assertions about the {@link
|
|
4874
|
+
* Locator} state in the tests.
|
|
4869
4875
|
*
|
|
4870
4876
|
* ```js
|
|
4871
4877
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4880,7 +4886,7 @@ interface APIResponseAssertions {
|
|
|
4880
4886
|
*/
|
|
4881
4887
|
interface LocatorAssertions {
|
|
4882
4888
|
/**
|
|
4883
|
-
* Ensures that
|
|
4889
|
+
* Ensures that {@link Locator} points to an [attached](https://playwright.dev/docs/actionability#attached) DOM node.
|
|
4884
4890
|
*
|
|
4885
4891
|
* **Usage**
|
|
4886
4892
|
*
|
|
@@ -4900,7 +4906,7 @@ interface LocatorAssertions {
|
|
|
4900
4906
|
}): Promise<void>;
|
|
4901
4907
|
|
|
4902
4908
|
/**
|
|
4903
|
-
* Ensures the
|
|
4909
|
+
* Ensures the {@link Locator} points to a checked input.
|
|
4904
4910
|
*
|
|
4905
4911
|
* **Usage**
|
|
4906
4912
|
*
|
|
@@ -4921,7 +4927,7 @@ interface LocatorAssertions {
|
|
|
4921
4927
|
}): Promise<void>;
|
|
4922
4928
|
|
|
4923
4929
|
/**
|
|
4924
|
-
* Ensures the
|
|
4930
|
+
* Ensures the {@link Locator} points to a disabled element. Element is disabled if it has "disabled" attribute or is
|
|
4925
4931
|
* disabled via
|
|
4926
4932
|
* ['aria-disabled'](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled). Note
|
|
4927
4933
|
* that only native control elements such as HTML `button`, `input`, `select`, `textarea`, `option`, `optgroup` can be
|
|
@@ -4944,7 +4950,7 @@ interface LocatorAssertions {
|
|
|
4944
4950
|
}): Promise<void>;
|
|
4945
4951
|
|
|
4946
4952
|
/**
|
|
4947
|
-
* Ensures the
|
|
4953
|
+
* Ensures the {@link Locator} points to an editable element.
|
|
4948
4954
|
*
|
|
4949
4955
|
* **Usage**
|
|
4950
4956
|
*
|
|
@@ -4965,7 +4971,7 @@ interface LocatorAssertions {
|
|
|
4965
4971
|
}): Promise<void>;
|
|
4966
4972
|
|
|
4967
4973
|
/**
|
|
4968
|
-
* Ensures the
|
|
4974
|
+
* Ensures the {@link Locator} points to an empty editable element or to a DOM node that has no text.
|
|
4969
4975
|
*
|
|
4970
4976
|
* **Usage**
|
|
4971
4977
|
*
|
|
@@ -4984,7 +4990,7 @@ interface LocatorAssertions {
|
|
|
4984
4990
|
}): Promise<void>;
|
|
4985
4991
|
|
|
4986
4992
|
/**
|
|
4987
|
-
* Ensures the
|
|
4993
|
+
* Ensures the {@link Locator} points to an enabled element.
|
|
4988
4994
|
*
|
|
4989
4995
|
* **Usage**
|
|
4990
4996
|
*
|
|
@@ -5005,7 +5011,7 @@ interface LocatorAssertions {
|
|
|
5005
5011
|
}): Promise<void>;
|
|
5006
5012
|
|
|
5007
5013
|
/**
|
|
5008
|
-
* Ensures the
|
|
5014
|
+
* Ensures the {@link Locator} points to a focused DOM node.
|
|
5009
5015
|
*
|
|
5010
5016
|
* **Usage**
|
|
5011
5017
|
*
|
|
@@ -5024,7 +5030,7 @@ interface LocatorAssertions {
|
|
|
5024
5030
|
}): Promise<void>;
|
|
5025
5031
|
|
|
5026
5032
|
/**
|
|
5027
|
-
* Ensures that
|
|
5033
|
+
* Ensures that {@link Locator} either does not resolve to any DOM node, or resolves to a
|
|
5028
5034
|
* [non-visible](https://playwright.dev/docs/actionability#visible) one.
|
|
5029
5035
|
*
|
|
5030
5036
|
* **Usage**
|
|
@@ -5044,7 +5050,7 @@ interface LocatorAssertions {
|
|
|
5044
5050
|
}): Promise<void>;
|
|
5045
5051
|
|
|
5046
5052
|
/**
|
|
5047
|
-
* Ensures the
|
|
5053
|
+
* Ensures the {@link Locator} points to an element that intersects viewport, according to the
|
|
5048
5054
|
* [intersection observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).
|
|
5049
5055
|
*
|
|
5050
5056
|
* **Usage**
|
|
@@ -5075,7 +5081,7 @@ interface LocatorAssertions {
|
|
|
5075
5081
|
}): Promise<void>;
|
|
5076
5082
|
|
|
5077
5083
|
/**
|
|
5078
|
-
* Ensures that
|
|
5084
|
+
* Ensures that {@link Locator} points to an [attached](https://playwright.dev/docs/actionability#attached) and
|
|
5079
5085
|
* [visible](https://playwright.dev/docs/actionability#visible) DOM node.
|
|
5080
5086
|
*
|
|
5081
5087
|
* **Usage**
|
|
@@ -5096,8 +5102,8 @@ interface LocatorAssertions {
|
|
|
5096
5102
|
}): Promise<void>;
|
|
5097
5103
|
|
|
5098
5104
|
/**
|
|
5099
|
-
* Ensures the
|
|
5100
|
-
* value as well.
|
|
5105
|
+
* Ensures the {@link Locator} points to an element that contains the given text. You can use regular expressions for
|
|
5106
|
+
* the value as well.
|
|
5101
5107
|
*
|
|
5102
5108
|
* **Usage**
|
|
5103
5109
|
*
|
|
@@ -5161,7 +5167,7 @@ interface LocatorAssertions {
|
|
|
5161
5167
|
}): Promise<void>;
|
|
5162
5168
|
|
|
5163
5169
|
/**
|
|
5164
|
-
* Ensures the
|
|
5170
|
+
* Ensures the {@link Locator} points to an element with given attribute.
|
|
5165
5171
|
*
|
|
5166
5172
|
* **Usage**
|
|
5167
5173
|
*
|
|
@@ -5182,8 +5188,8 @@ interface LocatorAssertions {
|
|
|
5182
5188
|
}): Promise<void>;
|
|
5183
5189
|
|
|
5184
5190
|
/**
|
|
5185
|
-
* Ensures the
|
|
5186
|
-
* regular expression.
|
|
5191
|
+
* Ensures the {@link Locator} points to an element with given CSS classes. This needs to be a full match or using a
|
|
5192
|
+
* relaxed regular expression.
|
|
5187
5193
|
*
|
|
5188
5194
|
* **Usage**
|
|
5189
5195
|
*
|
|
@@ -5215,7 +5221,7 @@ interface LocatorAssertions {
|
|
|
5215
5221
|
}): Promise<void>;
|
|
5216
5222
|
|
|
5217
5223
|
/**
|
|
5218
|
-
* Ensures the
|
|
5224
|
+
* Ensures the {@link Locator} resolves to an exact number of DOM nodes.
|
|
5219
5225
|
*
|
|
5220
5226
|
* **Usage**
|
|
5221
5227
|
*
|
|
@@ -5235,7 +5241,7 @@ interface LocatorAssertions {
|
|
|
5235
5241
|
}): Promise<void>;
|
|
5236
5242
|
|
|
5237
5243
|
/**
|
|
5238
|
-
* Ensures the
|
|
5244
|
+
* Ensures the {@link Locator} resolves to an element with the given computed CSS style.
|
|
5239
5245
|
*
|
|
5240
5246
|
* **Usage**
|
|
5241
5247
|
*
|
|
@@ -5256,7 +5262,7 @@ interface LocatorAssertions {
|
|
|
5256
5262
|
}): Promise<void>;
|
|
5257
5263
|
|
|
5258
5264
|
/**
|
|
5259
|
-
* Ensures the
|
|
5265
|
+
* Ensures the {@link Locator} points to an element with the given DOM Node ID.
|
|
5260
5266
|
*
|
|
5261
5267
|
* **Usage**
|
|
5262
5268
|
*
|
|
@@ -5276,8 +5282,8 @@ interface LocatorAssertions {
|
|
|
5276
5282
|
}): Promise<void>;
|
|
5277
5283
|
|
|
5278
5284
|
/**
|
|
5279
|
-
* Ensures the
|
|
5280
|
-
* primitive type as well as a plain serializable JavaScript object.
|
|
5285
|
+
* Ensures the {@link Locator} points to an element with given JavaScript property. Note that this property can be of
|
|
5286
|
+
* a primitive type as well as a plain serializable JavaScript object.
|
|
5281
5287
|
*
|
|
5282
5288
|
* **Usage**
|
|
5283
5289
|
*
|
|
@@ -5331,10 +5337,16 @@ interface LocatorAssertions {
|
|
|
5331
5337
|
|
|
5332
5338
|
/**
|
|
5333
5339
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5334
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5340
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5335
5341
|
*/
|
|
5336
5342
|
mask?: Array<Locator>;
|
|
5337
5343
|
|
|
5344
|
+
/**
|
|
5345
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5346
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5347
|
+
*/
|
|
5348
|
+
maskColor?: string;
|
|
5349
|
+
|
|
5338
5350
|
/**
|
|
5339
5351
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5340
5352
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -5408,10 +5420,16 @@ interface LocatorAssertions {
|
|
|
5408
5420
|
|
|
5409
5421
|
/**
|
|
5410
5422
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5411
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5423
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5412
5424
|
*/
|
|
5413
5425
|
mask?: Array<Locator>;
|
|
5414
5426
|
|
|
5427
|
+
/**
|
|
5428
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5429
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5430
|
+
*/
|
|
5431
|
+
maskColor?: string;
|
|
5432
|
+
|
|
5415
5433
|
/**
|
|
5416
5434
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5417
5435
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -5453,8 +5471,8 @@ interface LocatorAssertions {
|
|
|
5453
5471
|
}): Promise<void>;
|
|
5454
5472
|
|
|
5455
5473
|
/**
|
|
5456
|
-
* Ensures the
|
|
5457
|
-
* well.
|
|
5474
|
+
* Ensures the {@link Locator} points to an element with the given text. You can use regular expressions for the value
|
|
5475
|
+
* as well.
|
|
5458
5476
|
*
|
|
5459
5477
|
* **Usage**
|
|
5460
5478
|
*
|
|
@@ -5517,8 +5535,8 @@ interface LocatorAssertions {
|
|
|
5517
5535
|
}): Promise<void>;
|
|
5518
5536
|
|
|
5519
5537
|
/**
|
|
5520
|
-
* Ensures the
|
|
5521
|
-
* value as well.
|
|
5538
|
+
* Ensures the {@link Locator} points to an element with the given input value. You can use regular expressions for
|
|
5539
|
+
* the value as well.
|
|
5522
5540
|
*
|
|
5523
5541
|
* **Usage**
|
|
5524
5542
|
*
|
|
@@ -5538,7 +5556,7 @@ interface LocatorAssertions {
|
|
|
5538
5556
|
}): Promise<void>;
|
|
5539
5557
|
|
|
5540
5558
|
/**
|
|
5541
|
-
* Ensures the
|
|
5559
|
+
* Ensures the {@link Locator} points to multi-select/combobox (i.e. a `select` with the `multiple` attribute) and the
|
|
5542
5560
|
* specified values are selected.
|
|
5543
5561
|
*
|
|
5544
5562
|
* **Usage**
|
|
@@ -5582,8 +5600,8 @@ interface LocatorAssertions {
|
|
|
5582
5600
|
}
|
|
5583
5601
|
|
|
5584
5602
|
/**
|
|
5585
|
-
* The
|
|
5586
|
-
* the tests.
|
|
5603
|
+
* The {@link PageAssertions} class provides assertion methods that can be used to make assertions about the {@link
|
|
5604
|
+
* Page} state in the tests.
|
|
5587
5605
|
*
|
|
5588
5606
|
* ```js
|
|
5589
5607
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5661,10 +5679,16 @@ interface PageAssertions {
|
|
|
5661
5679
|
|
|
5662
5680
|
/**
|
|
5663
5681
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5664
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5682
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5665
5683
|
*/
|
|
5666
5684
|
mask?: Array<Locator>;
|
|
5667
5685
|
|
|
5686
|
+
/**
|
|
5687
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5688
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5689
|
+
*/
|
|
5690
|
+
maskColor?: string;
|
|
5691
|
+
|
|
5668
5692
|
/**
|
|
5669
5693
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5670
5694
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -5768,10 +5792,16 @@ interface PageAssertions {
|
|
|
5768
5792
|
|
|
5769
5793
|
/**
|
|
5770
5794
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5771
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5795
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5772
5796
|
*/
|
|
5773
5797
|
mask?: Array<Locator>;
|
|
5774
5798
|
|
|
5799
|
+
/**
|
|
5800
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5801
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5802
|
+
*/
|
|
5803
|
+
maskColor?: string;
|
|
5804
|
+
|
|
5775
5805
|
/**
|
|
5776
5806
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5777
5807
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -6001,8 +6031,8 @@ export interface TestInfoError {
|
|
|
6001
6031
|
*
|
|
6002
6032
|
* `TestProject` encapsulates configuration specific to a single project. Projects are configured in
|
|
6003
6033
|
* [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects) specified in the
|
|
6004
|
-
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of
|
|
6005
|
-
* top-level
|
|
6034
|
+
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of {@link TestProject} are available in
|
|
6035
|
+
* the top-level {@link TestConfig}, in which case they are shared between all projects.
|
|
6006
6036
|
*
|
|
6007
6037
|
* Here is an example configuration that runs every test in Chromium, Firefox and WebKit, both Desktop and Mobile
|
|
6008
6038
|
* versions.
|