@playwright/test 1.35.0-alpha-jun-5-2023 → 1.35.0-alpha-jun-6-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/common/process.js +1 -1
- package/lib/index.js +2 -2
- package/lib/matchers/toMatchSnapshot.js +5 -0
- package/lib/reporters/github.js +1 -1
- package/lib/reporters/html.js +1 -2
- package/lib/reporters/merge.js +1 -0
- package/lib/runner/dispatcher.js +5 -5
- package/lib/runner/uiMode.js +7 -6
- package/lib/util.js +19 -2
- package/lib/utilsBundle.js +1 -3
- package/lib/utilsBundleImpl.js +36 -36
- package/lib/worker/workerMain.js +3 -3
- package/package.json +2 -2
- package/types/test.d.ts +87 -81
- package/types/testReporter.d.ts +16 -14
package/lib/worker/workerMain.js
CHANGED
|
@@ -169,7 +169,7 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
169
169
|
// No current test - fatal error.
|
|
170
170
|
if (!this._fatalErrors.length) this._fatalErrors.push((0, _util2.serializeError)(error));
|
|
171
171
|
}
|
|
172
|
-
this._stop();
|
|
172
|
+
void this._stop();
|
|
173
173
|
}
|
|
174
174
|
async _loadIfNeeded() {
|
|
175
175
|
if (this._config) return;
|
|
@@ -203,14 +203,14 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
203
203
|
}
|
|
204
204
|
} else {
|
|
205
205
|
fatalUnknownTestIds = runPayload.entries.map(e => e.testId);
|
|
206
|
-
this._stop();
|
|
206
|
+
void this._stop();
|
|
207
207
|
}
|
|
208
208
|
} catch (e) {
|
|
209
209
|
// In theory, we should run above code without any errors.
|
|
210
210
|
// However, in the case we screwed up, or loadTestFile failed in the worker
|
|
211
211
|
// but not in the runner, let's do a fatal error.
|
|
212
212
|
this._fatalErrors.push((0, _util2.serializeError)(e));
|
|
213
|
-
this._stop();
|
|
213
|
+
void this._stop();
|
|
214
214
|
} finally {
|
|
215
215
|
const donePayload = {
|
|
216
216
|
fatalErrors: this._fatalErrors,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/test",
|
|
3
|
-
"version": "1.35.0-alpha-jun-
|
|
3
|
+
"version": "1.35.0-alpha-jun-6-2023",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": "github:Microsoft/playwright",
|
|
6
6
|
"homepage": "https://playwright.dev",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/node": "*",
|
|
44
|
-
"playwright-core": "1.35.0-alpha-jun-
|
|
44
|
+
"playwright-core": "1.35.0-alpha-jun-6-2023"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"fsevents": "2.3.2"
|
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
|
|
@@ -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
|
*
|
|
@@ -5453,8 +5459,8 @@ interface LocatorAssertions {
|
|
|
5453
5459
|
}): Promise<void>;
|
|
5454
5460
|
|
|
5455
5461
|
/**
|
|
5456
|
-
* Ensures the
|
|
5457
|
-
* well.
|
|
5462
|
+
* Ensures the {@link Locator} points to an element with the given text. You can use regular expressions for the value
|
|
5463
|
+
* as well.
|
|
5458
5464
|
*
|
|
5459
5465
|
* **Usage**
|
|
5460
5466
|
*
|
|
@@ -5517,8 +5523,8 @@ interface LocatorAssertions {
|
|
|
5517
5523
|
}): Promise<void>;
|
|
5518
5524
|
|
|
5519
5525
|
/**
|
|
5520
|
-
* Ensures the
|
|
5521
|
-
* value as well.
|
|
5526
|
+
* Ensures the {@link Locator} points to an element with the given input value. You can use regular expressions for
|
|
5527
|
+
* the value as well.
|
|
5522
5528
|
*
|
|
5523
5529
|
* **Usage**
|
|
5524
5530
|
*
|
|
@@ -5538,7 +5544,7 @@ interface LocatorAssertions {
|
|
|
5538
5544
|
}): Promise<void>;
|
|
5539
5545
|
|
|
5540
5546
|
/**
|
|
5541
|
-
* Ensures the
|
|
5547
|
+
* Ensures the {@link Locator} points to multi-select/combobox (i.e. a `select` with the `multiple` attribute) and the
|
|
5542
5548
|
* specified values are selected.
|
|
5543
5549
|
*
|
|
5544
5550
|
* **Usage**
|
|
@@ -5582,8 +5588,8 @@ interface LocatorAssertions {
|
|
|
5582
5588
|
}
|
|
5583
5589
|
|
|
5584
5590
|
/**
|
|
5585
|
-
* The
|
|
5586
|
-
* the tests.
|
|
5591
|
+
* The {@link PageAssertions} class provides assertion methods that can be used to make assertions about the {@link
|
|
5592
|
+
* Page} state in the tests.
|
|
5587
5593
|
*
|
|
5588
5594
|
* ```js
|
|
5589
5595
|
* import { test, expect } from '@playwright/test';
|
|
@@ -6001,8 +6007,8 @@ export interface TestInfoError {
|
|
|
6001
6007
|
*
|
|
6002
6008
|
* `TestProject` encapsulates configuration specific to a single project. Projects are configured in
|
|
6003
6009
|
* [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
|
|
6010
|
+
* [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of {@link TestProject} are available in
|
|
6011
|
+
* the top-level {@link TestConfig}, in which case they are shared between all projects.
|
|
6006
6012
|
*
|
|
6007
6013
|
* Here is an example configuration that runs every test in Chromium, Firefox and WebKit, both Desktop and Mobile
|
|
6008
6014
|
* versions.
|