@molecule/app-e2e-fixtures-default 1.1.0 → 1.1.2
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 +699 -96
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-09-
|
|
6
|
+
Generated: 2026-09-22T16:49:37.887Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-e2e-fixtures-default
|
|
@@ -20,16 +20,19 @@ Import `test` and `expect` from here instead of `@playwright/test` and
|
|
|
20
20
|
write ordinary Playwright specs. Which browser runs them is the e2e bond
|
|
21
21
|
(`@molecule/app-e2e`):
|
|
22
22
|
|
|
23
|
+
- **`@molecule/app-e2e-playwright`** launches a real Playwright browser.
|
|
24
|
+
Every molecule sandbox image bakes Chromium, so this is what a sandbox
|
|
25
|
+
uses as well as your own machine and CI — the specs run against the app's
|
|
26
|
+
dev server on `localhost`, no IDE tab involved.
|
|
23
27
|
- **`@molecule/app-e2e-preview`** drives the LIVE PREVIEW the molecule.dev
|
|
24
|
-
IDE is
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- **`@molecule/app-e2e-playwright`** launches real Playwright browsers. This
|
|
28
|
-
is what your own machine and CI use.
|
|
28
|
+
IDE is showing — the page the person is looking at, in their own browser —
|
|
29
|
+
over a WebSocket through the dev server. Pick it with
|
|
30
|
+
`MOL_E2E_PROVIDER=preview` when the point is that tab.
|
|
29
31
|
|
|
30
32
|
The same spec file runs unchanged in both. The provider is picked by
|
|
31
|
-
`resolveE2EProviderName()`: `MOL_E2E_PROVIDER` when set
|
|
32
|
-
|
|
33
|
+
`resolveE2EProviderName()`: `MOL_E2E_PROVIDER` when set; otherwise, inside
|
|
34
|
+
a molecule sandbox (the `/etc/mol/app-root` marker exists), `playwright`
|
|
35
|
+
when a Playwright browser is installed and `preview` when none is; and
|
|
33
36
|
`playwright` everywhere else. The scaffolded `e2e/bonds.ts` bonds the
|
|
34
37
|
matching provider (and `test` bonds it by name as a fallback); `test` reads
|
|
35
38
|
the same answer to decide whether to launch a browser.
|
|
@@ -114,7 +117,7 @@ interface APIRequestContext {
|
|
|
114
117
|
* @param url Target URL.
|
|
115
118
|
* @param options
|
|
116
119
|
*/
|
|
117
|
-
delete(
|
|
120
|
+
delete<T = any>(
|
|
118
121
|
url: string,
|
|
119
122
|
options?: {
|
|
120
123
|
/**
|
|
@@ -214,7 +217,7 @@ interface APIRequestContext {
|
|
|
214
217
|
*/
|
|
215
218
|
timeout?: number
|
|
216
219
|
},
|
|
217
|
-
): Promise<APIResponse
|
|
220
|
+
): Promise<APIResponse<T>>
|
|
218
221
|
|
|
219
222
|
/**
|
|
220
223
|
* All responses returned by
|
|
@@ -268,7 +271,7 @@ interface APIRequestContext {
|
|
|
268
271
|
* @param urlOrRequest Target URL or Request to get all parameters from.
|
|
269
272
|
* @param options
|
|
270
273
|
*/
|
|
271
|
-
fetch(
|
|
274
|
+
fetch<T = any>(
|
|
272
275
|
urlOrRequest: string | Request,
|
|
273
276
|
options?: {
|
|
274
277
|
/**
|
|
@@ -374,7 +377,7 @@ interface APIRequestContext {
|
|
|
374
377
|
*/
|
|
375
378
|
timeout?: number
|
|
376
379
|
},
|
|
377
|
-
): Promise<APIResponse
|
|
380
|
+
): Promise<APIResponse<T>>
|
|
378
381
|
|
|
379
382
|
/**
|
|
380
383
|
* Sends HTTP(S) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) request and returns its
|
|
@@ -409,7 +412,7 @@ interface APIRequestContext {
|
|
|
409
412
|
* @param url Target URL.
|
|
410
413
|
* @param options
|
|
411
414
|
*/
|
|
412
|
-
get(
|
|
415
|
+
get<T = any>(
|
|
413
416
|
url: string,
|
|
414
417
|
options?: {
|
|
415
418
|
/**
|
|
@@ -509,7 +512,7 @@ interface APIRequestContext {
|
|
|
509
512
|
*/
|
|
510
513
|
timeout?: number
|
|
511
514
|
},
|
|
512
|
-
): Promise<APIResponse
|
|
515
|
+
): Promise<APIResponse<T>>
|
|
513
516
|
|
|
514
517
|
/**
|
|
515
518
|
* Sends HTTP(S) [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request and returns its
|
|
@@ -518,7 +521,7 @@ interface APIRequestContext {
|
|
|
518
521
|
* @param url Target URL.
|
|
519
522
|
* @param options
|
|
520
523
|
*/
|
|
521
|
-
head(
|
|
524
|
+
head<T = any>(
|
|
522
525
|
url: string,
|
|
523
526
|
options?: {
|
|
524
527
|
/**
|
|
@@ -618,7 +621,7 @@ interface APIRequestContext {
|
|
|
618
621
|
*/
|
|
619
622
|
timeout?: number
|
|
620
623
|
},
|
|
621
|
-
): Promise<APIResponse
|
|
624
|
+
): Promise<APIResponse<T>>
|
|
622
625
|
|
|
623
626
|
/**
|
|
624
627
|
* Sends HTTP(S) [PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request and returns its
|
|
@@ -627,7 +630,7 @@ interface APIRequestContext {
|
|
|
627
630
|
* @param url Target URL.
|
|
628
631
|
* @param options
|
|
629
632
|
*/
|
|
630
|
-
patch(
|
|
633
|
+
patch<T = any>(
|
|
631
634
|
url: string,
|
|
632
635
|
options?: {
|
|
633
636
|
/**
|
|
@@ -727,7 +730,7 @@ interface APIRequestContext {
|
|
|
727
730
|
*/
|
|
728
731
|
timeout?: number
|
|
729
732
|
},
|
|
730
|
-
): Promise<APIResponse
|
|
733
|
+
): Promise<APIResponse<T>>
|
|
731
734
|
|
|
732
735
|
/**
|
|
733
736
|
* Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its
|
|
@@ -778,7 +781,7 @@ interface APIRequestContext {
|
|
|
778
781
|
* @param url Target URL.
|
|
779
782
|
* @param options
|
|
780
783
|
*/
|
|
781
|
-
post(
|
|
784
|
+
post<T = any>(
|
|
782
785
|
url: string,
|
|
783
786
|
options?: {
|
|
784
787
|
/**
|
|
@@ -878,7 +881,7 @@ interface APIRequestContext {
|
|
|
878
881
|
*/
|
|
879
882
|
timeout?: number
|
|
880
883
|
},
|
|
881
|
-
): Promise<APIResponse
|
|
884
|
+
): Promise<APIResponse<T>>
|
|
882
885
|
|
|
883
886
|
/**
|
|
884
887
|
* Sends HTTP(S) [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) request and returns its
|
|
@@ -887,7 +890,7 @@ interface APIRequestContext {
|
|
|
887
890
|
* @param url Target URL.
|
|
888
891
|
* @param options
|
|
889
892
|
*/
|
|
890
|
-
put(
|
|
893
|
+
put<T = any>(
|
|
891
894
|
url: string,
|
|
892
895
|
options?: {
|
|
893
896
|
/**
|
|
@@ -987,7 +990,7 @@ interface APIRequestContext {
|
|
|
987
990
|
*/
|
|
988
991
|
timeout?: number
|
|
989
992
|
},
|
|
990
|
-
): Promise<APIResponse
|
|
993
|
+
): Promise<APIResponse<T>>
|
|
991
994
|
|
|
992
995
|
/**
|
|
993
996
|
* Returns storage state for this request context, contains current cookies and local storage snapshot if it was
|
|
@@ -1000,6 +1003,11 @@ interface APIRequestContext {
|
|
|
1000
1003
|
*/
|
|
1001
1004
|
indexedDB?: boolean
|
|
1002
1005
|
|
|
1006
|
+
/**
|
|
1007
|
+
* Set to `true` to include the origin private file system in the storage state snapshot.
|
|
1008
|
+
*/
|
|
1009
|
+
opfs?: boolean
|
|
1010
|
+
|
|
1003
1011
|
/**
|
|
1004
1012
|
* The file path to save the storage state to. If
|
|
1005
1013
|
* [`path`](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-storage-state-option-path) is
|
|
@@ -1040,6 +1048,9 @@ interface APIRequestContext {
|
|
|
1040
1048
|
}>
|
|
1041
1049
|
}>
|
|
1042
1050
|
|
|
1051
|
+
/**
|
|
1052
|
+
* Tracing recorder for requests made through this API request context.
|
|
1053
|
+
*/
|
|
1043
1054
|
tracing: Tracing
|
|
1044
1055
|
|
|
1045
1056
|
[Symbol.asyncDispose](): Promise<void>
|
|
@@ -1053,7 +1064,13 @@ interface APIRequestContext {
|
|
|
1053
1064
|
and similar methods.
|
|
1054
1065
|
|
|
1055
1066
|
```typescript
|
|
1056
|
-
interface APIResponse {
|
|
1067
|
+
interface APIResponse<T = any> {
|
|
1068
|
+
/**
|
|
1069
|
+
* Returns the JSON representation of response body.
|
|
1070
|
+
*
|
|
1071
|
+
* This method will throw if the response body is not parsable via `JSON.parse`.
|
|
1072
|
+
*/
|
|
1073
|
+
json(): Promise<T>
|
|
1057
1074
|
/**
|
|
1058
1075
|
* Returns the buffer with response body.
|
|
1059
1076
|
*/
|
|
@@ -1085,13 +1102,6 @@ interface APIResponse {
|
|
|
1085
1102
|
value: string
|
|
1086
1103
|
}>
|
|
1087
1104
|
|
|
1088
|
-
/**
|
|
1089
|
-
* Returns the JSON representation of response body.
|
|
1090
|
-
*
|
|
1091
|
-
* This method will throw if the response body is not parsable via `JSON.parse`.
|
|
1092
|
-
*/
|
|
1093
|
-
json(): Promise<Serializable>
|
|
1094
|
-
|
|
1095
1105
|
/**
|
|
1096
1106
|
* Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
|
|
1097
1107
|
*/
|
|
@@ -1625,26 +1635,49 @@ interface Browser {
|
|
|
1625
1635
|
/**
|
|
1626
1636
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
|
1627
1637
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
|
1638
|
+
*
|
|
1639
|
+
* Pass an array to use different credentials for different origins. The first entry that matches the request origin
|
|
1640
|
+
* is used, and entries with no origin match any request.
|
|
1628
1641
|
*/
|
|
1629
|
-
httpCredentials?:
|
|
1630
|
-
|
|
1642
|
+
httpCredentials?:
|
|
1643
|
+
| {
|
|
1644
|
+
username: string
|
|
1631
1645
|
|
|
1632
|
-
|
|
1646
|
+
password: string
|
|
1633
1647
|
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1648
|
+
/**
|
|
1649
|
+
* Restrain sending http credentials on specific origin (scheme://host:port).
|
|
1650
|
+
*/
|
|
1651
|
+
origin?: string
|
|
1638
1652
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1653
|
+
/**
|
|
1654
|
+
* This option only applies to the requests sent from corresponding
|
|
1655
|
+
* [APIRequestContext](https://playwright.dev/docs/api/class-apirequestcontext) and does not affect requests sent from
|
|
1656
|
+
* the browser. `'always'` - `Authorization` header with basic authentication credentials will be sent with the each
|
|
1657
|
+
* API request. `'unauthorized` - the credentials are only sent when 401 (Unauthorized) response with
|
|
1658
|
+
* `WWW-Authenticate` header is received. Defaults to `'unauthorized'`.
|
|
1659
|
+
*/
|
|
1660
|
+
send?: 'unauthorized' | 'always'
|
|
1661
|
+
}
|
|
1662
|
+
| Array<{
|
|
1663
|
+
username: string
|
|
1664
|
+
|
|
1665
|
+
password: string
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* Restrain sending http credentials on specific origin (scheme://host:port).
|
|
1669
|
+
*/
|
|
1670
|
+
origin?: string
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* This option only applies to the requests sent from corresponding
|
|
1674
|
+
* [APIRequestContext](https://playwright.dev/docs/api/class-apirequestcontext) and does not affect requests sent from
|
|
1675
|
+
* the browser. `'always'` - `Authorization` header with basic authentication credentials will be sent with the each
|
|
1676
|
+
* API request. `'unauthorized` - the credentials are only sent when 401 (Unauthorized) response with
|
|
1677
|
+
* `WWW-Authenticate` header is received. Defaults to `'unauthorized'`.
|
|
1678
|
+
*/
|
|
1679
|
+
send?: 'unauthorized' | 'always'
|
|
1680
|
+
}>
|
|
1648
1681
|
|
|
1649
1682
|
/**
|
|
1650
1683
|
* Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.
|
|
@@ -2210,6 +2243,14 @@ interface BrowserContext {
|
|
|
2210
2243
|
*/
|
|
2211
2244
|
on(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
2212
2245
|
|
|
2246
|
+
/**
|
|
2247
|
+
* Emitted when a JavaScript dialog in any page belonging to this context has been closed, either by
|
|
2248
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
2249
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
2250
|
+
* headed browser.
|
|
2251
|
+
*/
|
|
2252
|
+
on(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
2253
|
+
|
|
2213
2254
|
/**
|
|
2214
2255
|
* Emitted when attachment download started in any page belonging to this context. User can access basic file
|
|
2215
2256
|
* operations on downloaded content via the passed [Download](https://playwright.dev/docs/api/class-download)
|
|
@@ -2355,6 +2396,11 @@ interface BrowserContext {
|
|
|
2355
2396
|
*/
|
|
2356
2397
|
once(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
2357
2398
|
|
|
2399
|
+
/**
|
|
2400
|
+
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
2401
|
+
*/
|
|
2402
|
+
once(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
2403
|
+
|
|
2358
2404
|
/**
|
|
2359
2405
|
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
2360
2406
|
*/
|
|
@@ -2476,6 +2522,14 @@ interface BrowserContext {
|
|
|
2476
2522
|
*/
|
|
2477
2523
|
addListener(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
2478
2524
|
|
|
2525
|
+
/**
|
|
2526
|
+
* Emitted when a JavaScript dialog in any page belonging to this context has been closed, either by
|
|
2527
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
2528
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
2529
|
+
* headed browser.
|
|
2530
|
+
*/
|
|
2531
|
+
addListener(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
2532
|
+
|
|
2479
2533
|
/**
|
|
2480
2534
|
* Emitted when attachment download started in any page belonging to this context. User can access basic file
|
|
2481
2535
|
* operations on downloaded content via the passed [Download](https://playwright.dev/docs/api/class-download)
|
|
@@ -2621,6 +2675,11 @@ interface BrowserContext {
|
|
|
2621
2675
|
*/
|
|
2622
2676
|
removeListener(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
2623
2677
|
|
|
2678
|
+
/**
|
|
2679
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
2680
|
+
*/
|
|
2681
|
+
removeListener(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
2682
|
+
|
|
2624
2683
|
/**
|
|
2625
2684
|
* Removes an event listener added by `on` or `addListener`.
|
|
2626
2685
|
*/
|
|
@@ -2706,6 +2765,11 @@ interface BrowserContext {
|
|
|
2706
2765
|
*/
|
|
2707
2766
|
off(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
2708
2767
|
|
|
2768
|
+
/**
|
|
2769
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
2770
|
+
*/
|
|
2771
|
+
off(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
2772
|
+
|
|
2709
2773
|
/**
|
|
2710
2774
|
* Removes an event listener added by `on` or `addListener`.
|
|
2711
2775
|
*/
|
|
@@ -2827,6 +2891,14 @@ interface BrowserContext {
|
|
|
2827
2891
|
*/
|
|
2828
2892
|
prependListener(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
2829
2893
|
|
|
2894
|
+
/**
|
|
2895
|
+
* Emitted when a JavaScript dialog in any page belonging to this context has been closed, either by
|
|
2896
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
2897
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
2898
|
+
* headed browser.
|
|
2899
|
+
*/
|
|
2900
|
+
prependListener(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
2901
|
+
|
|
2830
2902
|
/**
|
|
2831
2903
|
* Emitted when attachment download started in any page belonging to this context. User can access basic file
|
|
2832
2904
|
* operations on downloaded content via the passed [Download](https://playwright.dev/docs/api/class-download)
|
|
@@ -3457,15 +3529,37 @@ interface BrowserContext {
|
|
|
3457
3529
|
): Promise<void>
|
|
3458
3530
|
|
|
3459
3531
|
/**
|
|
3460
|
-
*
|
|
3461
|
-
*
|
|
3532
|
+
* Sets the credentials for HTTP authentication for this browser context.
|
|
3533
|
+
*
|
|
3534
|
+
* **NOTE** Browsers may cache credentials per origin after a successful authentication, so changing credentials for
|
|
3535
|
+
* an origin that has already been authenticated may have no effect.
|
|
3536
|
+
*
|
|
3537
|
+
* @param httpCredentials Pass an array to use different credentials for different origins. The first entry that matches the request origin
|
|
3538
|
+
* is used, and entries with no origin match any request.
|
|
3462
3539
|
*/
|
|
3463
3540
|
setHTTPCredentials(
|
|
3464
|
-
httpCredentials:
|
|
3465
|
-
|
|
3541
|
+
httpCredentials:
|
|
3542
|
+
| null
|
|
3543
|
+
| {
|
|
3544
|
+
username: string
|
|
3466
3545
|
|
|
3467
|
-
|
|
3468
|
-
|
|
3546
|
+
password: string
|
|
3547
|
+
|
|
3548
|
+
/**
|
|
3549
|
+
* Restrain sending http credentials on specific origin (scheme://host:port).
|
|
3550
|
+
*/
|
|
3551
|
+
origin?: string
|
|
3552
|
+
}
|
|
3553
|
+
| ReadonlyArray<{
|
|
3554
|
+
username: string
|
|
3555
|
+
|
|
3556
|
+
password: string
|
|
3557
|
+
|
|
3558
|
+
/**
|
|
3559
|
+
* Restrain sending http credentials on specific origin (scheme://host:port).
|
|
3560
|
+
*/
|
|
3561
|
+
origin?: string
|
|
3562
|
+
}>,
|
|
3469
3563
|
): Promise<void>
|
|
3470
3564
|
|
|
3471
3565
|
/**
|
|
@@ -3474,10 +3568,11 @@ interface BrowserContext {
|
|
|
3474
3568
|
setOffline(offline: boolean): Promise<void>
|
|
3475
3569
|
|
|
3476
3570
|
/**
|
|
3477
|
-
* Clears the existing cookies, local storage, IndexedDB entries
|
|
3478
|
-
* storage state. When the storage state contains credentials, the virtual
|
|
3479
|
-
* (equivalent to
|
|
3480
|
-
* preventing all
|
|
3571
|
+
* Clears the existing cookies, local storage, IndexedDB entries, origin private file system entries and virtual
|
|
3572
|
+
* WebAuthn credentials, and sets the new storage state. When the storage state contains credentials, the virtual
|
|
3573
|
+
* WebAuthn authenticator is installed (equivalent to
|
|
3574
|
+
* [credentials.install()](https://playwright.dev/docs/api/class-credentials#credentials-install)), preventing all
|
|
3575
|
+
* real authenticators from working in this context.
|
|
3481
3576
|
*
|
|
3482
3577
|
* **Usage**
|
|
3483
3578
|
*
|
|
@@ -3547,7 +3642,7 @@ interface BrowserContext {
|
|
|
3547
3642
|
|
|
3548
3643
|
/**
|
|
3549
3644
|
* Returns storage state for this browser context, contains current cookies, local storage snapshot, IndexedDB
|
|
3550
|
-
* snapshot and virtual WebAuthn credentials.
|
|
3645
|
+
* snapshot, origin private file system snapshot and virtual WebAuthn credentials.
|
|
3551
3646
|
* @param options
|
|
3552
3647
|
*/
|
|
3553
3648
|
storageState(options?: {
|
|
@@ -3571,6 +3666,16 @@ interface BrowserContext {
|
|
|
3571
3666
|
*/
|
|
3572
3667
|
indexedDB?: boolean
|
|
3573
3668
|
|
|
3669
|
+
/**
|
|
3670
|
+
* Set to `true` to include the
|
|
3671
|
+
* [origin private file system](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system)
|
|
3672
|
+
* in the storage state snapshot.
|
|
3673
|
+
*
|
|
3674
|
+
* **NOTE** OPFS is currently not supported in ephemeral WebKit contexts.
|
|
3675
|
+
*
|
|
3676
|
+
*/
|
|
3677
|
+
opfs?: boolean
|
|
3678
|
+
|
|
3574
3679
|
/**
|
|
3575
3680
|
* The file path to save the storage state to. If
|
|
3576
3681
|
* [`path`](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state-option-path) is a
|
|
@@ -3738,6 +3843,23 @@ interface BrowserContext {
|
|
|
3738
3843
|
| ((dialog: Dialog) => boolean | Promise<boolean>),
|
|
3739
3844
|
): Promise<Dialog>
|
|
3740
3845
|
|
|
3846
|
+
/**
|
|
3847
|
+
* Emitted when a JavaScript dialog in any page belonging to this context has been closed, either by
|
|
3848
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
3849
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
3850
|
+
* headed browser.
|
|
3851
|
+
*/
|
|
3852
|
+
waitForEvent(
|
|
3853
|
+
event: 'dialogclosed',
|
|
3854
|
+
optionsOrPredicate?:
|
|
3855
|
+
| {
|
|
3856
|
+
predicate?: (dialog: Dialog) => boolean | Promise<boolean>
|
|
3857
|
+
timeout?: number
|
|
3858
|
+
signal?: AbortSignal
|
|
3859
|
+
}
|
|
3860
|
+
| ((dialog: Dialog) => boolean | Promise<boolean>),
|
|
3861
|
+
): Promise<Dialog>
|
|
3862
|
+
|
|
3741
3863
|
/**
|
|
3742
3864
|
* Emitted when attachment download started in any page belonging to this context. User can access basic file
|
|
3743
3865
|
* operations on downloaded content via the passed [Download](https://playwright.dev/docs/api/class-download)
|
|
@@ -4442,26 +4564,49 @@ interface BrowserType<Unused = {}> {
|
|
|
4442
4564
|
/**
|
|
4443
4565
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
|
4444
4566
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
|
4567
|
+
*
|
|
4568
|
+
* Pass an array to use different credentials for different origins. The first entry that matches the request origin
|
|
4569
|
+
* is used, and entries with no origin match any request.
|
|
4445
4570
|
*/
|
|
4446
|
-
httpCredentials?:
|
|
4447
|
-
|
|
4571
|
+
httpCredentials?:
|
|
4572
|
+
| {
|
|
4573
|
+
username: string
|
|
4448
4574
|
|
|
4449
|
-
|
|
4575
|
+
password: string
|
|
4450
4576
|
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4577
|
+
/**
|
|
4578
|
+
* Restrain sending http credentials on specific origin (scheme://host:port).
|
|
4579
|
+
*/
|
|
4580
|
+
origin?: string
|
|
4455
4581
|
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4582
|
+
/**
|
|
4583
|
+
* This option only applies to the requests sent from corresponding
|
|
4584
|
+
* [APIRequestContext](https://playwright.dev/docs/api/class-apirequestcontext) and does not affect requests sent from
|
|
4585
|
+
* the browser. `'always'` - `Authorization` header with basic authentication credentials will be sent with the each
|
|
4586
|
+
* API request. `'unauthorized` - the credentials are only sent when 401 (Unauthorized) response with
|
|
4587
|
+
* `WWW-Authenticate` header is received. Defaults to `'unauthorized'`.
|
|
4588
|
+
*/
|
|
4589
|
+
send?: 'unauthorized' | 'always'
|
|
4590
|
+
}
|
|
4591
|
+
| Array<{
|
|
4592
|
+
username: string
|
|
4593
|
+
|
|
4594
|
+
password: string
|
|
4595
|
+
|
|
4596
|
+
/**
|
|
4597
|
+
* Restrain sending http credentials on specific origin (scheme://host:port).
|
|
4598
|
+
*/
|
|
4599
|
+
origin?: string
|
|
4600
|
+
|
|
4601
|
+
/**
|
|
4602
|
+
* This option only applies to the requests sent from corresponding
|
|
4603
|
+
* [APIRequestContext](https://playwright.dev/docs/api/class-apirequestcontext) and does not affect requests sent from
|
|
4604
|
+
* the browser. `'always'` - `Authorization` header with basic authentication credentials will be sent with the each
|
|
4605
|
+
* API request. `'unauthorized` - the credentials are only sent when 401 (Unauthorized) response with
|
|
4606
|
+
* `WWW-Authenticate` header is received. Defaults to `'unauthorized'`.
|
|
4607
|
+
*/
|
|
4608
|
+
send?: 'unauthorized' | 'always'
|
|
4609
|
+
}>
|
|
4465
4610
|
|
|
4466
4611
|
/**
|
|
4467
4612
|
* If `true`, Playwright does not pass its own configurations args and only uses the ones from
|
|
@@ -8862,6 +9007,11 @@ interface Frame {
|
|
|
8862
9007
|
* When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
|
|
8863
9008
|
* in that iframe.
|
|
8864
9009
|
*
|
|
9010
|
+
* When called without [`selector`](https://playwright.dev/docs/api/class-frame#frame-frame-locator-option-selector),
|
|
9011
|
+
* the search starts in this frame or in any of the iframes inside it, so that you don't need to locate each iframe
|
|
9012
|
+
* first. Note that the rest of the locator is resolved inside a single frame, just like any other locator. If it
|
|
9013
|
+
* matches elements inside multiple frames, an error is thrown.
|
|
9014
|
+
*
|
|
8865
9015
|
* **Usage**
|
|
8866
9016
|
*
|
|
8867
9017
|
* Following snippet locates element with text "Submit" in the iframe with id `my-frame`, like `<iframe
|
|
@@ -8872,9 +9022,17 @@ interface Frame {
|
|
|
8872
9022
|
* await locator.click();
|
|
8873
9023
|
* ```
|
|
8874
9024
|
*
|
|
8875
|
-
*
|
|
9025
|
+
* Following snippet locates a button, either in the frame or in one of the iframes inside it:
|
|
9026
|
+
*
|
|
9027
|
+
* ```js
|
|
9028
|
+
* const locator = frame.frameLocator().getByRole('button');
|
|
9029
|
+
* await locator.click();
|
|
9030
|
+
* ```
|
|
9031
|
+
*
|
|
9032
|
+
* @param selector A selector that matches the frame element. When not specified, locator is matched in this frame or in any of the
|
|
9033
|
+
* iframes inside it.
|
|
8876
9034
|
*/
|
|
8877
|
-
frameLocator(selector
|
|
9035
|
+
frameLocator(selector?: string): FrameLocator
|
|
8878
9036
|
|
|
8879
9037
|
/**
|
|
8880
9038
|
* **NOTE** Use locator-based
|
|
@@ -10828,7 +10986,7 @@ interface Frame {
|
|
|
10828
10986
|
FrameLocator represents a view to the `iframe` on the page. It captures the logic sufficient to retrieve the
|
|
10829
10987
|
`iframe` and locate elements in that iframe. FrameLocator can be created with either
|
|
10830
10988
|
[locator.contentFrame()](https://playwright.dev/docs/api/class-locator#locator-content-frame),
|
|
10831
|
-
[page.frameLocator(selector)](https://playwright.dev/docs/api/class-page#page-frame-locator) or
|
|
10989
|
+
[page.frameLocator([selector])](https://playwright.dev/docs/api/class-page#page-frame-locator) or
|
|
10832
10990
|
[locator.frameLocator(selector)](https://playwright.dev/docs/api/class-locator#locator-frame-locator) method.
|
|
10833
10991
|
|
|
10834
10992
|
```js
|
|
@@ -10849,6 +11007,32 @@ await page.locator('.result-frame').contentFrame().getByRole('button').click()
|
|
|
10849
11007
|
await page.locator('.result-frame').contentFrame().first().getByRole('button').click()
|
|
10850
11008
|
```
|
|
10851
11009
|
|
|
11010
|
+
**Any frame**
|
|
11011
|
+
|
|
11012
|
+
Calling [page.frameLocator([selector])](https://playwright.dev/docs/api/class-page#page-frame-locator) or
|
|
11013
|
+
[frame.frameLocator([selector])](https://playwright.dev/docs/api/class-frame#frame-frame-locator) without a
|
|
11014
|
+
selector creates a frame locator that starts the search in any frame of the subtree - so that you don't need to
|
|
11015
|
+
locate the iframe first.
|
|
11016
|
+
|
|
11017
|
+
```js
|
|
11018
|
+
// Finds the button in any frame on the page:
|
|
11019
|
+
await page.frameLocator().getByRole('button').click()
|
|
11020
|
+
|
|
11021
|
+
// Finds the iframe with id "my-frame" anywhere on the page, and clicks the button inside it:
|
|
11022
|
+
await page.frameLocator().locator('#my-frame').contentFrame().getByRole('button').click()
|
|
11023
|
+
```
|
|
11024
|
+
|
|
11025
|
+
Only the start of the search is affected - the rest of the locator is resolved inside a single frame, just like any
|
|
11026
|
+
other locator. Following the strictness rules above, an error is thrown when elements are matched in multiple
|
|
11027
|
+
frames.
|
|
11028
|
+
|
|
11029
|
+
Such a frame locator does not point to a particular `iframe`, so
|
|
11030
|
+
[frameLocator.owner()](https://playwright.dev/docs/api/class-framelocator#frame-locator-owner),
|
|
11031
|
+
[frameLocator.first()](https://playwright.dev/docs/api/class-framelocator#frame-locator-first),
|
|
11032
|
+
[frameLocator.last()](https://playwright.dev/docs/api/class-framelocator#frame-locator-last) and
|
|
11033
|
+
[frameLocator.nth(index)](https://playwright.dev/docs/api/class-framelocator#frame-locator-nth) are not supported
|
|
11034
|
+
on it.
|
|
11035
|
+
|
|
10852
11036
|
**Converting Locator to FrameLocator**
|
|
10853
11037
|
|
|
10854
11038
|
If you have a [Locator](https://playwright.dev/docs/api/class-locator) object pointing to an `iframe` it can be
|
|
@@ -12352,6 +12536,74 @@ interface Locator {
|
|
|
12352
12536
|
timeout?: number
|
|
12353
12537
|
}): Promise<string>
|
|
12354
12538
|
|
|
12539
|
+
/**
|
|
12540
|
+
* Captures the aria snapshot of the given element as a free form JSON object.
|
|
12541
|
+
*
|
|
12542
|
+
* **Usage**
|
|
12543
|
+
*
|
|
12544
|
+
* ```js
|
|
12545
|
+
* await page.getByRole('list').ariaSnapshotJSON();
|
|
12546
|
+
* ```
|
|
12547
|
+
*
|
|
12548
|
+
* **Details**
|
|
12549
|
+
*
|
|
12550
|
+
* This method returns the same tree as
|
|
12551
|
+
* [locator.ariaSnapshot([options])](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot), serialized
|
|
12552
|
+
* as a JSON value instead of YAML markup. The result is a list of nodes, each node being an object with the following
|
|
12553
|
+
* properties:
|
|
12554
|
+
* - `role` Aria role of the element, or `"text"` for a static text fragment.
|
|
12555
|
+
* - `name` Accessible name of the element, if any.
|
|
12556
|
+
* - `text` Text content of the element when it is the only child, or the content of a static text fragment.
|
|
12557
|
+
* - `children` Child nodes and text fragments.
|
|
12558
|
+
* - Boolean and value properties for element state flags: `checked`, `disabled`, `expanded`, `active`, `invalid`,
|
|
12559
|
+
* `level`, `pressed` and `selected`.
|
|
12560
|
+
* - Additional element properties, for example `url` for links and `placeholder` for text boxes.
|
|
12561
|
+
* - `ref` Element reference for AI-optimized snapshots.
|
|
12562
|
+
* - `cursor` Set to `"pointer"` for clickable elements in AI-optimized snapshots.
|
|
12563
|
+
* - `box` Bounding box of the element when
|
|
12564
|
+
* [`boxes`](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot-json-option-boxes) is set.
|
|
12565
|
+
* @param options
|
|
12566
|
+
*/
|
|
12567
|
+
ariaSnapshotJSON(options?: {
|
|
12568
|
+
/**
|
|
12569
|
+
* When `true`, includes each element's bounding box as a `box` property with `x`, `y`, `width` and `height`.
|
|
12570
|
+
* Coordinates are relative to the viewport, in CSS pixels, as returned by
|
|
12571
|
+
* [`Element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
|
|
12572
|
+
* Defaults to `false`.
|
|
12573
|
+
*/
|
|
12574
|
+
boxes?: boolean
|
|
12575
|
+
|
|
12576
|
+
/**
|
|
12577
|
+
* When specified, limits the depth of the snapshot.
|
|
12578
|
+
*/
|
|
12579
|
+
depth?: number
|
|
12580
|
+
|
|
12581
|
+
/**
|
|
12582
|
+
* When set to `"ai"`, returns a snapshot optimized for AI consumption. Defaults to `"default"`. See details in
|
|
12583
|
+
* [locator.ariaSnapshot([options])](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot).
|
|
12584
|
+
*/
|
|
12585
|
+
mode?: 'ai' | 'default'
|
|
12586
|
+
|
|
12587
|
+
/**
|
|
12588
|
+
* Allows to cancel the operation using an
|
|
12589
|
+
* [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). If the signal is aborted, the
|
|
12590
|
+
* operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout,
|
|
12591
|
+
* which can be changed using
|
|
12592
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
12593
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout); pass
|
|
12594
|
+
* `timeout: 0` to disable the timeout entirely.
|
|
12595
|
+
*/
|
|
12596
|
+
signal?: AbortSignal
|
|
12597
|
+
|
|
12598
|
+
/**
|
|
12599
|
+
* Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
|
|
12600
|
+
* option in the config, or by using the
|
|
12601
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
12602
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
|
12603
|
+
*/
|
|
12604
|
+
timeout?: number
|
|
12605
|
+
}): Promise<Serializable>
|
|
12606
|
+
|
|
12355
12607
|
/**
|
|
12356
12608
|
* Calls [blur](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur) on the element.
|
|
12357
12609
|
* @param options
|
|
@@ -13290,7 +13542,9 @@ interface Locator {
|
|
|
13290
13542
|
hasText?: string | RegExp
|
|
13291
13543
|
|
|
13292
13544
|
/**
|
|
13293
|
-
* Only matches visible or invisible elements.
|
|
13545
|
+
* Only matches visible or invisible elements. Prefer the
|
|
13546
|
+
* [locator.visible()](https://playwright.dev/docs/api/class-locator#locator-visible) shortcut when matching only
|
|
13547
|
+
* visible elements.
|
|
13294
13548
|
*/
|
|
13295
13549
|
visible?: boolean
|
|
13296
13550
|
}): Locator
|
|
@@ -15098,6 +15352,34 @@ interface Locator {
|
|
|
15098
15352
|
trial?: boolean
|
|
15099
15353
|
}): Promise<void>
|
|
15100
15354
|
|
|
15355
|
+
/**
|
|
15356
|
+
* Returns a locator that matches only [visible](https://playwright.dev/docs/actionability#visible) elements, ignoring the invisible ones.
|
|
15357
|
+
* This is the recommended way to distinguish elements by visibility, as opposed to the `:visible` CSS pseudo-class.
|
|
15358
|
+
*
|
|
15359
|
+
* Note that visibility is checked every time the locator is used, and not at the moment of the
|
|
15360
|
+
* [locator.visible()](https://playwright.dev/docs/api/class-locator#locator-visible) call.
|
|
15361
|
+
*
|
|
15362
|
+
* **Usage**
|
|
15363
|
+
*
|
|
15364
|
+
* Consider a page with two buttons, the first invisible and the second visible.
|
|
15365
|
+
*
|
|
15366
|
+
* ```html
|
|
15367
|
+
* <button style='display: none'>Invisible</button>
|
|
15368
|
+
* <button>Visible</button>
|
|
15369
|
+
* ```
|
|
15370
|
+
*
|
|
15371
|
+
* This will only find the second button, because it is visible, and then click it.
|
|
15372
|
+
*
|
|
15373
|
+
* ```js
|
|
15374
|
+
* await page.locator('button').visible().click();
|
|
15375
|
+
* ```
|
|
15376
|
+
*
|
|
15377
|
+
* To match invisible elements instead, use
|
|
15378
|
+
* [locator.filter([options])](https://playwright.dev/docs/api/class-locator#locator-filter) with the
|
|
15379
|
+
* [`visible`](https://playwright.dev/docs/api/class-locator#locator-filter-option-visible) option set to `false`.
|
|
15380
|
+
*/
|
|
15381
|
+
visible(): Locator
|
|
15382
|
+
|
|
15101
15383
|
/**
|
|
15102
15384
|
* Returns when element specified by locator satisfies the
|
|
15103
15385
|
* [`state`](https://playwright.dev/docs/api/class-locator#locator-wait-for-option-state) option.
|
|
@@ -16385,6 +16667,14 @@ interface Page {
|
|
|
16385
16667
|
*/
|
|
16386
16668
|
on(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
16387
16669
|
|
|
16670
|
+
/**
|
|
16671
|
+
* Emitted when a JavaScript dialog has been closed, either by
|
|
16672
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
16673
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
16674
|
+
* headed browser.
|
|
16675
|
+
*/
|
|
16676
|
+
on(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
16677
|
+
|
|
16388
16678
|
/**
|
|
16389
16679
|
* Emitted when the JavaScript
|
|
16390
16680
|
* [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
|
|
@@ -16546,6 +16836,11 @@ interface Page {
|
|
|
16546
16836
|
*/
|
|
16547
16837
|
once(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
16548
16838
|
|
|
16839
|
+
/**
|
|
16840
|
+
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
16841
|
+
*/
|
|
16842
|
+
once(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
16843
|
+
|
|
16549
16844
|
/**
|
|
16550
16845
|
* Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
|
|
16551
16846
|
*/
|
|
@@ -16687,6 +16982,14 @@ interface Page {
|
|
|
16687
16982
|
*/
|
|
16688
16983
|
addListener(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
16689
16984
|
|
|
16985
|
+
/**
|
|
16986
|
+
* Emitted when a JavaScript dialog has been closed, either by
|
|
16987
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
16988
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
16989
|
+
* headed browser.
|
|
16990
|
+
*/
|
|
16991
|
+
addListener(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
16992
|
+
|
|
16690
16993
|
/**
|
|
16691
16994
|
* Emitted when the JavaScript
|
|
16692
16995
|
* [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
|
|
@@ -16848,6 +17151,11 @@ interface Page {
|
|
|
16848
17151
|
*/
|
|
16849
17152
|
removeListener(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
16850
17153
|
|
|
17154
|
+
/**
|
|
17155
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
17156
|
+
*/
|
|
17157
|
+
removeListener(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
17158
|
+
|
|
16851
17159
|
/**
|
|
16852
17160
|
* Removes an event listener added by `on` or `addListener`.
|
|
16853
17161
|
*/
|
|
@@ -16943,6 +17251,11 @@ interface Page {
|
|
|
16943
17251
|
*/
|
|
16944
17252
|
off(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
16945
17253
|
|
|
17254
|
+
/**
|
|
17255
|
+
* Removes an event listener added by `on` or `addListener`.
|
|
17256
|
+
*/
|
|
17257
|
+
off(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
17258
|
+
|
|
16946
17259
|
/**
|
|
16947
17260
|
* Removes an event listener added by `on` or `addListener`.
|
|
16948
17261
|
*/
|
|
@@ -17084,6 +17397,14 @@ interface Page {
|
|
|
17084
17397
|
*/
|
|
17085
17398
|
prependListener(event: 'dialog', listener: (dialog: Dialog) => any): this
|
|
17086
17399
|
|
|
17400
|
+
/**
|
|
17401
|
+
* Emitted when a JavaScript dialog has been closed, either by
|
|
17402
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
17403
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
17404
|
+
* headed browser.
|
|
17405
|
+
*/
|
|
17406
|
+
prependListener(event: 'dialogclosed', listener: (dialog: Dialog) => any): this
|
|
17407
|
+
|
|
17087
17408
|
/**
|
|
17088
17409
|
* Emitted when the JavaScript
|
|
17089
17410
|
* [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
|
|
@@ -17442,6 +17763,54 @@ interface Page {
|
|
|
17442
17763
|
timeout?: number
|
|
17443
17764
|
}): Promise<string>
|
|
17444
17765
|
|
|
17766
|
+
/**
|
|
17767
|
+
* Captures the aria snapshot of the page as a free form JSON object. Returns the same tree as
|
|
17768
|
+
* [page.ariaSnapshot([options])](https://playwright.dev/docs/api/class-page#page-aria-snapshot), serialized as a JSON
|
|
17769
|
+
* value instead of YAML markup. See
|
|
17770
|
+
* [locator.ariaSnapshotJSON([options])](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot-json) for
|
|
17771
|
+
* the details of the format.
|
|
17772
|
+
* @param options
|
|
17773
|
+
*/
|
|
17774
|
+
ariaSnapshotJSON(options?: {
|
|
17775
|
+
/**
|
|
17776
|
+
* When `true`, includes each element's bounding box as a `box` property with `x`, `y`, `width` and `height`.
|
|
17777
|
+
* Coordinates are relative to the viewport, in CSS pixels, as returned by
|
|
17778
|
+
* [`Element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
|
|
17779
|
+
* Defaults to `false`.
|
|
17780
|
+
*/
|
|
17781
|
+
boxes?: boolean
|
|
17782
|
+
|
|
17783
|
+
/**
|
|
17784
|
+
* When specified, limits the depth of the snapshot.
|
|
17785
|
+
*/
|
|
17786
|
+
depth?: number
|
|
17787
|
+
|
|
17788
|
+
/**
|
|
17789
|
+
* When set to `"ai"`, returns a snapshot optimized for AI consumption: including element references like `[ref=e2]`
|
|
17790
|
+
* and snapshots of `<iframe>`s. Defaults to `"default"`.
|
|
17791
|
+
*/
|
|
17792
|
+
mode?: 'ai' | 'default'
|
|
17793
|
+
|
|
17794
|
+
/**
|
|
17795
|
+
* Allows to cancel the operation using an
|
|
17796
|
+
* [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). If the signal is aborted, the
|
|
17797
|
+
* operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout,
|
|
17798
|
+
* which can be changed using
|
|
17799
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
17800
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout); pass
|
|
17801
|
+
* `timeout: 0` to disable the timeout entirely.
|
|
17802
|
+
*/
|
|
17803
|
+
signal?: AbortSignal
|
|
17804
|
+
|
|
17805
|
+
/**
|
|
17806
|
+
* Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout`
|
|
17807
|
+
* option in the config, or by using the
|
|
17808
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
17809
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
|
17810
|
+
*/
|
|
17811
|
+
timeout?: number
|
|
17812
|
+
}): Promise<Serializable>
|
|
17813
|
+
|
|
17445
17814
|
/**
|
|
17446
17815
|
* Brings page to front (activates tab).
|
|
17447
17816
|
*/
|
|
@@ -18277,6 +18646,11 @@ interface Page {
|
|
|
18277
18646
|
* When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
|
|
18278
18647
|
* in that iframe.
|
|
18279
18648
|
*
|
|
18649
|
+
* When called without [`selector`](https://playwright.dev/docs/api/class-page#page-frame-locator-option-selector),
|
|
18650
|
+
* the search starts in any frame on the page - the main frame or any of the iframes - so that you don't need to
|
|
18651
|
+
* locate each iframe first. Note that the rest of the locator is resolved inside a single frame, just like any other
|
|
18652
|
+
* locator. If it matches elements inside multiple frames, an error is thrown.
|
|
18653
|
+
*
|
|
18280
18654
|
* **Usage**
|
|
18281
18655
|
*
|
|
18282
18656
|
* Following snippet locates element with text "Submit" in the iframe with id `my-frame`, like `<iframe
|
|
@@ -18287,9 +18661,16 @@ interface Page {
|
|
|
18287
18661
|
* await locator.click();
|
|
18288
18662
|
* ```
|
|
18289
18663
|
*
|
|
18290
|
-
*
|
|
18664
|
+
* Following snippet locates a button, either in the main frame or in one of the iframes:
|
|
18665
|
+
*
|
|
18666
|
+
* ```js
|
|
18667
|
+
* const locator = page.frameLocator().getByRole('button');
|
|
18668
|
+
* await locator.click();
|
|
18669
|
+
* ```
|
|
18670
|
+
*
|
|
18671
|
+
* @param selector A selector that matches the frame element. When not specified, locator is matched in any frame on the page.
|
|
18291
18672
|
*/
|
|
18292
|
-
frameLocator(selector
|
|
18673
|
+
frameLocator(selector?: string): FrameLocator
|
|
18293
18674
|
|
|
18294
18675
|
/**
|
|
18295
18676
|
* An array of all frames attached to the page.
|
|
@@ -18769,7 +19150,7 @@ interface Page {
|
|
|
18769
19150
|
*
|
|
18770
19151
|
* Navigate to the previous page in history.
|
|
18771
19152
|
*
|
|
18772
|
-
* **NOTE** **Testing Back/Forward Cache (BFCache) is not supported.**
|
|
19153
|
+
* **NOTE** **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the
|
|
18773
19154
|
* Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on
|
|
18774
19155
|
* network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using
|
|
18775
19156
|
* `page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized
|
|
@@ -18817,7 +19198,7 @@ interface Page {
|
|
|
18817
19198
|
*
|
|
18818
19199
|
* Navigate to the next page in history.
|
|
18819
19200
|
*
|
|
18820
|
-
* **NOTE** **Testing Back/Forward Cache (BFCache) is not supported.**
|
|
19201
|
+
* **NOTE** **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the
|
|
18821
19202
|
* Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on
|
|
18822
19203
|
* network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using
|
|
18823
19204
|
* `page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized
|
|
@@ -20871,6 +21252,23 @@ interface Page {
|
|
|
20871
21252
|
| ((dialog: Dialog) => boolean | Promise<boolean>),
|
|
20872
21253
|
): Promise<Dialog>
|
|
20873
21254
|
|
|
21255
|
+
/**
|
|
21256
|
+
* Emitted when a JavaScript dialog has been closed, either by
|
|
21257
|
+
* [dialog.accept([promptText])](https://playwright.dev/docs/api/class-dialog#dialog-accept), by
|
|
21258
|
+
* [dialog.dismiss()](https://playwright.dev/docs/api/class-dialog#dialog-dismiss), or manually by the user in the
|
|
21259
|
+
* headed browser.
|
|
21260
|
+
*/
|
|
21261
|
+
waitForEvent(
|
|
21262
|
+
event: 'dialogclosed',
|
|
21263
|
+
optionsOrPredicate?:
|
|
21264
|
+
| {
|
|
21265
|
+
predicate?: (dialog: Dialog) => boolean | Promise<boolean>
|
|
21266
|
+
timeout?: number
|
|
21267
|
+
signal?: AbortSignal
|
|
21268
|
+
}
|
|
21269
|
+
| ((dialog: Dialog) => boolean | Promise<boolean>),
|
|
21270
|
+
): Promise<Dialog>
|
|
21271
|
+
|
|
20874
21272
|
/**
|
|
20875
21273
|
* Emitted when the JavaScript
|
|
20876
21274
|
* [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
|
|
@@ -21653,11 +22051,11 @@ interface PlaywrightTestArgs {
|
|
|
21653
22051
|
* exported story name, for example `'components/Button/Primary'`.
|
|
21654
22052
|
* @param props Optional plain, serializable props passed to the story.
|
|
21655
22053
|
*/
|
|
21656
|
-
mount: <Story =
|
|
21657
|
-
storyId:
|
|
21658
|
-
props?:
|
|
22054
|
+
mount: <Story = never, Id extends StoryId = StoryId>(
|
|
22055
|
+
storyId: Id,
|
|
22056
|
+
props?: MountProps<Story, Id>,
|
|
21659
22057
|
) => Promise<
|
|
21660
|
-
Locator & { update(props?:
|
|
22058
|
+
Locator & { update(props?: MountProps<Story, Id>): Promise<void>; unmount(): Promise<void> }
|
|
21661
22059
|
>
|
|
21662
22060
|
}
|
|
21663
22061
|
````
|
|
@@ -21759,6 +22157,26 @@ interface PlaywrightTestOptions {
|
|
|
21759
22157
|
*
|
|
21760
22158
|
*/
|
|
21761
22159
|
colorScheme: ColorScheme
|
|
22160
|
+
/**
|
|
22161
|
+
* Emulates `'prefers-contrast'` media feature, supported values are `'no-preference'`, `'more'`. See
|
|
22162
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
22163
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
|
|
22164
|
+
*
|
|
22165
|
+
* **Usage**
|
|
22166
|
+
*
|
|
22167
|
+
* ```js
|
|
22168
|
+
* // playwright.config.ts
|
|
22169
|
+
* import { defineConfig } from '@playwright/test';
|
|
22170
|
+
*
|
|
22171
|
+
* export default defineConfig({
|
|
22172
|
+
* use: {
|
|
22173
|
+
* contrast: 'more',
|
|
22174
|
+
* },
|
|
22175
|
+
* });
|
|
22176
|
+
* ```
|
|
22177
|
+
*
|
|
22178
|
+
*/
|
|
22179
|
+
contrast: Contrast
|
|
21762
22180
|
/**
|
|
21763
22181
|
* TLS Client Authentication allows the server to request a client certificate and verify it.
|
|
21764
22182
|
*
|
|
@@ -21836,6 +22254,26 @@ interface PlaywrightTestOptions {
|
|
|
21836
22254
|
*
|
|
21837
22255
|
*/
|
|
21838
22256
|
extraHTTPHeaders: ExtraHTTPHeaders | undefined
|
|
22257
|
+
/**
|
|
22258
|
+
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
|
22259
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
22260
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'none'`.
|
|
22261
|
+
*
|
|
22262
|
+
* **Usage**
|
|
22263
|
+
*
|
|
22264
|
+
* ```js
|
|
22265
|
+
* // playwright.config.ts
|
|
22266
|
+
* import { defineConfig } from '@playwright/test';
|
|
22267
|
+
*
|
|
22268
|
+
* export default defineConfig({
|
|
22269
|
+
* use: {
|
|
22270
|
+
* forcedColors: 'active',
|
|
22271
|
+
* },
|
|
22272
|
+
* });
|
|
22273
|
+
* ```
|
|
22274
|
+
*
|
|
22275
|
+
*/
|
|
22276
|
+
forcedColors: ForcedColors
|
|
21839
22277
|
/**
|
|
21840
22278
|
* **Usage**
|
|
21841
22279
|
*
|
|
@@ -21876,6 +22314,9 @@ interface PlaywrightTestOptions {
|
|
|
21876
22314
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
|
21877
22315
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
|
21878
22316
|
*
|
|
22317
|
+
* Pass an array to use different credentials for different origins. The first entry that matches the request origin
|
|
22318
|
+
* is used, and entries with no origin match any request.
|
|
22319
|
+
*
|
|
21879
22320
|
* **Usage**
|
|
21880
22321
|
*
|
|
21881
22322
|
* ```js
|
|
@@ -21893,7 +22334,7 @@ interface PlaywrightTestOptions {
|
|
|
21893
22334
|
* ```
|
|
21894
22335
|
*
|
|
21895
22336
|
*/
|
|
21896
|
-
httpCredentials: HTTPCredentials | undefined
|
|
22337
|
+
httpCredentials: HTTPCredentials | HTTPCredentials[] | undefined
|
|
21897
22338
|
/**
|
|
21898
22339
|
* Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.
|
|
21899
22340
|
*
|
|
@@ -22031,6 +22472,26 @@ interface PlaywrightTestOptions {
|
|
|
22031
22472
|
*
|
|
22032
22473
|
*/
|
|
22033
22474
|
proxy: Proxy | undefined
|
|
22475
|
+
/**
|
|
22476
|
+
* Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. See
|
|
22477
|
+
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
|
22478
|
+
* Passing `null` resets emulation to system defaults. Defaults to `'no-preference'`.
|
|
22479
|
+
*
|
|
22480
|
+
* **Usage**
|
|
22481
|
+
*
|
|
22482
|
+
* ```js
|
|
22483
|
+
* // playwright.config.ts
|
|
22484
|
+
* import { defineConfig } from '@playwright/test';
|
|
22485
|
+
*
|
|
22486
|
+
* export default defineConfig({
|
|
22487
|
+
* use: {
|
|
22488
|
+
* reducedMotion: 'reduce',
|
|
22489
|
+
* },
|
|
22490
|
+
* });
|
|
22491
|
+
* ```
|
|
22492
|
+
*
|
|
22493
|
+
*/
|
|
22494
|
+
reducedMotion: ReducedMotion
|
|
22034
22495
|
/**
|
|
22035
22496
|
* Learn more about [storage state and auth](https://playwright.dev/docs/auth).
|
|
22036
22497
|
*
|
|
@@ -22621,7 +23082,7 @@ interface PlaywrightWorkerOptions {
|
|
|
22621
23082
|
| /** deprecated */ 'retry-with-trace'
|
|
22622
23083
|
| {
|
|
22623
23084
|
mode: TraceMode
|
|
22624
|
-
snapshots?: boolean
|
|
23085
|
+
snapshots?: boolean | { dom?: boolean; aria?: boolean; screen?: boolean }
|
|
22625
23086
|
screenshots?: boolean
|
|
22626
23087
|
sources?: boolean
|
|
22627
23088
|
attachments?: boolean
|
|
@@ -23392,7 +23853,7 @@ interface Route {
|
|
|
23392
23853
|
* instead.
|
|
23393
23854
|
* @param options
|
|
23394
23855
|
*/
|
|
23395
|
-
fetch(options?: {
|
|
23856
|
+
fetch<T = any>(options?: {
|
|
23396
23857
|
/**
|
|
23397
23858
|
* If set changes the request HTTP headers. Header values will be converted to a string.
|
|
23398
23859
|
*/
|
|
@@ -23442,7 +23903,7 @@ interface Route {
|
|
|
23442
23903
|
* If set changes the request URL. New URL must have same protocol as original one.
|
|
23443
23904
|
*/
|
|
23444
23905
|
url?: string
|
|
23445
|
-
}): Promise<APIResponse
|
|
23906
|
+
}): Promise<APIResponse<T>>
|
|
23446
23907
|
|
|
23447
23908
|
/**
|
|
23448
23909
|
* Fulfills route's request with given response.
|
|
@@ -24143,6 +24604,26 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
24143
24604
|
* [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
|
|
24144
24605
|
*
|
|
24145
24606
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
24607
|
+
*
|
|
24608
|
+
* **Locks**
|
|
24609
|
+
*
|
|
24610
|
+
* You can declare named locks to prevent specific tests from running at the same time, while all other tests continue
|
|
24611
|
+
* to run in parallel. Tests that share a lock name never run concurrently, even when they are declared in different
|
|
24612
|
+
* files or belong to different [projects](https://playwright.dev/docs/test-projects). This is useful when a few tests access a shared
|
|
24613
|
+
* resource that does not support concurrent access.
|
|
24614
|
+
*
|
|
24615
|
+
* ```js
|
|
24616
|
+
* import { test, expect } from '@playwright/test';
|
|
24617
|
+
*
|
|
24618
|
+
* test('update user settings', {
|
|
24619
|
+
* lock: 'user-settings',
|
|
24620
|
+
* }, async ({ page }) => {
|
|
24621
|
+
* // This test never runs concurrently with other tests
|
|
24622
|
+
* // that declare the 'user-settings' lock.
|
|
24623
|
+
* });
|
|
24624
|
+
* ```
|
|
24625
|
+
*
|
|
24626
|
+
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
24146
24627
|
* @param title Test title.
|
|
24147
24628
|
* @param details Additional test details.
|
|
24148
24629
|
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
@@ -24220,6 +24701,26 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
24220
24701
|
* [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
|
|
24221
24702
|
*
|
|
24222
24703
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
24704
|
+
*
|
|
24705
|
+
* **Locks**
|
|
24706
|
+
*
|
|
24707
|
+
* You can declare named locks to prevent specific tests from running at the same time, while all other tests continue
|
|
24708
|
+
* to run in parallel. Tests that share a lock name never run concurrently, even when they are declared in different
|
|
24709
|
+
* files or belong to different [projects](https://playwright.dev/docs/test-projects). This is useful when a few tests access a shared
|
|
24710
|
+
* resource that does not support concurrent access.
|
|
24711
|
+
*
|
|
24712
|
+
* ```js
|
|
24713
|
+
* import { test, expect } from '@playwright/test';
|
|
24714
|
+
*
|
|
24715
|
+
* test('update user settings', {
|
|
24716
|
+
* lock: 'user-settings',
|
|
24717
|
+
* }, async ({ page }) => {
|
|
24718
|
+
* // This test never runs concurrently with other tests
|
|
24719
|
+
* // that declare the 'user-settings' lock.
|
|
24720
|
+
* });
|
|
24721
|
+
* ```
|
|
24722
|
+
*
|
|
24723
|
+
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
24223
24724
|
* @param title Test title.
|
|
24224
24725
|
* @param details Additional test details.
|
|
24225
24726
|
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
@@ -24356,6 +24857,28 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
24356
24857
|
* ```
|
|
24357
24858
|
*
|
|
24358
24859
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
24860
|
+
*
|
|
24861
|
+
* **Locks**
|
|
24862
|
+
*
|
|
24863
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
24864
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
24865
|
+
*
|
|
24866
|
+
* ```js
|
|
24867
|
+
* import { test, expect } from '@playwright/test';
|
|
24868
|
+
*
|
|
24869
|
+
* test.describe('two tests with a lock', {
|
|
24870
|
+
* lock: 'user-settings',
|
|
24871
|
+
* }, () => {
|
|
24872
|
+
* test('one', async ({ page }) => {
|
|
24873
|
+
* // ...
|
|
24874
|
+
* });
|
|
24875
|
+
*
|
|
24876
|
+
* test('two', async ({ page }) => {
|
|
24877
|
+
* // ...
|
|
24878
|
+
* });
|
|
24879
|
+
* });
|
|
24880
|
+
* ```
|
|
24881
|
+
*
|
|
24359
24882
|
* @param title Group title.
|
|
24360
24883
|
* @param details Additional details for all tests in the group.
|
|
24361
24884
|
* @param callback A callback that is run immediately when calling
|
|
@@ -24451,6 +24974,28 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
24451
24974
|
* ```
|
|
24452
24975
|
*
|
|
24453
24976
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
24977
|
+
*
|
|
24978
|
+
* **Locks**
|
|
24979
|
+
*
|
|
24980
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
24981
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
24982
|
+
*
|
|
24983
|
+
* ```js
|
|
24984
|
+
* import { test, expect } from '@playwright/test';
|
|
24985
|
+
*
|
|
24986
|
+
* test.describe('two tests with a lock', {
|
|
24987
|
+
* lock: 'user-settings',
|
|
24988
|
+
* }, () => {
|
|
24989
|
+
* test('one', async ({ page }) => {
|
|
24990
|
+
* // ...
|
|
24991
|
+
* });
|
|
24992
|
+
*
|
|
24993
|
+
* test('two', async ({ page }) => {
|
|
24994
|
+
* // ...
|
|
24995
|
+
* });
|
|
24996
|
+
* });
|
|
24997
|
+
* ```
|
|
24998
|
+
*
|
|
24454
24999
|
* @param title Group title.
|
|
24455
25000
|
* @param details Additional details for all tests in the group.
|
|
24456
25001
|
* @param callback A callback that is run immediately when calling
|
|
@@ -24546,6 +25091,28 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
24546
25091
|
* ```
|
|
24547
25092
|
*
|
|
24548
25093
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
25094
|
+
*
|
|
25095
|
+
* **Locks**
|
|
25096
|
+
*
|
|
25097
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
25098
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
25099
|
+
*
|
|
25100
|
+
* ```js
|
|
25101
|
+
* import { test, expect } from '@playwright/test';
|
|
25102
|
+
*
|
|
25103
|
+
* test.describe('two tests with a lock', {
|
|
25104
|
+
* lock: 'user-settings',
|
|
25105
|
+
* }, () => {
|
|
25106
|
+
* test('one', async ({ page }) => {
|
|
25107
|
+
* // ...
|
|
25108
|
+
* });
|
|
25109
|
+
*
|
|
25110
|
+
* test('two', async ({ page }) => {
|
|
25111
|
+
* // ...
|
|
25112
|
+
* });
|
|
25113
|
+
* });
|
|
25114
|
+
* ```
|
|
25115
|
+
*
|
|
24549
25116
|
* @param title Group title.
|
|
24550
25117
|
* @param details Additional details for all tests in the group.
|
|
24551
25118
|
* @param callback A callback that is run immediately when calling
|
|
@@ -24641,6 +25208,28 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
24641
25208
|
* ```
|
|
24642
25209
|
*
|
|
24643
25210
|
* Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
|
|
25211
|
+
*
|
|
25212
|
+
* **Locks**
|
|
25213
|
+
*
|
|
25214
|
+
* You can declare named locks for all tests in a group by providing additional details. Tests that share a lock name
|
|
25215
|
+
* never run concurrently. Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
25216
|
+
*
|
|
25217
|
+
* ```js
|
|
25218
|
+
* import { test, expect } from '@playwright/test';
|
|
25219
|
+
*
|
|
25220
|
+
* test.describe('two tests with a lock', {
|
|
25221
|
+
* lock: 'user-settings',
|
|
25222
|
+
* }, () => {
|
|
25223
|
+
* test('one', async ({ page }) => {
|
|
25224
|
+
* // ...
|
|
25225
|
+
* });
|
|
25226
|
+
*
|
|
25227
|
+
* test('two', async ({ page }) => {
|
|
25228
|
+
* // ...
|
|
25229
|
+
* });
|
|
25230
|
+
* });
|
|
25231
|
+
* ```
|
|
25232
|
+
*
|
|
24644
25233
|
* @param title Group title.
|
|
24645
25234
|
* @param details Additional details for all tests in the group.
|
|
24646
25235
|
* @param callback A callback that is run immediately when calling
|
|
@@ -27945,7 +28534,13 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
27945
28534
|
<T>(
|
|
27946
28535
|
title: string,
|
|
27947
28536
|
body: (step: TestStepInfo) => T | Promise<T>,
|
|
27948
|
-
options?: {
|
|
28537
|
+
options?: {
|
|
28538
|
+
box?: boolean
|
|
28539
|
+
location?: Location
|
|
28540
|
+
timeout?: number
|
|
28541
|
+
params?: { [key: string]: any }
|
|
28542
|
+
subtitle?: string
|
|
28543
|
+
},
|
|
27949
28544
|
): Promise<T>
|
|
27950
28545
|
/**
|
|
27951
28546
|
* Mark a test step as "skip" to temporarily disable its execution, useful for steps that are currently failing and
|
|
@@ -27977,7 +28572,13 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
27977
28572
|
skip(
|
|
27978
28573
|
title: string,
|
|
27979
28574
|
body: (step: TestStepInfo) => any | Promise<any>,
|
|
27980
|
-
options?: {
|
|
28575
|
+
options?: {
|
|
28576
|
+
box?: boolean
|
|
28577
|
+
location?: Location
|
|
28578
|
+
timeout?: number
|
|
28579
|
+
params?: { [key: string]: any }
|
|
28580
|
+
subtitle?: string
|
|
28581
|
+
},
|
|
27981
28582
|
): Promise<void>
|
|
27982
28583
|
}
|
|
27983
28584
|
/**
|
|
@@ -28556,11 +29157,13 @@ waitForRequest` (read the response with `page.request` or `fetch` in
|
|
|
28556
29157
|
- **Events.** `page.on('response')`/`'request'` never fire over the preview
|
|
28557
29158
|
(a one-time warning says so); `'console'` and `'pageerror'` do, so the
|
|
28558
29159
|
console-error guard works there too.
|
|
28559
|
-
- **
|
|
28560
|
-
|
|
28561
|
-
|
|
28562
|
-
|
|
28563
|
-
|
|
29160
|
+
- **Over the preview, the person's browser is the renderer.** If no tab
|
|
29161
|
+
shows the preview, `connect()` fails within seconds — once per run, not
|
|
29162
|
+
once per test — with a message naming the cause and the alternative
|
|
29163
|
+
(`MOL_E2E_PROVIDER=playwright`, a real browser that needs no tab; every
|
|
29164
|
+
sandbox ships one). Keep the IDE tab open (the IDE holds a screen wake
|
|
29165
|
+
lock while a build runs) or open the preview URL in any other tab — any
|
|
29166
|
+
connected viewer will do.
|
|
28564
29167
|
- `createEvaluatePage()` is how a bond that can only run code inside a page
|
|
28565
29168
|
(an `E2ETransport`) gets the whole Playwright-shaped page; the preview
|
|
28566
29169
|
bond uses it, and so can any future one.
|