playwright 1.62.1 → 1.65.0
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/README.md +4 -4
- package/lib/agents/playwright-test-generator.agent.md +1 -1
- package/lib/cli/testActions.js +9 -6
- package/lib/common/index.js +207 -148
- package/lib/common/index.js.txt +13 -14
- package/lib/index.js +51 -30
- package/lib/matchers/expect.js +117 -81
- package/lib/matchers/expect.js.LICENSE +3 -3
- package/lib/matchers/expect.js.txt +8 -8
- package/lib/mcp/test/browserBackend.js +12 -2
- package/lib/mcp/test/testContext.js +2 -8
- package/lib/program.js +4 -4
- package/lib/runner/index.js +1151 -572
- package/lib/runner/index.js.txt +32 -29
- package/lib/transform/babelBundle.js +1217 -982
- package/lib/transform/babelBundle.js.LICENSE +15 -15
- package/lib/transform/babelBundle.js.txt +14 -11
- package/lib/transform/esmLoader.js +375 -187
- package/lib/transform/esmLoader.js.LICENSE +3 -3
- package/lib/transform/esmLoader.js.txt +9 -8
- package/lib/worker/workerProcessEntry.js +43 -41
- package/lib/worker/workerProcessEntry.js.txt +4 -4
- package/package.json +2 -10
- package/types/test.d.ts +755 -88
- package/types/testReporter.d.ts +74 -3
- package/jsx-runtime.js +0 -42
- package/jsx-runtime.mjs +0 -21
package/types/test.d.ts
CHANGED
|
@@ -19,10 +19,16 @@ 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
|
|
24
|
-
export type
|
|
22
|
+
export type DotReporterOptions = { omitTags?: boolean };
|
|
23
|
+
export type FailuresReporterOptions = { omitTags?: boolean };
|
|
24
|
+
export type LineReporterOptions = { omitTags?: boolean };
|
|
25
|
+
export type ListReporterOptions = { printSteps?: boolean, printFailuresInline?: boolean, omitTags?: boolean };
|
|
26
|
+
export type GitHubReporterOptions = { omitTags?: boolean };
|
|
27
|
+
export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean, includeRetries?: boolean, omitTags?: boolean, onlyFailures?: boolean };
|
|
28
|
+
export type JsonReporterOptions = { outputFile?: string, onlyFailures?: boolean };
|
|
29
|
+
export type PerfettoReporterOptions = { outputFile?: string };
|
|
25
30
|
export type HtmlReporterOptions = {
|
|
31
|
+
onlyFailures?: boolean;
|
|
26
32
|
outputFolder?: string;
|
|
27
33
|
open?: 'always' | 'never' | 'on-failure';
|
|
28
34
|
host?: string;
|
|
@@ -37,12 +43,14 @@ export type HtmlReporterOptions = {
|
|
|
37
43
|
|
|
38
44
|
export type ReporterDescription = Readonly<
|
|
39
45
|
['blob'] | ['blob', BlobReporterOptions] |
|
|
40
|
-
['dot'] |
|
|
41
|
-
['
|
|
46
|
+
['dot'] | ['dot', DotReporterOptions] |
|
|
47
|
+
['failures'] | ['failures', FailuresReporterOptions] |
|
|
48
|
+
['line'] | ['line', LineReporterOptions] |
|
|
42
49
|
['list'] | ['list', ListReporterOptions] |
|
|
43
|
-
['github'] |
|
|
50
|
+
['github'] | ['github', GitHubReporterOptions] |
|
|
44
51
|
['junit'] | ['junit', JUnitReporterOptions] |
|
|
45
52
|
['json'] | ['json', JsonReporterOptions] |
|
|
53
|
+
['perfetto'] | ['perfetto', PerfettoReporterOptions] |
|
|
46
54
|
['html'] | ['html', HtmlReporterOptions] |
|
|
47
55
|
['null'] |
|
|
48
56
|
[string] | [string, any]
|
|
@@ -130,6 +138,40 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
|
|
|
130
138
|
* all projects.
|
|
131
139
|
*/
|
|
132
140
|
use?: UseOptions<TestArgs, WorkerArgs>;
|
|
141
|
+
/**
|
|
142
|
+
* Whether the project runs when no `--project` command line option is passed. Defaults to `true`.
|
|
143
|
+
*
|
|
144
|
+
* To run a project with `default: false`, select it with the `--project` command line option.
|
|
145
|
+
*
|
|
146
|
+
* A project with `default: false` still runs when another running project lists it in
|
|
147
|
+
* [testProject.dependencies](https://playwright.dev/docs/api/class-testproject#test-project-dependencies) or
|
|
148
|
+
* [testProject.teardown](https://playwright.dev/docs/api/class-testproject#test-project-teardown).
|
|
149
|
+
*
|
|
150
|
+
* **Usage**
|
|
151
|
+
*
|
|
152
|
+
* ```js
|
|
153
|
+
* // playwright.config.ts
|
|
154
|
+
* import { defineConfig } from '@playwright/test';
|
|
155
|
+
*
|
|
156
|
+
* export default defineConfig({
|
|
157
|
+
* projects: [
|
|
158
|
+
* {
|
|
159
|
+
* name: 'chromium',
|
|
160
|
+
* use: devices['Desktop Chrome'],
|
|
161
|
+
* },
|
|
162
|
+
* {
|
|
163
|
+
* name: 'slow',
|
|
164
|
+
* testDir: './slow-tests',
|
|
165
|
+
* default: false,
|
|
166
|
+
* },
|
|
167
|
+
* ],
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* Now `npx playwright test` only runs `chromium`, while `npx playwright test --project=slow` runs `slow`.
|
|
172
|
+
*/
|
|
173
|
+
default?: boolean;
|
|
174
|
+
|
|
133
175
|
/**
|
|
134
176
|
* List of projects that need to run before any test in this project runs. Dependencies can be useful for configuring
|
|
135
177
|
* the global setup actions in a way that every action is in a form of a test. Passing `--no-deps` argument ignores
|
|
@@ -198,13 +240,14 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
|
|
|
198
240
|
threshold?: number;
|
|
199
241
|
|
|
200
242
|
/**
|
|
201
|
-
* an acceptable amount of pixels that could be different, unset by default.
|
|
243
|
+
* an acceptable amount of pixels that could be different, unset by default. Note that `threshold` defines which
|
|
244
|
+
* pixels are considered different.
|
|
202
245
|
*/
|
|
203
246
|
maxDiffPixels?: number;
|
|
204
247
|
|
|
205
248
|
/**
|
|
206
249
|
* an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by
|
|
207
|
-
* default.
|
|
250
|
+
* default. Note that `threshold` defines which pixels are considered different.
|
|
208
251
|
*/
|
|
209
252
|
maxDiffPixelRatio?: number;
|
|
210
253
|
|
|
@@ -232,6 +275,12 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
|
|
|
232
275
|
*/
|
|
233
276
|
stylePath?: string|Array<string>;
|
|
234
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Format of the screenshots taken when the snapshot name is omitted, defaults to `"png"`. Snapshots with an explicit
|
|
280
|
+
* name use the format matching their `.png` or `.webp` extension.
|
|
281
|
+
*/
|
|
282
|
+
type?: "png"|"webp";
|
|
283
|
+
|
|
235
284
|
/**
|
|
236
285
|
* A template controlling location of the screenshots. See
|
|
237
286
|
* [testProject.snapshotPathTemplate](https://playwright.dev/docs/api/class-testproject#test-project-snapshot-path-template)
|
|
@@ -282,13 +331,14 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
|
|
|
282
331
|
threshold?: number;
|
|
283
332
|
|
|
284
333
|
/**
|
|
285
|
-
* an acceptable amount of pixels that could be different, unset by default.
|
|
334
|
+
* an acceptable amount of pixels that could be different, unset by default. Note that `threshold` defines which
|
|
335
|
+
* pixels are considered different.
|
|
286
336
|
*/
|
|
287
337
|
maxDiffPixels?: number;
|
|
288
338
|
|
|
289
339
|
/**
|
|
290
340
|
* an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by
|
|
291
|
-
* default.
|
|
341
|
+
* default. Note that `threshold` defines which pixels are considered different.
|
|
292
342
|
*/
|
|
293
343
|
maxDiffPixelRatio?: number;
|
|
294
344
|
};
|
|
@@ -914,7 +964,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
914
964
|
* ```
|
|
915
965
|
*
|
|
916
966
|
*/
|
|
917
|
-
reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html', string> | ReporterDescription[];
|
|
967
|
+
reporter?: LiteralUnion<'list'|'dot'|'failures'|'line'|'github'|'json'|'junit'|'null'|'html'|'blob'|'perfetto', string> | ReporterDescription[];
|
|
918
968
|
/**
|
|
919
969
|
* Global options for all tests, for example
|
|
920
970
|
* [testOptions.browserName](https://playwright.dev/docs/api/class-testoptions#test-options-browser-name). Learn more
|
|
@@ -1033,7 +1083,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1033
1083
|
* ```js
|
|
1034
1084
|
* import { test, expect } from '@playwright/test';
|
|
1035
1085
|
*
|
|
1036
|
-
* test.use({
|
|
1086
|
+
* test.use({ baseURL: `http://localhost:${process.env.MY_SERVER_PORT ?? 3000}` });
|
|
1037
1087
|
*
|
|
1038
1088
|
* test('homepage', async ({ page }) => {
|
|
1039
1089
|
* await page.goto('/');
|
|
@@ -1150,13 +1200,14 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1150
1200
|
caret?: "hide"|"initial";
|
|
1151
1201
|
|
|
1152
1202
|
/**
|
|
1153
|
-
* An acceptable amount of pixels that could be different, unset by default.
|
|
1203
|
+
* An acceptable amount of pixels that could be different, unset by default. Note that `threshold` defines which
|
|
1204
|
+
* pixels are considered different.
|
|
1154
1205
|
*/
|
|
1155
1206
|
maxDiffPixels?: number;
|
|
1156
1207
|
|
|
1157
1208
|
/**
|
|
1158
1209
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by
|
|
1159
|
-
* default.
|
|
1210
|
+
* default. Note that `threshold` defines which pixels are considered different.
|
|
1160
1211
|
*/
|
|
1161
1212
|
maxDiffPixelRatio?: number;
|
|
1162
1213
|
|
|
@@ -1179,6 +1230,12 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1179
1230
|
*/
|
|
1180
1231
|
threshold?: number;
|
|
1181
1232
|
|
|
1233
|
+
/**
|
|
1234
|
+
* Format of the screenshots taken when the snapshot name is omitted, defaults to `"png"`. Snapshots with an explicit
|
|
1235
|
+
* name use the format matching their `.png` or `.webp` extension.
|
|
1236
|
+
*/
|
|
1237
|
+
type?: "png"|"webp";
|
|
1238
|
+
|
|
1182
1239
|
/**
|
|
1183
1240
|
* A template controlling location of the screenshots. See
|
|
1184
1241
|
* [testConfig.snapshotPathTemplate](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template)
|
|
@@ -1215,13 +1272,14 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1215
1272
|
*/
|
|
1216
1273
|
toMatchSnapshot?: {
|
|
1217
1274
|
/**
|
|
1218
|
-
* An acceptable amount of pixels that could be different, unset by default.
|
|
1275
|
+
* An acceptable amount of pixels that could be different, unset by default. Note that `threshold` defines which
|
|
1276
|
+
* pixels are considered different.
|
|
1219
1277
|
*/
|
|
1220
1278
|
maxDiffPixels?: number;
|
|
1221
1279
|
|
|
1222
1280
|
/**
|
|
1223
1281
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by
|
|
1224
|
-
* default.
|
|
1282
|
+
* default. Note that `threshold` defines which pixels are considered different.
|
|
1225
1283
|
*/
|
|
1226
1284
|
maxDiffPixelRatio?: number;
|
|
1227
1285
|
|
|
@@ -1962,13 +2020,15 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1962
2020
|
tsconfig?: string;
|
|
1963
2021
|
|
|
1964
2022
|
/**
|
|
1965
|
-
* Whether to update expected snapshots with the actual results produced by the test run. Defaults to `'
|
|
2023
|
+
* Whether to update expected snapshots with the actual results produced by the test run. Defaults to `'default'`.
|
|
1966
2024
|
* - `'all'` - All tests that are executed will update snapshots.
|
|
1967
2025
|
* - `'changed'` - All tests that are executed will update snapshots that did not match. Matching snapshots will not
|
|
1968
2026
|
* be updated. Also creates missing snapshots.
|
|
1969
2027
|
* - `'missing'` - Missing snapshots are created, for example when authoring a new test and running it for the first
|
|
1970
|
-
* time.
|
|
2028
|
+
* time. Tests that only create missing snapshots pass.
|
|
1971
2029
|
* - `'none'` - No snapshots are updated.
|
|
2030
|
+
* - `'default'` - Missing snapshots are created, but the tests that create them fail, so that the run does not
|
|
2031
|
+
* silently pass in CI. This is the default.
|
|
1972
2032
|
*
|
|
1973
2033
|
* Learn more about [snapshots](https://playwright.dev/docs/test-snapshots).
|
|
1974
2034
|
*
|
|
@@ -1979,12 +2039,12 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1979
2039
|
* import { defineConfig } from '@playwright/test';
|
|
1980
2040
|
*
|
|
1981
2041
|
* export default defineConfig({
|
|
1982
|
-
* updateSnapshots: '
|
|
2042
|
+
* updateSnapshots: 'default',
|
|
1983
2043
|
* });
|
|
1984
2044
|
* ```
|
|
1985
2045
|
*
|
|
1986
2046
|
*/
|
|
1987
|
-
updateSnapshots?: "all"|"changed"|"missing"|"none";
|
|
2047
|
+
updateSnapshots?: "all"|"changed"|"missing"|"none"|"default";
|
|
1988
2048
|
|
|
1989
2049
|
/**
|
|
1990
2050
|
* Defines how to update snapshots in the source code.
|
|
@@ -2063,6 +2123,13 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
2063
2123
|
*/
|
|
2064
2124
|
failOnFlakyTests: boolean;
|
|
2065
2125
|
|
|
2126
|
+
/**
|
|
2127
|
+
* List of projects that were selected to run, after applying the `--project` command line filter. When no filter is
|
|
2128
|
+
* specified, this is the same as
|
|
2129
|
+
* [fullConfig.projects](https://playwright.dev/docs/api/class-fullconfig#full-config-projects).
|
|
2130
|
+
*/
|
|
2131
|
+
filteredProjects: Array<FullProject>;
|
|
2132
|
+
|
|
2066
2133
|
/**
|
|
2067
2134
|
* See [testConfig.forbidOnly](https://playwright.dev/docs/api/class-testconfig#test-config-forbid-only).
|
|
2068
2135
|
*/
|
|
@@ -2161,7 +2228,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
2161
2228
|
/**
|
|
2162
2229
|
* See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots).
|
|
2163
2230
|
*/
|
|
2164
|
-
updateSnapshots: "all"|"changed"|"missing"|"none";
|
|
2231
|
+
updateSnapshots: "all"|"changed"|"missing"|"none"|"default";
|
|
2165
2232
|
|
|
2166
2233
|
/**
|
|
2167
2234
|
* See
|
|
@@ -2719,6 +2786,7 @@ export type TestAnnotation = TestDetailsAnnotation & {
|
|
|
2719
2786
|
export type TestDetails = {
|
|
2720
2787
|
tag?: string | string[];
|
|
2721
2788
|
annotation?: TestDetailsAnnotation | TestDetailsAnnotation[];
|
|
2789
|
+
lock?: string | string[];
|
|
2722
2790
|
}
|
|
2723
2791
|
|
|
2724
2792
|
type TestBody<TestArgs> = (args: TestArgs, testInfo: TestInfo) => Promise<unknown> | unknown;
|
|
@@ -2810,6 +2878,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
2810
2878
|
* [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
|
|
2811
2879
|
*
|
|
2812
2880
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
2881
|
+
*
|
|
2882
|
+
* **Locks**
|
|
2883
|
+
*
|
|
2884
|
+
* You can declare named locks to prevent specific tests from running at the same time, while all other tests continue
|
|
2885
|
+
* to run in parallel. Tests that share a lock name never run concurrently, even when they are declared in different
|
|
2886
|
+
* files or belong to different [projects](https://playwright.dev/docs/test-projects). This is useful when a few tests access a shared
|
|
2887
|
+
* resource that does not support concurrent access.
|
|
2888
|
+
*
|
|
2889
|
+
* ```js
|
|
2890
|
+
* import { test, expect } from '@playwright/test';
|
|
2891
|
+
*
|
|
2892
|
+
* test('update user settings', {
|
|
2893
|
+
* lock: 'user-settings',
|
|
2894
|
+
* }, async ({ page }) => {
|
|
2895
|
+
* // This test never runs concurrently with other tests
|
|
2896
|
+
* // that declare the 'user-settings' lock.
|
|
2897
|
+
* });
|
|
2898
|
+
* ```
|
|
2899
|
+
*
|
|
2900
|
+
* The built-in `-exclusive-` lock runs the test only when no other tests are running.
|
|
2901
|
+
*
|
|
2902
|
+
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
2813
2903
|
* @param title Test title.
|
|
2814
2904
|
* @param details Additional test details.
|
|
2815
2905
|
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
@@ -2887,6 +2977,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
2887
2977
|
* [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
|
|
2888
2978
|
*
|
|
2889
2979
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
2980
|
+
*
|
|
2981
|
+
* **Locks**
|
|
2982
|
+
*
|
|
2983
|
+
* You can declare named locks to prevent specific tests from running at the same time, while all other tests continue
|
|
2984
|
+
* to run in parallel. Tests that share a lock name never run concurrently, even when they are declared in different
|
|
2985
|
+
* files or belong to different [projects](https://playwright.dev/docs/test-projects). This is useful when a few tests access a shared
|
|
2986
|
+
* resource that does not support concurrent access.
|
|
2987
|
+
*
|
|
2988
|
+
* ```js
|
|
2989
|
+
* import { test, expect } from '@playwright/test';
|
|
2990
|
+
*
|
|
2991
|
+
* test('update user settings', {
|
|
2992
|
+
* lock: 'user-settings',
|
|
2993
|
+
* }, async ({ page }) => {
|
|
2994
|
+
* // This test never runs concurrently with other tests
|
|
2995
|
+
* // that declare the 'user-settings' lock.
|
|
2996
|
+
* });
|
|
2997
|
+
* ```
|
|
2998
|
+
*
|
|
2999
|
+
* The built-in `-exclusive-` lock runs the test only when no other tests are running.
|
|
3000
|
+
*
|
|
3001
|
+
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
2890
3002
|
* @param title Test title.
|
|
2891
3003
|
* @param details Additional test details.
|
|
2892
3004
|
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
@@ -3023,6 +3135,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3023
3135
|
* ```
|
|
3024
3136
|
*
|
|
3025
3137
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3138
|
+
*
|
|
3139
|
+
* **Locks**
|
|
3140
|
+
*
|
|
3141
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3142
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3143
|
+
*
|
|
3144
|
+
* ```js
|
|
3145
|
+
* import { test, expect } from '@playwright/test';
|
|
3146
|
+
*
|
|
3147
|
+
* test.describe('two tests with a lock', {
|
|
3148
|
+
* lock: 'user-settings',
|
|
3149
|
+
* }, () => {
|
|
3150
|
+
* test('one', async ({ page }) => {
|
|
3151
|
+
* // ...
|
|
3152
|
+
* });
|
|
3153
|
+
*
|
|
3154
|
+
* test('two', async ({ page }) => {
|
|
3155
|
+
* // ...
|
|
3156
|
+
* });
|
|
3157
|
+
* });
|
|
3158
|
+
* ```
|
|
3159
|
+
*
|
|
3026
3160
|
* @param title Group title.
|
|
3027
3161
|
* @param details Additional details for all tests in the group.
|
|
3028
3162
|
* @param callback A callback that is run immediately when calling
|
|
@@ -3118,6 +3252,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3118
3252
|
* ```
|
|
3119
3253
|
*
|
|
3120
3254
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3255
|
+
*
|
|
3256
|
+
* **Locks**
|
|
3257
|
+
*
|
|
3258
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3259
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3260
|
+
*
|
|
3261
|
+
* ```js
|
|
3262
|
+
* import { test, expect } from '@playwright/test';
|
|
3263
|
+
*
|
|
3264
|
+
* test.describe('two tests with a lock', {
|
|
3265
|
+
* lock: 'user-settings',
|
|
3266
|
+
* }, () => {
|
|
3267
|
+
* test('one', async ({ page }) => {
|
|
3268
|
+
* // ...
|
|
3269
|
+
* });
|
|
3270
|
+
*
|
|
3271
|
+
* test('two', async ({ page }) => {
|
|
3272
|
+
* // ...
|
|
3273
|
+
* });
|
|
3274
|
+
* });
|
|
3275
|
+
* ```
|
|
3276
|
+
*
|
|
3121
3277
|
* @param title Group title.
|
|
3122
3278
|
* @param details Additional details for all tests in the group.
|
|
3123
3279
|
* @param callback A callback that is run immediately when calling
|
|
@@ -3213,6 +3369,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3213
3369
|
* ```
|
|
3214
3370
|
*
|
|
3215
3371
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3372
|
+
*
|
|
3373
|
+
* **Locks**
|
|
3374
|
+
*
|
|
3375
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3376
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3377
|
+
*
|
|
3378
|
+
* ```js
|
|
3379
|
+
* import { test, expect } from '@playwright/test';
|
|
3380
|
+
*
|
|
3381
|
+
* test.describe('two tests with a lock', {
|
|
3382
|
+
* lock: 'user-settings',
|
|
3383
|
+
* }, () => {
|
|
3384
|
+
* test('one', async ({ page }) => {
|
|
3385
|
+
* // ...
|
|
3386
|
+
* });
|
|
3387
|
+
*
|
|
3388
|
+
* test('two', async ({ page }) => {
|
|
3389
|
+
* // ...
|
|
3390
|
+
* });
|
|
3391
|
+
* });
|
|
3392
|
+
* ```
|
|
3393
|
+
*
|
|
3216
3394
|
* @param title Group title.
|
|
3217
3395
|
* @param details Additional details for all tests in the group.
|
|
3218
3396
|
* @param callback A callback that is run immediately when calling
|
|
@@ -3308,6 +3486,28 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
3308
3486
|
* ```
|
|
3309
3487
|
*
|
|
3310
3488
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
3489
|
+
*
|
|
3490
|
+
* **Locks**
|
|
3491
|
+
*
|
|
3492
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
3493
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
3494
|
+
*
|
|
3495
|
+
* ```js
|
|
3496
|
+
* import { test, expect } from '@playwright/test';
|
|
3497
|
+
*
|
|
3498
|
+
* test.describe('two tests with a lock', {
|
|
3499
|
+
* lock: 'user-settings',
|
|
3500
|
+
* }, () => {
|
|
3501
|
+
* test('one', async ({ page }) => {
|
|
3502
|
+
* // ...
|
|
3503
|
+
* });
|
|
3504
|
+
*
|
|
3505
|
+
* test('two', async ({ page }) => {
|
|
3506
|
+
* // ...
|
|
3507
|
+
* });
|
|
3508
|
+
* });
|
|
3509
|
+
* ```
|
|
3510
|
+
*
|
|
3311
3511
|
* @param title Group title.
|
|
3312
3512
|
* @param details Additional details for all tests in the group.
|
|
3313
3513
|
* @param callback A callback that is run immediately when calling
|
|
@@ -4237,6 +4437,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4237
4437
|
* test('runs second', async ({ page }) => {});
|
|
4238
4438
|
* ```
|
|
4239
4439
|
*
|
|
4440
|
+
* - Declaring locks for all tests in a scope.
|
|
4441
|
+
*
|
|
4442
|
+
* ```js
|
|
4443
|
+
* test.describe.configure({ lock: 'user-settings' });
|
|
4444
|
+
* test('update user settings', async ({ page }) => {});
|
|
4445
|
+
* test('reset user settings', async ({ page }) => {});
|
|
4446
|
+
* ```
|
|
4447
|
+
*
|
|
4240
4448
|
* - Run multiple describes in parallel, but tests inside each describe in order.
|
|
4241
4449
|
*
|
|
4242
4450
|
* ```js
|
|
@@ -4257,7 +4465,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4257
4465
|
*
|
|
4258
4466
|
* @param options
|
|
4259
4467
|
*/
|
|
4260
|
-
configure: (options: { mode?: 'default' | 'parallel' | 'serial', retries?: number, timeout?: number }) => void;
|
|
4468
|
+
configure: (options: { mode?: 'default' | 'parallel' | 'serial', retries?: number, timeout?: number, lock?: string | string[] }) => void;
|
|
4261
4469
|
};
|
|
4262
4470
|
|
|
4263
4471
|
/**
|
|
@@ -4275,6 +4483,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4275
4483
|
* - `test.skip(condition, description)`
|
|
4276
4484
|
* - `test.skip(callback, description)`
|
|
4277
4485
|
* - `test.skip()`
|
|
4486
|
+
* - `test.skip(description)`
|
|
4278
4487
|
*
|
|
4279
4488
|
* **Usage**
|
|
4280
4489
|
*
|
|
@@ -4318,14 +4527,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4318
4527
|
* });
|
|
4319
4528
|
* ```
|
|
4320
4529
|
*
|
|
4321
|
-
* You can also call `test.skip()` without
|
|
4322
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4530
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4531
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4323
4532
|
*
|
|
4324
4533
|
* ```js
|
|
4325
4534
|
* import { test, expect } from '@playwright/test';
|
|
4326
4535
|
*
|
|
4327
4536
|
* test('less readable', async ({ page }) => {
|
|
4328
|
-
* test.skip();
|
|
4537
|
+
* test.skip('Not implemented yet');
|
|
4329
4538
|
* // ...
|
|
4330
4539
|
* });
|
|
4331
4540
|
* ```
|
|
@@ -4356,6 +4565,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4356
4565
|
* - `test.skip(condition, description)`
|
|
4357
4566
|
* - `test.skip(callback, description)`
|
|
4358
4567
|
* - `test.skip()`
|
|
4568
|
+
* - `test.skip(description)`
|
|
4359
4569
|
*
|
|
4360
4570
|
* **Usage**
|
|
4361
4571
|
*
|
|
@@ -4399,14 +4609,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4399
4609
|
* });
|
|
4400
4610
|
* ```
|
|
4401
4611
|
*
|
|
4402
|
-
* You can also call `test.skip()` without
|
|
4403
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4612
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4613
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4404
4614
|
*
|
|
4405
4615
|
* ```js
|
|
4406
4616
|
* import { test, expect } from '@playwright/test';
|
|
4407
4617
|
*
|
|
4408
4618
|
* test('less readable', async ({ page }) => {
|
|
4409
|
-
* test.skip();
|
|
4619
|
+
* test.skip('Not implemented yet');
|
|
4410
4620
|
* // ...
|
|
4411
4621
|
* });
|
|
4412
4622
|
* ```
|
|
@@ -4437,6 +4647,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4437
4647
|
* - `test.skip(condition, description)`
|
|
4438
4648
|
* - `test.skip(callback, description)`
|
|
4439
4649
|
* - `test.skip()`
|
|
4650
|
+
* - `test.skip(description)`
|
|
4440
4651
|
*
|
|
4441
4652
|
* **Usage**
|
|
4442
4653
|
*
|
|
@@ -4480,14 +4691,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4480
4691
|
* });
|
|
4481
4692
|
* ```
|
|
4482
4693
|
*
|
|
4483
|
-
* You can also call `test.skip()` without
|
|
4484
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4694
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4695
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4485
4696
|
*
|
|
4486
4697
|
* ```js
|
|
4487
4698
|
* import { test, expect } from '@playwright/test';
|
|
4488
4699
|
*
|
|
4489
4700
|
* test('less readable', async ({ page }) => {
|
|
4490
|
-
* test.skip();
|
|
4701
|
+
* test.skip('Not implemented yet');
|
|
4491
4702
|
* // ...
|
|
4492
4703
|
* });
|
|
4493
4704
|
* ```
|
|
@@ -4518,6 +4729,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4518
4729
|
* - `test.skip(condition, description)`
|
|
4519
4730
|
* - `test.skip(callback, description)`
|
|
4520
4731
|
* - `test.skip()`
|
|
4732
|
+
* - `test.skip(description)`
|
|
4521
4733
|
*
|
|
4522
4734
|
* **Usage**
|
|
4523
4735
|
*
|
|
@@ -4561,14 +4773,96 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4561
4773
|
* });
|
|
4562
4774
|
* ```
|
|
4563
4775
|
*
|
|
4564
|
-
* You can also call `test.skip()` without
|
|
4565
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4776
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4777
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4566
4778
|
*
|
|
4567
4779
|
* ```js
|
|
4568
4780
|
* import { test, expect } from '@playwright/test';
|
|
4569
4781
|
*
|
|
4570
4782
|
* test('less readable', async ({ page }) => {
|
|
4571
|
-
* test.skip();
|
|
4783
|
+
* test.skip('Not implemented yet');
|
|
4784
|
+
* // ...
|
|
4785
|
+
* });
|
|
4786
|
+
* ```
|
|
4787
|
+
*
|
|
4788
|
+
* @param title Test title.
|
|
4789
|
+
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) for test details
|
|
4790
|
+
* description.
|
|
4791
|
+
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
4792
|
+
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
|
4793
|
+
* @param condition Test is marked as "skipped" when the condition is `true`.
|
|
4794
|
+
* @param callback A function that returns whether to mark as "skipped", based on test fixtures. Test or tests are marked as "skipped"
|
|
4795
|
+
* when the return value is `true`.
|
|
4796
|
+
* @param description Optional description that will be reflected in a test report.
|
|
4797
|
+
*/
|
|
4798
|
+
skip(description: string): void;
|
|
4799
|
+
/**
|
|
4800
|
+
* Skip a test. Playwright will not run the test past the `test.skip()` call.
|
|
4801
|
+
*
|
|
4802
|
+
* Skipped tests are not supposed to be ever run. If you intend to fix the test, use
|
|
4803
|
+
* [test.fixme([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fixme)
|
|
4804
|
+
* instead.
|
|
4805
|
+
*
|
|
4806
|
+
* To declare a skipped test:
|
|
4807
|
+
* - `test.skip(title, body)`
|
|
4808
|
+
* - `test.skip(title, details, body)`
|
|
4809
|
+
*
|
|
4810
|
+
* To skip a test at runtime:
|
|
4811
|
+
* - `test.skip(condition, description)`
|
|
4812
|
+
* - `test.skip(callback, description)`
|
|
4813
|
+
* - `test.skip()`
|
|
4814
|
+
* - `test.skip(description)`
|
|
4815
|
+
*
|
|
4816
|
+
* **Usage**
|
|
4817
|
+
*
|
|
4818
|
+
* You can declare a skipped test, and Playwright will not run it.
|
|
4819
|
+
*
|
|
4820
|
+
* ```js
|
|
4821
|
+
* import { test, expect } from '@playwright/test';
|
|
4822
|
+
*
|
|
4823
|
+
* test.skip('never run', async ({ page }) => {
|
|
4824
|
+
* // ...
|
|
4825
|
+
* });
|
|
4826
|
+
* ```
|
|
4827
|
+
*
|
|
4828
|
+
* If your test should be skipped in some configurations, but not all, you can skip the test inside the test body
|
|
4829
|
+
* based on some condition. We recommend passing a `description` argument in this case. Playwright will run the test,
|
|
4830
|
+
* but abort it immediately after the `test.skip` call.
|
|
4831
|
+
*
|
|
4832
|
+
* ```js
|
|
4833
|
+
* import { test, expect } from '@playwright/test';
|
|
4834
|
+
*
|
|
4835
|
+
* test('Safari-only test', async ({ page, browserName }) => {
|
|
4836
|
+
* test.skip(browserName !== 'webkit', 'This feature is Safari-only');
|
|
4837
|
+
* // ...
|
|
4838
|
+
* });
|
|
4839
|
+
* ```
|
|
4840
|
+
*
|
|
4841
|
+
* You can skip all tests in a file or
|
|
4842
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group based
|
|
4843
|
+
* on some condition with a single `test.skip(callback, description)` call.
|
|
4844
|
+
*
|
|
4845
|
+
* ```js
|
|
4846
|
+
* import { test, expect } from '@playwright/test';
|
|
4847
|
+
*
|
|
4848
|
+
* test.skip(({ browserName }) => browserName !== 'webkit', 'Safari-only');
|
|
4849
|
+
*
|
|
4850
|
+
* test('Safari-only test 1', async ({ page }) => {
|
|
4851
|
+
* // ...
|
|
4852
|
+
* });
|
|
4853
|
+
* test('Safari-only test 2', async ({ page }) => {
|
|
4854
|
+
* // ...
|
|
4855
|
+
* });
|
|
4856
|
+
* ```
|
|
4857
|
+
*
|
|
4858
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4859
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4860
|
+
*
|
|
4861
|
+
* ```js
|
|
4862
|
+
* import { test, expect } from '@playwright/test';
|
|
4863
|
+
*
|
|
4864
|
+
* test('less readable', async ({ page }) => {
|
|
4865
|
+
* test.skip('Not implemented yet');
|
|
4572
4866
|
* // ...
|
|
4573
4867
|
* });
|
|
4574
4868
|
* ```
|
|
@@ -4599,6 +4893,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4599
4893
|
* - `test.skip(condition, description)`
|
|
4600
4894
|
* - `test.skip(callback, description)`
|
|
4601
4895
|
* - `test.skip()`
|
|
4896
|
+
* - `test.skip(description)`
|
|
4602
4897
|
*
|
|
4603
4898
|
* **Usage**
|
|
4604
4899
|
*
|
|
@@ -4642,14 +4937,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4642
4937
|
* });
|
|
4643
4938
|
* ```
|
|
4644
4939
|
*
|
|
4645
|
-
* You can also call `test.skip()` without
|
|
4646
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4940
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4941
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4647
4942
|
*
|
|
4648
4943
|
* ```js
|
|
4649
4944
|
* import { test, expect } from '@playwright/test';
|
|
4650
4945
|
*
|
|
4651
4946
|
* test('less readable', async ({ page }) => {
|
|
4652
|
-
* test.skip();
|
|
4947
|
+
* test.skip('Not implemented yet');
|
|
4653
4948
|
* // ...
|
|
4654
4949
|
* });
|
|
4655
4950
|
* ```
|
|
@@ -4678,6 +4973,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4678
4973
|
* - `test.fixme(condition, description)`
|
|
4679
4974
|
* - `test.fixme(callback, description)`
|
|
4680
4975
|
* - `test.fixme()`
|
|
4976
|
+
* - `test.fixme(description)`
|
|
4681
4977
|
*
|
|
4682
4978
|
* **Usage**
|
|
4683
4979
|
*
|
|
@@ -4721,8 +5017,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4721
5017
|
* });
|
|
4722
5018
|
* ```
|
|
4723
5019
|
*
|
|
4724
|
-
* You can also call `test.fixme()` without
|
|
4725
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5020
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5021
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
4726
5022
|
*
|
|
4727
5023
|
* ```js
|
|
4728
5024
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4756,6 +5052,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4756
5052
|
* - `test.fixme(condition, description)`
|
|
4757
5053
|
* - `test.fixme(callback, description)`
|
|
4758
5054
|
* - `test.fixme()`
|
|
5055
|
+
* - `test.fixme(description)`
|
|
4759
5056
|
*
|
|
4760
5057
|
* **Usage**
|
|
4761
5058
|
*
|
|
@@ -4799,8 +5096,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4799
5096
|
* });
|
|
4800
5097
|
* ```
|
|
4801
5098
|
*
|
|
4802
|
-
* You can also call `test.fixme()` without
|
|
4803
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5099
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5100
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
4804
5101
|
*
|
|
4805
5102
|
* ```js
|
|
4806
5103
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4834,6 +5131,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4834
5131
|
* - `test.fixme(condition, description)`
|
|
4835
5132
|
* - `test.fixme(callback, description)`
|
|
4836
5133
|
* - `test.fixme()`
|
|
5134
|
+
* - `test.fixme(description)`
|
|
4837
5135
|
*
|
|
4838
5136
|
* **Usage**
|
|
4839
5137
|
*
|
|
@@ -4877,8 +5175,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4877
5175
|
* });
|
|
4878
5176
|
* ```
|
|
4879
5177
|
*
|
|
4880
|
-
* You can also call `test.fixme()` without
|
|
4881
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5178
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5179
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
4882
5180
|
*
|
|
4883
5181
|
* ```js
|
|
4884
5182
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4912,6 +5210,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4912
5210
|
* - `test.fixme(condition, description)`
|
|
4913
5211
|
* - `test.fixme(callback, description)`
|
|
4914
5212
|
* - `test.fixme()`
|
|
5213
|
+
* - `test.fixme(description)`
|
|
4915
5214
|
*
|
|
4916
5215
|
* **Usage**
|
|
4917
5216
|
*
|
|
@@ -4955,8 +5254,87 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4955
5254
|
* });
|
|
4956
5255
|
* ```
|
|
4957
5256
|
*
|
|
4958
|
-
* You can also call `test.fixme()` without
|
|
4959
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5257
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5258
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5259
|
+
*
|
|
5260
|
+
* ```js
|
|
5261
|
+
* import { test, expect } from '@playwright/test';
|
|
5262
|
+
*
|
|
5263
|
+
* test('less readable', async ({ page }) => {
|
|
5264
|
+
* test.fixme();
|
|
5265
|
+
* // ...
|
|
5266
|
+
* });
|
|
5267
|
+
* ```
|
|
5268
|
+
*
|
|
5269
|
+
* @param title Test title.
|
|
5270
|
+
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) for test details
|
|
5271
|
+
* description.
|
|
5272
|
+
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
5273
|
+
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
|
5274
|
+
* @param condition Test is marked as "fixme" when the condition is `true`.
|
|
5275
|
+
* @param callback A function that returns whether to mark as "fixme", based on test fixtures. Test or tests are marked as "fixme"
|
|
5276
|
+
* when the return value is `true`.
|
|
5277
|
+
* @param description Optional description that will be reflected in a test report.
|
|
5278
|
+
*/
|
|
5279
|
+
fixme(description: string): void;
|
|
5280
|
+
/**
|
|
5281
|
+
* Mark a test as "fixme", with the intention to fix it. Playwright will not run the test past the `test.fixme()`
|
|
5282
|
+
* call.
|
|
5283
|
+
*
|
|
5284
|
+
* To declare a "fixme" test:
|
|
5285
|
+
* - `test.fixme(title, body)`
|
|
5286
|
+
* - `test.fixme(title, details, body)`
|
|
5287
|
+
*
|
|
5288
|
+
* To annotate test as "fixme" at runtime:
|
|
5289
|
+
* - `test.fixme(condition, description)`
|
|
5290
|
+
* - `test.fixme(callback, description)`
|
|
5291
|
+
* - `test.fixme()`
|
|
5292
|
+
* - `test.fixme(description)`
|
|
5293
|
+
*
|
|
5294
|
+
* **Usage**
|
|
5295
|
+
*
|
|
5296
|
+
* You can declare a test as to be fixed, and Playwright will not run it.
|
|
5297
|
+
*
|
|
5298
|
+
* ```js
|
|
5299
|
+
* import { test, expect } from '@playwright/test';
|
|
5300
|
+
*
|
|
5301
|
+
* test.fixme('to be fixed', async ({ page }) => {
|
|
5302
|
+
* // ...
|
|
5303
|
+
* });
|
|
5304
|
+
* ```
|
|
5305
|
+
*
|
|
5306
|
+
* If your test should be fixed in some configurations, but not all, you can mark the test as "fixme" inside the test
|
|
5307
|
+
* body based on some condition. We recommend passing a `description` argument in this case. Playwright will run the
|
|
5308
|
+
* test, but abort it immediately after the `test.fixme` call.
|
|
5309
|
+
*
|
|
5310
|
+
* ```js
|
|
5311
|
+
* import { test, expect } from '@playwright/test';
|
|
5312
|
+
*
|
|
5313
|
+
* test('to be fixed in Safari', async ({ page, browserName }) => {
|
|
5314
|
+
* test.fixme(browserName === 'webkit', 'This feature breaks in Safari for some reason');
|
|
5315
|
+
* // ...
|
|
5316
|
+
* });
|
|
5317
|
+
* ```
|
|
5318
|
+
*
|
|
5319
|
+
* You can mark all tests in a file or
|
|
5320
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
|
5321
|
+
* "fixme" based on some condition with a single `test.fixme(callback, description)` call.
|
|
5322
|
+
*
|
|
5323
|
+
* ```js
|
|
5324
|
+
* import { test, expect } from '@playwright/test';
|
|
5325
|
+
*
|
|
5326
|
+
* test.fixme(({ browserName }) => browserName === 'webkit', 'Should figure out the issue');
|
|
5327
|
+
*
|
|
5328
|
+
* test('to be fixed in Safari 1', async ({ page }) => {
|
|
5329
|
+
* // ...
|
|
5330
|
+
* });
|
|
5331
|
+
* test('to be fixed in Safari 2', async ({ page }) => {
|
|
5332
|
+
* // ...
|
|
5333
|
+
* });
|
|
5334
|
+
* ```
|
|
5335
|
+
*
|
|
5336
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5337
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
4960
5338
|
*
|
|
4961
5339
|
* ```js
|
|
4962
5340
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4990,6 +5368,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4990
5368
|
* - `test.fixme(condition, description)`
|
|
4991
5369
|
* - `test.fixme(callback, description)`
|
|
4992
5370
|
* - `test.fixme()`
|
|
5371
|
+
* - `test.fixme(description)`
|
|
4993
5372
|
*
|
|
4994
5373
|
* **Usage**
|
|
4995
5374
|
*
|
|
@@ -5033,8 +5412,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5033
5412
|
* });
|
|
5034
5413
|
* ```
|
|
5035
5414
|
*
|
|
5036
|
-
* You can also call `test.fixme()` without
|
|
5037
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5415
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5416
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5038
5417
|
*
|
|
5039
5418
|
* ```js
|
|
5040
5419
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5069,6 +5448,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5069
5448
|
* - `test.fail(condition, description)`
|
|
5070
5449
|
* - `test.fail(callback, description)`
|
|
5071
5450
|
* - `test.fail()`
|
|
5451
|
+
* - `test.fail(description)`
|
|
5072
5452
|
*
|
|
5073
5453
|
* **Usage**
|
|
5074
5454
|
*
|
|
@@ -5111,8 +5491,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5111
5491
|
* });
|
|
5112
5492
|
* ```
|
|
5113
5493
|
*
|
|
5114
|
-
* You can also call `test.fail()` without
|
|
5115
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5494
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5495
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5116
5496
|
*
|
|
5117
5497
|
* ```js
|
|
5118
5498
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5146,6 +5526,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5146
5526
|
* - `test.fail(condition, description)`
|
|
5147
5527
|
* - `test.fail(callback, description)`
|
|
5148
5528
|
* - `test.fail()`
|
|
5529
|
+
* - `test.fail(description)`
|
|
5149
5530
|
*
|
|
5150
5531
|
* **Usage**
|
|
5151
5532
|
*
|
|
@@ -5188,8 +5569,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5188
5569
|
* });
|
|
5189
5570
|
* ```
|
|
5190
5571
|
*
|
|
5191
|
-
* You can also call `test.fail()` without
|
|
5192
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5572
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5573
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5193
5574
|
*
|
|
5194
5575
|
* ```js
|
|
5195
5576
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5223,6 +5604,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5223
5604
|
* - `test.fail(condition, description)`
|
|
5224
5605
|
* - `test.fail(callback, description)`
|
|
5225
5606
|
* - `test.fail()`
|
|
5607
|
+
* - `test.fail(description)`
|
|
5226
5608
|
*
|
|
5227
5609
|
* **Usage**
|
|
5228
5610
|
*
|
|
@@ -5265,8 +5647,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5265
5647
|
* });
|
|
5266
5648
|
* ```
|
|
5267
5649
|
*
|
|
5268
|
-
* You can also call `test.fail()` without
|
|
5269
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5650
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5651
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5270
5652
|
*
|
|
5271
5653
|
* ```js
|
|
5272
5654
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5300,6 +5682,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5300
5682
|
* - `test.fail(condition, description)`
|
|
5301
5683
|
* - `test.fail(callback, description)`
|
|
5302
5684
|
* - `test.fail()`
|
|
5685
|
+
* - `test.fail(description)`
|
|
5303
5686
|
*
|
|
5304
5687
|
* **Usage**
|
|
5305
5688
|
*
|
|
@@ -5342,8 +5725,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5342
5725
|
* });
|
|
5343
5726
|
* ```
|
|
5344
5727
|
*
|
|
5345
|
-
* You can also call `test.fail()` without
|
|
5346
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5728
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5729
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5347
5730
|
*
|
|
5348
5731
|
* ```js
|
|
5349
5732
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5377,6 +5760,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5377
5760
|
* - `test.fail(condition, description)`
|
|
5378
5761
|
* - `test.fail(callback, description)`
|
|
5379
5762
|
* - `test.fail()`
|
|
5763
|
+
* - `test.fail(description)`
|
|
5380
5764
|
*
|
|
5381
5765
|
* **Usage**
|
|
5382
5766
|
*
|
|
@@ -5419,8 +5803,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5419
5803
|
* });
|
|
5420
5804
|
* ```
|
|
5421
5805
|
*
|
|
5422
|
-
* You can also call `test.fail()` without
|
|
5423
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5806
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5807
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5424
5808
|
*
|
|
5425
5809
|
* ```js
|
|
5426
5810
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5454,6 +5838,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5454
5838
|
* - `test.fail(condition, description)`
|
|
5455
5839
|
* - `test.fail(callback, description)`
|
|
5456
5840
|
* - `test.fail()`
|
|
5841
|
+
* - `test.fail(description)`
|
|
5457
5842
|
*
|
|
5458
5843
|
* **Usage**
|
|
5459
5844
|
*
|
|
@@ -5496,8 +5881,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5496
5881
|
* });
|
|
5497
5882
|
* ```
|
|
5498
5883
|
*
|
|
5499
|
-
* You can also call `test.fail()` without
|
|
5500
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5884
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5885
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5501
5886
|
*
|
|
5502
5887
|
* ```js
|
|
5503
5888
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5519,6 +5904,84 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5519
5904
|
* @param description Optional description that will be reflected in a test report.
|
|
5520
5905
|
*/
|
|
5521
5906
|
(): void;
|
|
5907
|
+
/**
|
|
5908
|
+
* Marks a test as "should fail". Playwright runs this test and ensures that it is actually failing. This is useful
|
|
5909
|
+
* for documentation purposes to acknowledge that some functionality is broken until it is fixed.
|
|
5910
|
+
*
|
|
5911
|
+
* To declare a "failing" test:
|
|
5912
|
+
* - `test.fail(title, body)`
|
|
5913
|
+
* - `test.fail(title, details, body)`
|
|
5914
|
+
*
|
|
5915
|
+
* To annotate test as "failing" at runtime:
|
|
5916
|
+
* - `test.fail(condition, description)`
|
|
5917
|
+
* - `test.fail(callback, description)`
|
|
5918
|
+
* - `test.fail()`
|
|
5919
|
+
* - `test.fail(description)`
|
|
5920
|
+
*
|
|
5921
|
+
* **Usage**
|
|
5922
|
+
*
|
|
5923
|
+
* You can declare a test as failing, so that Playwright ensures it actually fails.
|
|
5924
|
+
*
|
|
5925
|
+
* ```js
|
|
5926
|
+
* import { test, expect } from '@playwright/test';
|
|
5927
|
+
*
|
|
5928
|
+
* test.fail('not yet ready', async ({ page }) => {
|
|
5929
|
+
* // ...
|
|
5930
|
+
* });
|
|
5931
|
+
* ```
|
|
5932
|
+
*
|
|
5933
|
+
* If your test fails in some configurations, but not all, you can mark the test as failing inside the test body based
|
|
5934
|
+
* on some condition. We recommend passing a `description` argument in this case.
|
|
5935
|
+
*
|
|
5936
|
+
* ```js
|
|
5937
|
+
* import { test, expect } from '@playwright/test';
|
|
5938
|
+
*
|
|
5939
|
+
* test('fail in WebKit', async ({ page, browserName }) => {
|
|
5940
|
+
* test.fail(browserName === 'webkit', 'This feature is not implemented for Mac yet');
|
|
5941
|
+
* // ...
|
|
5942
|
+
* });
|
|
5943
|
+
* ```
|
|
5944
|
+
*
|
|
5945
|
+
* You can mark all tests in a file or
|
|
5946
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
|
5947
|
+
* "should fail" based on some condition with a single `test.fail(callback, description)` call.
|
|
5948
|
+
*
|
|
5949
|
+
* ```js
|
|
5950
|
+
* import { test, expect } from '@playwright/test';
|
|
5951
|
+
*
|
|
5952
|
+
* test.fail(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
|
5953
|
+
*
|
|
5954
|
+
* test('fail in WebKit 1', async ({ page }) => {
|
|
5955
|
+
* // ...
|
|
5956
|
+
* });
|
|
5957
|
+
* test('fail in WebKit 2', async ({ page }) => {
|
|
5958
|
+
* // ...
|
|
5959
|
+
* });
|
|
5960
|
+
* ```
|
|
5961
|
+
*
|
|
5962
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5963
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5964
|
+
*
|
|
5965
|
+
* ```js
|
|
5966
|
+
* import { test, expect } from '@playwright/test';
|
|
5967
|
+
*
|
|
5968
|
+
* test('less readable', async ({ page }) => {
|
|
5969
|
+
* test.fail();
|
|
5970
|
+
* // ...
|
|
5971
|
+
* });
|
|
5972
|
+
* ```
|
|
5973
|
+
*
|
|
5974
|
+
* @param title Test title.
|
|
5975
|
+
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) for test details
|
|
5976
|
+
* description.
|
|
5977
|
+
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
5978
|
+
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
|
5979
|
+
* @param condition Test is marked as "should fail" when the condition is `true`.
|
|
5980
|
+
* @param callback A function that returns whether to mark as "should fail", based on test fixtures. Test or tests are marked as
|
|
5981
|
+
* "should fail" when the return value is `true`.
|
|
5982
|
+
* @param description Optional description that will be reflected in a test report.
|
|
5983
|
+
*/
|
|
5984
|
+
(description: string): void;
|
|
5522
5985
|
|
|
5523
5986
|
/**
|
|
5524
5987
|
* You can use `test.fail.only` to focus on a specific test that is expected to fail. This is particularly useful when
|
|
@@ -5612,6 +6075,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5612
6075
|
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
5613
6076
|
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
5614
6077
|
* - `test.slow()`
|
|
6078
|
+
* - `test.slow(description)`
|
|
5615
6079
|
* - `test.slow(condition, description)`
|
|
5616
6080
|
* - `test.slow(callback, description)`
|
|
5617
6081
|
*
|
|
@@ -5670,6 +6134,66 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5670
6134
|
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
5671
6135
|
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
5672
6136
|
* - `test.slow()`
|
|
6137
|
+
* - `test.slow(description)`
|
|
6138
|
+
* - `test.slow(condition, description)`
|
|
6139
|
+
* - `test.slow(callback, description)`
|
|
6140
|
+
*
|
|
6141
|
+
* **Usage**
|
|
6142
|
+
*
|
|
6143
|
+
* You can mark a test as slow by calling `test.slow()` inside the test body.
|
|
6144
|
+
*
|
|
6145
|
+
* ```js
|
|
6146
|
+
* import { test, expect } from '@playwright/test';
|
|
6147
|
+
*
|
|
6148
|
+
* test('slow test', async ({ page }) => {
|
|
6149
|
+
* test.slow();
|
|
6150
|
+
* // ...
|
|
6151
|
+
* });
|
|
6152
|
+
* ```
|
|
6153
|
+
*
|
|
6154
|
+
* If your test is slow in some configurations, but not all, you can mark it as slow based on a condition. We
|
|
6155
|
+
* recommend passing a `description` argument in this case.
|
|
6156
|
+
*
|
|
6157
|
+
* ```js
|
|
6158
|
+
* import { test, expect } from '@playwright/test';
|
|
6159
|
+
*
|
|
6160
|
+
* test('slow in Safari', async ({ page, browserName }) => {
|
|
6161
|
+
* test.slow(browserName === 'webkit', 'This feature is slow in Safari');
|
|
6162
|
+
* // ...
|
|
6163
|
+
* });
|
|
6164
|
+
* ```
|
|
6165
|
+
*
|
|
6166
|
+
* You can mark all tests in a file or
|
|
6167
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
|
6168
|
+
* "slow" based on some condition by passing a callback.
|
|
6169
|
+
*
|
|
6170
|
+
* ```js
|
|
6171
|
+
* import { test, expect } from '@playwright/test';
|
|
6172
|
+
*
|
|
6173
|
+
* test.slow(({ browserName }) => browserName === 'webkit', 'all tests are slow in Safari');
|
|
6174
|
+
*
|
|
6175
|
+
* test('slow in Safari 1', async ({ page }) => {
|
|
6176
|
+
* // ...
|
|
6177
|
+
* });
|
|
6178
|
+
* test('fail in Safari 2', async ({ page }) => {
|
|
6179
|
+
* // ...
|
|
6180
|
+
* });
|
|
6181
|
+
* ```
|
|
6182
|
+
*
|
|
6183
|
+
* @param condition Test is marked as "slow" when the condition is `true`.
|
|
6184
|
+
* @param callback A function that returns whether to mark as "slow", based on test fixtures. Test or tests are marked as "slow" when
|
|
6185
|
+
* the return value is `true`.
|
|
6186
|
+
* @param description Optional description that will be reflected in a test report.
|
|
6187
|
+
*/
|
|
6188
|
+
slow(description: string): void;
|
|
6189
|
+
/**
|
|
6190
|
+
* Marks a test as "slow". Slow test will be given triple the default timeout.
|
|
6191
|
+
*
|
|
6192
|
+
* Note that [test.slow([condition, callback, description])](https://playwright.dev/docs/api/class-test#test-slow)
|
|
6193
|
+
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
6194
|
+
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
6195
|
+
* - `test.slow()`
|
|
6196
|
+
* - `test.slow(description)`
|
|
5673
6197
|
* - `test.slow(condition, description)`
|
|
5674
6198
|
* - `test.slow(callback, description)`
|
|
5675
6199
|
*
|
|
@@ -5728,6 +6252,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5728
6252
|
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
5729
6253
|
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
5730
6254
|
* - `test.slow()`
|
|
6255
|
+
* - `test.slow(description)`
|
|
5731
6256
|
* - `test.slow(condition, description)`
|
|
5732
6257
|
* - `test.slow(callback, description)`
|
|
5733
6258
|
*
|
|
@@ -6593,7 +7118,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
6593
7118
|
* @param body Step body.
|
|
6594
7119
|
* @param options
|
|
6595
7120
|
*/
|
|
6596
|
-
<T>(title: string, body: (step: TestStepInfo) => T | Promise<T>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<T>;
|
|
7121
|
+
<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
7122
|
/**
|
|
6598
7123
|
* Mark a test step as "skip" to temporarily disable its execution, useful for steps that are currently failing and
|
|
6599
7124
|
* planned for a near-term fix. Playwright will not run the step. See also
|
|
@@ -6621,7 +7146,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
6621
7146
|
* @param body Step body.
|
|
6622
7147
|
* @param options
|
|
6623
7148
|
*/
|
|
6624
|
-
skip(title: string, body: (step: TestStepInfo) => any | Promise<any>, options?: { box?: boolean, location?: Location, timeout?: number }): Promise<void>;
|
|
7149
|
+
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
7150
|
}
|
|
6626
7151
|
/**
|
|
6627
7152
|
* `expect` function can be used to create test assertions. Read more about [test assertions](https://playwright.dev/docs/test-assertions).
|
|
@@ -6741,6 +7266,9 @@ export type Fixtures<T extends {} = {}, W extends {} = {}, PT extends {} = {}, P
|
|
|
6741
7266
|
type BrowserName = 'chromium' | 'firefox' | 'webkit';
|
|
6742
7267
|
type BrowserChannel = Exclude<LaunchOptions['channel'], undefined>;
|
|
6743
7268
|
type ColorScheme = Exclude<BrowserContextOptions['colorScheme'], undefined>;
|
|
7269
|
+
type Contrast = Exclude<BrowserContextOptions['contrast'], undefined>;
|
|
7270
|
+
type ForcedColors = Exclude<BrowserContextOptions['forcedColors'], undefined>;
|
|
7271
|
+
type ReducedMotion = Exclude<BrowserContextOptions['reducedMotion'], undefined>;
|
|
6744
7272
|
type ClientCertificate = Exclude<BrowserContextOptions['clientCertificates'], undefined>[0];
|
|
6745
7273
|
type ExtraHTTPHeaders = Exclude<BrowserContextOptions['extraHTTPHeaders'], undefined>;
|
|
6746
7274
|
type Proxy = Exclude<BrowserContextOptions['proxy'], undefined>;
|
|
@@ -6939,9 +7467,7 @@ export interface PlaywrightWorkerOptions {
|
|
|
6939
7467
|
* [fixtures.browser](https://playwright.dev/docs/api/class-fixtures#fixtures-browser),
|
|
6940
7468
|
* [fixtures.context](https://playwright.dev/docs/api/class-fixtures#fixtures-context) and
|
|
6941
7469
|
* [fixtures.page](https://playwright.dev/docs/api/class-fixtures#fixtures-page) use the remote browser instead of
|
|
6942
|
-
* launching a browser locally
|
|
6943
|
-
* [testOptions.headless](https://playwright.dev/docs/api/class-testoptions#test-options-headless) or
|
|
6944
|
-
* [testOptions.channel](https://playwright.dev/docs/api/class-testoptions#test-options-channel) are ignored.
|
|
7470
|
+
* launching a browser locally.
|
|
6945
7471
|
*/
|
|
6946
7472
|
connectOptions: ConnectOptions | undefined;
|
|
6947
7473
|
/**
|
|
@@ -7056,7 +7582,7 @@ export interface PlaywrightWorkerOptions {
|
|
|
7056
7582
|
*
|
|
7057
7583
|
* Learn more about [recording trace](https://playwright.dev/docs/test-use-options#recording-options).
|
|
7058
7584
|
*/
|
|
7059
|
-
trace: TraceMode | /** deprecated */ 'retry-with-trace' | { mode: TraceMode, snapshots?: boolean, screenshots?: boolean, sources?: boolean, attachments?: boolean };
|
|
7585
|
+
trace: TraceMode | /** deprecated */ 'retry-with-trace' | { mode: TraceMode, snapshots?: boolean | { dom?: boolean, aria?: boolean, screen?: boolean }, screenshots?: boolean, sources?: boolean, attachments?: boolean };
|
|
7060
7586
|
/**
|
|
7061
7587
|
* Whether to record video for each test. Defaults to `'off'`. The initial run of a test is the "first run";
|
|
7062
7588
|
* subsequent runs caused by [retries](https://playwright.dev/docs/test-retries) are "retries".
|
|
@@ -7079,9 +7605,13 @@ export interface PlaywrightWorkerOptions {
|
|
|
7079
7605
|
* down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual
|
|
7080
7606
|
* picture of each page will be scaled down if necessary to fit the specified size.
|
|
7081
7607
|
*
|
|
7082
|
-
* To
|
|
7083
|
-
*
|
|
7084
|
-
*
|
|
7608
|
+
* To record smoother video of animations and scrolling, pass `fps`, for example `{ mode: 'on', size: { width: 1920,
|
|
7609
|
+
* height: 1080 }, fps: 60 }`. Higher frame rates and sizes use more CPU for encoding. Firefox and WebKit currently
|
|
7610
|
+
* capture up to 25 frames per second.
|
|
7611
|
+
*
|
|
7612
|
+
* To annotate actions in the video, pass `show` with `actions` and/or `test` sub-options. The `actions` option
|
|
7613
|
+
* controls visual highlights on interacted elements, each shown for an optional `duration` in milliseconds (defaults
|
|
7614
|
+
* to `500`). The `test` option controls which test information is displayed as a status overlay.
|
|
7085
7615
|
*
|
|
7086
7616
|
* **Usage**
|
|
7087
7617
|
*
|
|
@@ -7098,7 +7628,7 @@ export interface PlaywrightWorkerOptions {
|
|
|
7098
7628
|
*
|
|
7099
7629
|
* Learn more about [recording video](https://playwright.dev/docs/test-use-options#recording-options).
|
|
7100
7630
|
*/
|
|
7101
|
-
video: VideoMode | /** deprecated */ 'retry-with-video' | { mode: VideoMode, size?: ViewportSize, show?: { actions?: { duration?: number, position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number, cursor?: 'none' | 'pointer' }, test?: { level?: 'file' | 'title' | 'step', position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number } } };
|
|
7631
|
+
video: VideoMode | /** deprecated */ 'retry-with-video' | { mode: VideoMode, size?: ViewportSize, fps?: number, show?: { actions?: { duration?: number, position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', /** @deprecated Use `style.title` instead. */ fontSize?: number, cursor?: 'none' | 'pointer', style?: { point?: string, highlight?: string, title?: string } }, test?: { level?: 'file' | 'title' | 'step', position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number } } };
|
|
7102
7632
|
}
|
|
7103
7633
|
|
|
7104
7634
|
export type ScreenshotMode = 'off' | 'on' | 'only-on-failure' | 'on-first-failure';
|
|
@@ -7200,6 +7730,26 @@ export interface PlaywrightTestOptions {
|
|
|
7200
7730
|
*
|
|
7201
7731
|
*/
|
|
7202
7732
|
colorScheme: ColorScheme;
|
|
7733
|
+
/**
|
|
7734
|
+
* Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
|
|
7735
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
7736
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
|
|
7737
|
+
*
|
|
7738
|
+
* **Usage**
|
|
7739
|
+
*
|
|
7740
|
+
* ```js
|
|
7741
|
+
* // playwright.config.ts
|
|
7742
|
+
* import { defineConfig } from '@playwright/test';
|
|
7743
|
+
*
|
|
7744
|
+
* export default defineConfig({
|
|
7745
|
+
* use: {
|
|
7746
|
+
* contrast: 'more',
|
|
7747
|
+
* },
|
|
7748
|
+
* });
|
|
7749
|
+
* ```
|
|
7750
|
+
*
|
|
7751
|
+
*/
|
|
7752
|
+
contrast: Contrast;
|
|
7203
7753
|
/**
|
|
7204
7754
|
* TLS Client Authentication allows the server to request a client certificate and verify it.
|
|
7205
7755
|
*
|
|
@@ -7277,6 +7827,26 @@ export interface PlaywrightTestOptions {
|
|
|
7277
7827
|
*
|
|
7278
7828
|
*/
|
|
7279
7829
|
extraHTTPHeaders: ExtraHTTPHeaders | undefined;
|
|
7830
|
+
/**
|
|
7831
|
+
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
|
7832
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
7833
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'none'`.
|
|
7834
|
+
*
|
|
7835
|
+
* **Usage**
|
|
7836
|
+
*
|
|
7837
|
+
* ```js
|
|
7838
|
+
* // playwright.config.ts
|
|
7839
|
+
* import { defineConfig } from '@playwright/test';
|
|
7840
|
+
*
|
|
7841
|
+
* export default defineConfig({
|
|
7842
|
+
* use: {
|
|
7843
|
+
* forcedColors: 'active',
|
|
7844
|
+
* },
|
|
7845
|
+
* });
|
|
7846
|
+
* ```
|
|
7847
|
+
*
|
|
7848
|
+
*/
|
|
7849
|
+
forcedColors: ForcedColors;
|
|
7280
7850
|
/**
|
|
7281
7851
|
* **Usage**
|
|
7282
7852
|
*
|
|
@@ -7317,6 +7887,9 @@ export interface PlaywrightTestOptions {
|
|
|
7317
7887
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
|
7318
7888
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
|
7319
7889
|
*
|
|
7890
|
+
* Pass an array to use different credentials for different origins. The first entry that matches the request origin
|
|
7891
|
+
* is used, and entries with no origin match any request.
|
|
7892
|
+
*
|
|
7320
7893
|
* **Usage**
|
|
7321
7894
|
*
|
|
7322
7895
|
* ```js
|
|
@@ -7333,8 +7906,21 @@ export interface PlaywrightTestOptions {
|
|
|
7333
7906
|
* });
|
|
7334
7907
|
* ```
|
|
7335
7908
|
*
|
|
7909
|
+
* When passing an array of credentials to [test.use(options)](https://playwright.dev/docs/api/class-test#test-use),
|
|
7910
|
+
* wrap it into an extra array, see [fixture options](https://playwright.dev/docs/test-fixtures#fixtures-options).
|
|
7911
|
+
*
|
|
7912
|
+
* ```js
|
|
7913
|
+
* // example.spec.ts
|
|
7914
|
+
* test.use({
|
|
7915
|
+
* httpCredentials: [[
|
|
7916
|
+
* { username: 'alice', password: 'alice-pass', origin: 'https://a.example.com' },
|
|
7917
|
+
* { username: 'bob', password: 'bob-pass', origin: 'https://b.example.com' },
|
|
7918
|
+
* ], { scope: 'test' }],
|
|
7919
|
+
* });
|
|
7920
|
+
* ```
|
|
7921
|
+
*
|
|
7336
7922
|
*/
|
|
7337
|
-
httpCredentials: HTTPCredentials | undefined;
|
|
7923
|
+
httpCredentials: HTTPCredentials | HTTPCredentials[] | undefined;
|
|
7338
7924
|
/**
|
|
7339
7925
|
* Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.
|
|
7340
7926
|
*
|
|
@@ -7355,8 +7941,8 @@ export interface PlaywrightTestOptions {
|
|
|
7355
7941
|
ignoreHTTPSErrors: boolean;
|
|
7356
7942
|
/**
|
|
7357
7943
|
* Whether the `meta viewport` tag is taken into account and touch events are enabled. isMobile is a part of device,
|
|
7358
|
-
* so you don't actually need to set it manually. Defaults to `false
|
|
7359
|
-
*
|
|
7944
|
+
* so you don't actually need to set it manually. Defaults to `false`. Learn more about
|
|
7945
|
+
* [mobile emulation](https://playwright.dev/docs/emulation#ismobile).
|
|
7360
7946
|
*
|
|
7361
7947
|
* **Usage**
|
|
7362
7948
|
*
|
|
@@ -7472,6 +8058,46 @@ export interface PlaywrightTestOptions {
|
|
|
7472
8058
|
*
|
|
7473
8059
|
*/
|
|
7474
8060
|
proxy: Proxy | undefined;
|
|
8061
|
+
/**
|
|
8062
|
+
* Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See
|
|
8063
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
8064
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
|
|
8065
|
+
*
|
|
8066
|
+
* **Usage**
|
|
8067
|
+
*
|
|
8068
|
+
* ```js
|
|
8069
|
+
* // playwright.config.ts
|
|
8070
|
+
* import { defineConfig } from '@playwright/test';
|
|
8071
|
+
*
|
|
8072
|
+
* export default defineConfig({
|
|
8073
|
+
* use: {
|
|
8074
|
+
* reducedMotion: 'reduce',
|
|
8075
|
+
* },
|
|
8076
|
+
* });
|
|
8077
|
+
* ```
|
|
8078
|
+
*
|
|
8079
|
+
*/
|
|
8080
|
+
reducedMotion: ReducedMotion;
|
|
8081
|
+
/**
|
|
8082
|
+
* Emulates consistent window screen size available inside web page via `window.screen`. Is only used when the
|
|
8083
|
+
* [testOptions.viewport](https://playwright.dev/docs/api/class-testoptions#test-options-viewport) is set.
|
|
8084
|
+
*
|
|
8085
|
+
* **Usage**
|
|
8086
|
+
*
|
|
8087
|
+
* ```js
|
|
8088
|
+
* // playwright.config.ts
|
|
8089
|
+
* import { defineConfig } from '@playwright/test';
|
|
8090
|
+
*
|
|
8091
|
+
* export default defineConfig({
|
|
8092
|
+
* use: {
|
|
8093
|
+
* viewport: { width: 390, height: 664 },
|
|
8094
|
+
* screen: { width: 390, height: 844 },
|
|
8095
|
+
* },
|
|
8096
|
+
* });
|
|
8097
|
+
* ```
|
|
8098
|
+
*
|
|
8099
|
+
*/
|
|
8100
|
+
screen: ViewportSize | undefined;
|
|
7475
8101
|
/**
|
|
7476
8102
|
* Learn more about [storage state and auth](https://playwright.dev/docs/auth).
|
|
7477
8103
|
*
|
|
@@ -7774,11 +8400,17 @@ export interface PlaywrightWorkerArgs {
|
|
|
7774
8400
|
browser: Browser;
|
|
7775
8401
|
}
|
|
7776
8402
|
|
|
8403
|
+
export interface Stories {}
|
|
8404
|
+
|
|
7777
8405
|
type StoryProps<Story> =
|
|
7778
8406
|
Story extends (props: infer Props) => any ? Props :
|
|
7779
8407
|
Story extends new (...args: any[]) => { $props: infer Props } ? Props :
|
|
7780
8408
|
Story extends new (props: infer Props, ...args: any[]) => any ? Props :
|
|
7781
8409
|
Story;
|
|
8410
|
+
type StoryId = keyof Stories | (string & {});
|
|
8411
|
+
type StoryPropsFor<Id> = Id extends keyof Stories ? StoryProps<Stories[Id]> : Record<string, any>;
|
|
8412
|
+
// Explicit mount<typeof Story>() wins over the id lookup; the indexed access keeps Story from being inferred from props.
|
|
8413
|
+
type MountProps<Story, Id> = [Story] extends [never] ? StoryPropsFor<Id> : StoryProps<[Story][Story extends any ? 0 : never]>;
|
|
7782
8414
|
|
|
7783
8415
|
/**
|
|
7784
8416
|
* Playwright Test is based on the concept of the [test fixtures](https://playwright.dev/docs/test-fixtures). Test fixtures are used to
|
|
@@ -7912,7 +8544,7 @@ export interface PlaywrightTestArgs {
|
|
|
7912
8544
|
* exported story name, for example `'components/Button/Primary'`.
|
|
7913
8545
|
* @param props Optional plain, serializable props passed to the story.
|
|
7914
8546
|
*/
|
|
7915
|
-
mount: <Story =
|
|
8547
|
+
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> }>;
|
|
7916
8548
|
}
|
|
7917
8549
|
|
|
7918
8550
|
type ExcludeProps<A, B> = {
|
|
@@ -9697,13 +10329,16 @@ interface LocatorAssertions {
|
|
|
9697
10329
|
|
|
9698
10330
|
/**
|
|
9699
10331
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
9700
|
-
* configurable with `TestConfig.expect`.
|
|
10332
|
+
* configurable with `TestConfig.expect`. Note that
|
|
10333
|
+
* [`threshold`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1-option-threshold)
|
|
10334
|
+
* defines which pixels are considered different.
|
|
9701
10335
|
*/
|
|
9702
10336
|
maxDiffPixelRatio?: number;
|
|
9703
10337
|
|
|
9704
10338
|
/**
|
|
9705
|
-
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`.
|
|
9706
|
-
*
|
|
10339
|
+
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`. Note that
|
|
10340
|
+
* [`threshold`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1-option-threshold)
|
|
10341
|
+
* defines which pixels are considered different.
|
|
9707
10342
|
*/
|
|
9708
10343
|
maxDiffPixels?: number;
|
|
9709
10344
|
|
|
@@ -9800,13 +10435,16 @@ interface LocatorAssertions {
|
|
|
9800
10435
|
|
|
9801
10436
|
/**
|
|
9802
10437
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
9803
|
-
* configurable with `TestConfig.expect`.
|
|
10438
|
+
* configurable with `TestConfig.expect`. Note that
|
|
10439
|
+
* [`threshold`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-2-option-threshold)
|
|
10440
|
+
* defines which pixels are considered different.
|
|
9804
10441
|
*/
|
|
9805
10442
|
maxDiffPixelRatio?: number;
|
|
9806
10443
|
|
|
9807
10444
|
/**
|
|
9808
|
-
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`.
|
|
9809
|
-
*
|
|
10445
|
+
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`. Note that
|
|
10446
|
+
* [`threshold`](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-2-option-threshold)
|
|
10447
|
+
* defines which pixels are considered different.
|
|
9810
10448
|
*/
|
|
9811
10449
|
maxDiffPixels?: number;
|
|
9812
10450
|
|
|
@@ -10334,13 +10972,16 @@ interface SnapshotAssertions {
|
|
|
10334
10972
|
toMatchSnapshot(name: string|ReadonlyArray<string>, options?: {
|
|
10335
10973
|
/**
|
|
10336
10974
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
10337
|
-
* configurable with `TestConfig.expect`.
|
|
10975
|
+
* configurable with `TestConfig.expect`. Note that
|
|
10976
|
+
* [`threshold`](https://playwright.dev/docs/api/class-snapshotassertions#snapshot-assertions-to-match-snapshot-1-option-threshold)
|
|
10977
|
+
* defines which pixels are considered different.
|
|
10338
10978
|
*/
|
|
10339
10979
|
maxDiffPixelRatio?: number;
|
|
10340
10980
|
|
|
10341
10981
|
/**
|
|
10342
|
-
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`.
|
|
10343
|
-
*
|
|
10982
|
+
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`. Note that
|
|
10983
|
+
* [`threshold`](https://playwright.dev/docs/api/class-snapshotassertions#snapshot-assertions-to-match-snapshot-1-option-threshold)
|
|
10984
|
+
* defines which pixels are considered different.
|
|
10344
10985
|
*/
|
|
10345
10986
|
maxDiffPixels?: number;
|
|
10346
10987
|
|
|
@@ -10386,13 +11027,16 @@ interface SnapshotAssertions {
|
|
|
10386
11027
|
toMatchSnapshot(options?: {
|
|
10387
11028
|
/**
|
|
10388
11029
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
10389
|
-
* configurable with `TestConfig.expect`.
|
|
11030
|
+
* configurable with `TestConfig.expect`. Note that
|
|
11031
|
+
* [`threshold`](https://playwright.dev/docs/api/class-snapshotassertions#snapshot-assertions-to-match-snapshot-2-option-threshold)
|
|
11032
|
+
* defines which pixels are considered different.
|
|
10390
11033
|
*/
|
|
10391
11034
|
maxDiffPixelRatio?: number;
|
|
10392
11035
|
|
|
10393
11036
|
/**
|
|
10394
|
-
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`.
|
|
10395
|
-
*
|
|
11037
|
+
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`. Note that
|
|
11038
|
+
* [`threshold`](https://playwright.dev/docs/api/class-snapshotassertions#snapshot-assertions-to-match-snapshot-2-option-threshold)
|
|
11039
|
+
* defines which pixels are considered different.
|
|
10396
11040
|
*/
|
|
10397
11041
|
maxDiffPixels?: number;
|
|
10398
11042
|
|
|
@@ -10590,6 +11234,26 @@ export interface TestStepInfo {
|
|
|
10590
11234
|
*/
|
|
10591
11235
|
skip(condition: boolean, description?: string): void;
|
|
10592
11236
|
|
|
11237
|
+
/**
|
|
11238
|
+
* The list of annotations applicable to the current test step.
|
|
11239
|
+
*/
|
|
11240
|
+
annotations: Array<{
|
|
11241
|
+
/**
|
|
11242
|
+
* Annotation type, for example `'skip'`.
|
|
11243
|
+
*/
|
|
11244
|
+
type: string;
|
|
11245
|
+
|
|
11246
|
+
/**
|
|
11247
|
+
* Optional description.
|
|
11248
|
+
*/
|
|
11249
|
+
description?: string;
|
|
11250
|
+
|
|
11251
|
+
/**
|
|
11252
|
+
* Optional location in the source where the annotation is added.
|
|
11253
|
+
*/
|
|
11254
|
+
location?: Location;
|
|
11255
|
+
}>;
|
|
11256
|
+
|
|
10593
11257
|
/**
|
|
10594
11258
|
* The full title path starting with the test file name, including the step titles. See also
|
|
10595
11259
|
* [testInfo.titlePath](https://playwright.dev/docs/api/class-testinfo#test-info-title-path).
|
|
@@ -10698,13 +11362,16 @@ export interface PageAssertionsToHaveScreenshotOptions {
|
|
|
10698
11362
|
|
|
10699
11363
|
/**
|
|
10700
11364
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
10701
|
-
* configurable with `TestConfig.expect`.
|
|
11365
|
+
* configurable with `TestConfig.expect`. Note that
|
|
11366
|
+
* [`threshold`](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-threshold)
|
|
11367
|
+
* defines which pixels are considered different.
|
|
10702
11368
|
*/
|
|
10703
11369
|
maxDiffPixelRatio?: number;
|
|
10704
11370
|
|
|
10705
11371
|
/**
|
|
10706
|
-
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`.
|
|
10707
|
-
*
|
|
11372
|
+
* An acceptable amount of pixels that could be different. Default is configurable with `TestConfig.expect`. Note that
|
|
11373
|
+
* [`threshold`](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-threshold)
|
|
11374
|
+
* defines which pixels are considered different.
|
|
10708
11375
|
*/
|
|
10709
11376
|
maxDiffPixels?: number;
|
|
10710
11377
|
|