@molecule/app-e2e-fixtures-default 1.2.6 → 1.2.8
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 +1211 -151
- package/dist/console-guard.d.ts +2 -2
- package/dist/console-guard.d.ts.map +1 -1
- package/dist/console-guard.js +58 -60
- package/dist/console-guard.js.map +1 -1
- package/dist/expect.d.ts.map +1 -1
- package/dist/expect.js +1 -1
- package/dist/expect.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +59 -34
- package/dist/page.js.map +1 -1
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +4 -4
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +49 -7
- package/dist/test.js.map +1 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@ 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-11-
|
|
6
|
+
Generated: 2026-11-26T03:52:28.434Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-e2e-fixtures-default
|
|
10
10
|
|
|
11
11
|
The `@playwright/test` drop-in for molecule apps: Playwright's `test`,
|
|
12
12
|
`expect` and `page`, with the browser supplied by the bonded e2e provider
|
|
13
|
-
and a console-error guard on
|
|
13
|
+
and a console-error guard on the page fixture.
|
|
14
14
|
|
|
15
15
|
Import `test` and `expect` from here instead of `@playwright/test` and
|
|
16
16
|
write ordinary Playwright specs. Which browser runs them is the e2e bond
|
|
@@ -19,7 +19,8 @@ write ordinary Playwright specs. Which browser runs them is the e2e bond
|
|
|
19
19
|
- **`@molecule/app-e2e-playwright`** launches a real Playwright browser.
|
|
20
20
|
Every molecule sandbox image bakes Chromium, so this is what a sandbox
|
|
21
21
|
uses as well as your own machine and CI — the specs run against the app's
|
|
22
|
-
dev server on `localhost
|
|
22
|
+
dev server on `localhost`. The suite installs the managed browser it needs
|
|
23
|
+
on first use. Set `MOL_E2E_SKIP_BROWSER_INSTALL=1` if you provision it yourself.
|
|
23
24
|
- **`@molecule/app-e2e-preview`** drives the LIVE PREVIEW the molecule.dev
|
|
24
25
|
IDE is showing — the page the person is looking at, in their own browser —
|
|
25
26
|
over a WebSocket through the dev server. Pick it with
|
|
@@ -33,7 +34,7 @@ when a Playwright browser is installed and `preview` when none is; and
|
|
|
33
34
|
matching provider (and `test` bonds it by name as a fallback); `test` reads
|
|
34
35
|
the same answer to decide whether to launch a browser.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
Tests using the page fixture carry the console-error guard: the page's `pageerror`
|
|
37
38
|
and `console.error` events fail the test at teardown, so a spec that only
|
|
38
39
|
asserts on `page.request` cannot stay green while the rendered page is
|
|
39
40
|
blank. Allow a known error with
|
|
@@ -75,7 +76,7 @@ test('the phone layout keeps the prose large', async ({ page }) => {
|
|
|
75
76
|
## Installation
|
|
76
77
|
|
|
77
78
|
```bash
|
|
78
|
-
npm install @molecule/app-e2e-fixtures-default @molecule/app-bond @molecule/app-e2e @playwright/test
|
|
79
|
+
npm install @molecule/app-e2e-fixtures-default @molecule/app-bond @molecule/app-e2e @molecule/app-e2e-playwright @playwright/test
|
|
79
80
|
```
|
|
80
81
|
|
|
81
82
|
## API
|
|
@@ -872,6 +873,7 @@ interface Browser {
|
|
|
872
873
|
behavior?: 'wait' | 'ignoreErrors' | 'default'
|
|
873
874
|
},
|
|
874
875
|
): Promise<void>
|
|
876
|
+
/** Emitted when a new browser context is created. */
|
|
875
877
|
on(event: 'context', listener: (browserContext: BrowserContext) => any): this
|
|
876
878
|
|
|
877
879
|
on(event: 'disconnected', listener: (browser: Browser) => any): this
|
|
@@ -880,18 +882,23 @@ interface Browser {
|
|
|
880
882
|
|
|
881
883
|
once(event: 'disconnected', listener: (browser: Browser) => any): this
|
|
882
884
|
|
|
885
|
+
/** Emitted when a new browser context is created. */
|
|
883
886
|
addListener(event: 'context', listener: (browserContext: BrowserContext) => any): this
|
|
884
887
|
|
|
885
888
|
addListener(event: 'disconnected', listener: (browser: Browser) => any): this
|
|
886
889
|
|
|
887
890
|
removeListener(event: 'context', listener: (browserContext: BrowserContext) => any): this
|
|
888
891
|
|
|
892
|
+
/** Removes an event listener added by `on` or `addListener`. */
|
|
889
893
|
removeListener(event: 'disconnected', listener: (browser: Browser) => any): this
|
|
890
894
|
|
|
895
|
+
/** Removes an event listener added by `on` or `addListener`. */
|
|
891
896
|
off(event: 'context', listener: (browserContext: BrowserContext) => any): this
|
|
892
897
|
|
|
898
|
+
/** Removes an event listener added by `on` or `addListener`. */
|
|
893
899
|
off(event: 'disconnected', listener: (browser: Browser) => any): this
|
|
894
900
|
|
|
901
|
+
/** Emitted when a new browser context is created. */
|
|
895
902
|
prependListener(event: 'context', listener: (browserContext: BrowserContext) => any): this
|
|
896
903
|
|
|
897
904
|
prependListener(event: 'disconnected', listener: (browser: Browser) => any): this
|
|
@@ -899,12 +906,16 @@ interface Browser {
|
|
|
899
906
|
bind(
|
|
900
907
|
title: string,
|
|
901
908
|
options?: {
|
|
909
|
+
/** Host to bind the web socket server to. */
|
|
902
910
|
host?: string
|
|
903
911
|
|
|
912
|
+
/** Additional metadata to associate with the browser server. */
|
|
904
913
|
metadata?: { [key: string]: any }
|
|
905
914
|
|
|
915
|
+
/** Port to bind the web socket server to. */
|
|
906
916
|
port?: number
|
|
907
917
|
|
|
918
|
+
/** Working directory associated with this browser server. */
|
|
908
919
|
workspaceDir?: string
|
|
909
920
|
},
|
|
910
921
|
): Promise<{
|
|
@@ -915,36 +926,48 @@ interface Browser {
|
|
|
915
926
|
|
|
916
927
|
close(options?: { reason?: string }): Promise<void>
|
|
917
928
|
|
|
929
|
+
/** Returns an array of all open browser contexts. */
|
|
918
930
|
contexts(): Array<BrowserContext>
|
|
919
931
|
|
|
932
|
+
/** Indicates that the browser is connected. */
|
|
920
933
|
isConnected(): boolean
|
|
921
934
|
|
|
922
935
|
newBrowserCDPSession(): Promise<CDPSession>
|
|
923
936
|
|
|
937
|
+
/** Creates a new browser context. */
|
|
924
938
|
newContext(options?: BrowserContextOptions): Promise<BrowserContext>
|
|
925
939
|
|
|
940
|
+
/** Creates a new page in a new browser context. */
|
|
926
941
|
newPage(options?: {
|
|
942
|
+
/** Whether to automatically download all the attachments. */
|
|
927
943
|
acceptDownloads?: boolean
|
|
928
944
|
|
|
929
945
|
baseURL?: string
|
|
930
946
|
|
|
947
|
+
/** Toggles bypassing page's Content-Security-Policy. */
|
|
931
948
|
bypassCSP?: boolean
|
|
932
949
|
|
|
933
950
|
clientCertificates?: Array<{
|
|
951
|
+
/** Exact origin that the certificate is valid for. */
|
|
934
952
|
origin: string
|
|
935
953
|
|
|
954
|
+
/** Path to the file with the certificate in PEM format. */
|
|
936
955
|
certPath?: string
|
|
937
956
|
|
|
957
|
+
/** Direct value of the certificate in PEM format. */
|
|
938
958
|
cert?: Buffer
|
|
939
959
|
|
|
960
|
+
/** Path to the file with the private key in PEM format. */
|
|
940
961
|
keyPath?: string
|
|
941
962
|
|
|
963
|
+
/** Direct value of the private key in PEM format. */
|
|
942
964
|
key?: Buffer
|
|
943
965
|
|
|
944
966
|
pfxPath?: string
|
|
945
967
|
|
|
946
968
|
pfx?: Buffer
|
|
947
969
|
|
|
970
|
+
/** Passphrase for the private key (PEM or PFX). */
|
|
948
971
|
passphrase?: string
|
|
949
972
|
}>
|
|
950
973
|
|
|
@@ -952,6 +975,7 @@ interface Browser {
|
|
|
952
975
|
|
|
953
976
|
contrast?: null | 'no-preference' | 'more'
|
|
954
977
|
|
|
978
|
+
/** Specify device scale factor (can be thought of as dpr). */
|
|
955
979
|
deviceScaleFactor?: number
|
|
956
980
|
|
|
957
981
|
extraHTTPHeaders?: { [key: string]: string }
|
|
@@ -959,13 +983,17 @@ interface Browser {
|
|
|
959
983
|
forcedColors?: null | 'active' | 'none'
|
|
960
984
|
|
|
961
985
|
geolocation?: {
|
|
986
|
+
/** Latitude between -90 and 90. */
|
|
962
987
|
latitude: number
|
|
963
988
|
|
|
989
|
+
/** Longitude between -180 and 180. */
|
|
964
990
|
longitude: number
|
|
965
991
|
|
|
992
|
+
/** Non-negative accuracy value. */
|
|
966
993
|
accuracy?: number
|
|
967
994
|
}
|
|
968
995
|
|
|
996
|
+
/** Specifies if viewport supports touch events. */
|
|
969
997
|
hasTouch?: boolean
|
|
970
998
|
|
|
971
999
|
httpCredentials?:
|
|
@@ -992,17 +1020,21 @@ interface Browser {
|
|
|
992
1020
|
|
|
993
1021
|
isMobile?: boolean
|
|
994
1022
|
|
|
1023
|
+
/** Whether or not to enable JavaScript in the context. */
|
|
995
1024
|
javaScriptEnabled?: boolean
|
|
996
1025
|
|
|
997
1026
|
locale?: string
|
|
998
1027
|
|
|
999
1028
|
logger?: Logger
|
|
1000
1029
|
|
|
1030
|
+
/** Whether to emulate network being offline. */
|
|
1001
1031
|
offline?: boolean
|
|
1002
1032
|
|
|
1003
1033
|
permissions?: Array<string>
|
|
1004
1034
|
|
|
1035
|
+
/** Network proxy settings to use with this context. */
|
|
1005
1036
|
proxy?: {
|
|
1037
|
+
/** Proxy to be used for all requests. */
|
|
1006
1038
|
server: string
|
|
1007
1039
|
|
|
1008
1040
|
bypass?: string
|
|
@@ -1015,8 +1047,10 @@ interface Browser {
|
|
|
1015
1047
|
recordHar?: {
|
|
1016
1048
|
omitContent?: boolean
|
|
1017
1049
|
|
|
1050
|
+
/** Optional setting to control resource content management. */
|
|
1018
1051
|
content?: 'omit' | 'embed' | 'attach'
|
|
1019
1052
|
|
|
1053
|
+
/** Path on the filesystem to write the HAR file to. */
|
|
1020
1054
|
path: string
|
|
1021
1055
|
|
|
1022
1056
|
mode?: 'full' | 'minimal'
|
|
@@ -1025,30 +1059,41 @@ interface Browser {
|
|
|
1025
1059
|
}
|
|
1026
1060
|
|
|
1027
1061
|
recordVideo?: {
|
|
1062
|
+
/** Path to the directory to put videos into. */
|
|
1028
1063
|
dir?: string
|
|
1029
1064
|
|
|
1065
|
+
/** Optional dimensions of the recorded videos. */
|
|
1030
1066
|
size?: {
|
|
1067
|
+
/** Video frame width. */
|
|
1031
1068
|
width: number
|
|
1032
1069
|
|
|
1070
|
+
/** Video frame height. */
|
|
1033
1071
|
height: number
|
|
1034
1072
|
}
|
|
1035
1073
|
|
|
1074
|
+
/** Frame rate of the recorded videos in frames per second. */
|
|
1036
1075
|
fps?: number
|
|
1037
1076
|
|
|
1038
1077
|
showActions?: {
|
|
1078
|
+
/** How long each annotation is displayed in milliseconds. */
|
|
1039
1079
|
duration?: number
|
|
1040
1080
|
|
|
1081
|
+
/** Position of the action title overlay. */
|
|
1041
1082
|
position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right'
|
|
1042
1083
|
|
|
1084
|
+
/** Font size of the action title in pixels. */
|
|
1043
1085
|
fontSize?: number
|
|
1044
1086
|
|
|
1087
|
+
/** Cursor decoration shown for pointer actions. */
|
|
1045
1088
|
cursor?: 'none' | 'pointer'
|
|
1046
1089
|
|
|
1090
|
+
/** Styles of the action decorations. */
|
|
1047
1091
|
style?: {
|
|
1048
1092
|
point?: string
|
|
1049
1093
|
|
|
1050
1094
|
highlight?: string
|
|
1051
1095
|
|
|
1096
|
+
/** CSS declarations for the action title. */
|
|
1052
1097
|
title?: string
|
|
1053
1098
|
}
|
|
1054
1099
|
}
|
|
@@ -1057,37 +1102,46 @@ interface Browser {
|
|
|
1057
1102
|
reducedMotion?: null | 'reduce' | 'no-preference'
|
|
1058
1103
|
|
|
1059
1104
|
screen?: {
|
|
1105
|
+
/** page width in pixels. */
|
|
1060
1106
|
width: number
|
|
1061
1107
|
|
|
1108
|
+
/** page height in pixels. */
|
|
1062
1109
|
height: number
|
|
1063
1110
|
}
|
|
1064
1111
|
|
|
1112
|
+
/** Whether to allow sites to register Service workers. */
|
|
1065
1113
|
serviceWorkers?: 'allow' | 'block'
|
|
1066
1114
|
|
|
1067
1115
|
storageState?:
|
|
1068
1116
|
| string
|
|
1069
1117
|
| {
|
|
1118
|
+
/** Cookies to set for context */
|
|
1070
1119
|
cookies: Array<{
|
|
1071
1120
|
name: string
|
|
1072
1121
|
|
|
1073
1122
|
value: string
|
|
1074
1123
|
|
|
1124
|
+
/** Domain and path are required. */
|
|
1075
1125
|
domain: string
|
|
1076
1126
|
|
|
1127
|
+
/** Domain and path are required */
|
|
1077
1128
|
path: string
|
|
1078
1129
|
|
|
1130
|
+
/** Unix time in seconds. */
|
|
1079
1131
|
expires: number
|
|
1080
1132
|
|
|
1081
1133
|
httpOnly: boolean
|
|
1082
1134
|
|
|
1083
1135
|
secure: boolean
|
|
1084
1136
|
|
|
1137
|
+
/** sameSite flag */
|
|
1085
1138
|
sameSite: 'Strict' | 'Lax' | 'None'
|
|
1086
1139
|
}>
|
|
1087
1140
|
|
|
1088
1141
|
origins: Array<{
|
|
1089
1142
|
origin: string
|
|
1090
1143
|
|
|
1144
|
+
/** localStorage to set for context */
|
|
1091
1145
|
localStorage: Array<{
|
|
1092
1146
|
name: string
|
|
1093
1147
|
|
|
@@ -1098,13 +1152,18 @@ interface Browser {
|
|
|
1098
1152
|
|
|
1099
1153
|
strictSelectors?: boolean
|
|
1100
1154
|
|
|
1155
|
+
/** Changes the timezone of the context. */
|
|
1101
1156
|
timezoneId?: string
|
|
1102
1157
|
|
|
1158
|
+
/** Specific user agent to use in this context. */
|
|
1103
1159
|
userAgent?: string
|
|
1104
1160
|
|
|
1161
|
+
/** Emulates consistent viewport for each page. */
|
|
1105
1162
|
viewport?: null | {
|
|
1163
|
+
/** page width in pixels. */
|
|
1106
1164
|
width: number
|
|
1107
1165
|
|
|
1166
|
+
/** page height in pixels. */
|
|
1108
1167
|
height: number
|
|
1109
1168
|
}
|
|
1110
1169
|
}): Promise<Page>
|
|
@@ -1112,10 +1171,13 @@ interface Browser {
|
|
|
1112
1171
|
startTracing(
|
|
1113
1172
|
page?: Page,
|
|
1114
1173
|
options?: {
|
|
1174
|
+
/** specify custom categories to use instead of default. */
|
|
1115
1175
|
categories?: Array<string>
|
|
1116
1176
|
|
|
1177
|
+
/** A path to write the trace file to. */
|
|
1117
1178
|
path?: string
|
|
1118
1179
|
|
|
1180
|
+
/** captures screenshots in the trace. */
|
|
1119
1181
|
screenshots?: boolean
|
|
1120
1182
|
},
|
|
1121
1183
|
): Promise<void>
|
|
@@ -1124,13 +1186,14 @@ interface Browser {
|
|
|
1124
1186
|
|
|
1125
1187
|
unbind(): Promise<void>
|
|
1126
1188
|
|
|
1189
|
+
/** Returns the browser version. */
|
|
1127
1190
|
version(): string
|
|
1128
1191
|
|
|
1129
1192
|
[Symbol.asyncDispose](): Promise<void>
|
|
1130
1193
|
}
|
|
1131
1194
|
```
|
|
1132
1195
|
|
|
1133
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
1196
|
+
_(Member comments are shortened to their first sentence, and the 50 longest are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
1134
1197
|
|
|
1135
1198
|
#### `JSHandle`
|
|
1136
1199
|
|
|
@@ -1643,14 +1706,17 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1643
1706
|
}): Promise<void>
|
|
1644
1707
|
|
|
1645
1708
|
click(options?: {
|
|
1709
|
+
/** Defaults to `left`. */
|
|
1646
1710
|
button?: 'left' | 'right' | 'middle'
|
|
1647
1711
|
|
|
1712
|
+
/** defaults to 1. */
|
|
1648
1713
|
clickCount?: number
|
|
1649
1714
|
|
|
1650
1715
|
delay?: number
|
|
1651
1716
|
|
|
1652
1717
|
force?: boolean
|
|
1653
1718
|
|
|
1719
|
+
/** Modifier keys to press. */
|
|
1654
1720
|
modifiers?: Array<'Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift'>
|
|
1655
1721
|
|
|
1656
1722
|
noWaitAfter?: boolean
|
|
@@ -1665,6 +1731,7 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1665
1731
|
|
|
1666
1732
|
signal?: AbortSignal
|
|
1667
1733
|
|
|
1734
|
+
/** Defaults to 1. */
|
|
1668
1735
|
steps?: number
|
|
1669
1736
|
|
|
1670
1737
|
timeout?: number
|
|
@@ -1675,12 +1742,14 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1675
1742
|
contentFrame(): Promise<null | Frame>
|
|
1676
1743
|
|
|
1677
1744
|
dblclick(options?: {
|
|
1745
|
+
/** Defaults to `left`. */
|
|
1678
1746
|
button?: 'left' | 'right' | 'middle'
|
|
1679
1747
|
|
|
1680
1748
|
delay?: number
|
|
1681
1749
|
|
|
1682
1750
|
force?: boolean
|
|
1683
1751
|
|
|
1752
|
+
/** Modifier keys to press. */
|
|
1684
1753
|
modifiers?: Array<'Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift'>
|
|
1685
1754
|
|
|
1686
1755
|
noWaitAfter?: boolean
|
|
@@ -1695,6 +1764,7 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1695
1764
|
|
|
1696
1765
|
signal?: AbortSignal
|
|
1697
1766
|
|
|
1767
|
+
/** Defaults to 1. */
|
|
1698
1768
|
steps?: number
|
|
1699
1769
|
|
|
1700
1770
|
timeout?: number
|
|
@@ -1724,6 +1794,7 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1724
1794
|
hover(options?: {
|
|
1725
1795
|
force?: boolean
|
|
1726
1796
|
|
|
1797
|
+
/** Modifier keys to press. */
|
|
1727
1798
|
modifiers?: Array<'Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift'>
|
|
1728
1799
|
|
|
1729
1800
|
noWaitAfter?: boolean
|
|
@@ -1815,18 +1886,24 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1815
1886
|
| ElementHandle
|
|
1816
1887
|
| ReadonlyArray<string>
|
|
1817
1888
|
| {
|
|
1889
|
+
/** Matches by `option.value`. */
|
|
1818
1890
|
value?: string
|
|
1819
1891
|
|
|
1892
|
+
/** Matches by `option.label`. */
|
|
1820
1893
|
label?: string
|
|
1821
1894
|
|
|
1895
|
+
/** Matches by the index. */
|
|
1822
1896
|
index?: number
|
|
1823
1897
|
}
|
|
1824
1898
|
| ReadonlyArray<ElementHandle>
|
|
1825
1899
|
| ReadonlyArray<{
|
|
1900
|
+
/** Matches by `option.value`. */
|
|
1826
1901
|
value?: string
|
|
1827
1902
|
|
|
1903
|
+
/** Matches by `option.label`. */
|
|
1828
1904
|
label?: string
|
|
1829
1905
|
|
|
1906
|
+
/** Matches by the index. */
|
|
1830
1907
|
index?: number
|
|
1831
1908
|
}>,
|
|
1832
1909
|
options?: {
|
|
@@ -1876,17 +1953,23 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1876
1953
|
| string
|
|
1877
1954
|
| ReadonlyArray<string>
|
|
1878
1955
|
| {
|
|
1956
|
+
/** File name */
|
|
1879
1957
|
name: string
|
|
1880
1958
|
|
|
1959
|
+
/** File type */
|
|
1881
1960
|
mimeType: string
|
|
1882
1961
|
|
|
1962
|
+
/** File content */
|
|
1883
1963
|
buffer: Buffer
|
|
1884
1964
|
}
|
|
1885
1965
|
| ReadonlyArray<{
|
|
1966
|
+
/** File name */
|
|
1886
1967
|
name: string
|
|
1887
1968
|
|
|
1969
|
+
/** File type */
|
|
1888
1970
|
mimeType: string
|
|
1889
1971
|
|
|
1972
|
+
/** File content */
|
|
1890
1973
|
buffer: Buffer
|
|
1891
1974
|
}>,
|
|
1892
1975
|
options?: {
|
|
@@ -1901,6 +1984,7 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1901
1984
|
tap(options?: {
|
|
1902
1985
|
force?: boolean
|
|
1903
1986
|
|
|
1987
|
+
/** Modifier keys to press. */
|
|
1904
1988
|
modifiers?: Array<'Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift'>
|
|
1905
1989
|
|
|
1906
1990
|
noWaitAfter?: boolean
|
|
@@ -1950,6 +2034,7 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1950
2034
|
|
|
1951
2035
|
signal?: AbortSignal
|
|
1952
2036
|
|
|
2037
|
+
/** Maximum time in milliseconds. */
|
|
1953
2038
|
timeout?: number
|
|
1954
2039
|
|
|
1955
2040
|
trial?: boolean
|
|
@@ -1960,13 +2045,14 @@ interface ElementHandle<T = Node> extends JSHandle<T> {
|
|
|
1960
2045
|
options?: {
|
|
1961
2046
|
signal?: AbortSignal
|
|
1962
2047
|
|
|
2048
|
+
/** Maximum time in milliseconds. */
|
|
1963
2049
|
timeout?: number
|
|
1964
2050
|
},
|
|
1965
2051
|
): Promise<void>
|
|
1966
2052
|
}
|
|
1967
2053
|
```
|
|
1968
2054
|
|
|
1969
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
2055
|
+
_(Member comments are shortened to their first sentence, and the 140 longest are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
1970
2056
|
|
|
1971
2057
|
#### `Locator`
|
|
1972
2058
|
|
|
@@ -2401,17 +2487,21 @@ interface BrowserType<Unused = {}> {
|
|
|
2401
2487
|
transport: ConnectOverCDPTransport,
|
|
2402
2488
|
options?: ConnectOverCDPOptions,
|
|
2403
2489
|
): Promise<Browser>
|
|
2490
|
+
/** Option `wsEndpoint` is deprecated. @deprecated */
|
|
2404
2491
|
connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>
|
|
2405
2492
|
|
|
2406
2493
|
connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>
|
|
2494
|
+
/** wsEndpoint in options is deprecated. @deprecated */
|
|
2407
2495
|
connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>
|
|
2408
2496
|
executablePath(): string
|
|
2409
2497
|
|
|
2410
2498
|
launch(options?: LaunchOptions): Promise<Browser>
|
|
2411
2499
|
|
|
2500
|
+
/** Returns the persistent browser context instance. */
|
|
2412
2501
|
launchPersistentContext(
|
|
2413
2502
|
userDataDir: string,
|
|
2414
2503
|
options?: {
|
|
2504
|
+
/** Whether to automatically download all the attachments. */
|
|
2415
2505
|
acceptDownloads?: boolean
|
|
2416
2506
|
|
|
2417
2507
|
args?: Array<string>
|
|
@@ -2420,27 +2510,36 @@ interface BrowserType<Unused = {}> {
|
|
|
2420
2510
|
|
|
2421
2511
|
baseURL?: string
|
|
2422
2512
|
|
|
2513
|
+
/** Toggles bypassing page's Content-Security-Policy. */
|
|
2423
2514
|
bypassCSP?: boolean
|
|
2424
2515
|
|
|
2516
|
+
/** Browser distribution channel. */
|
|
2425
2517
|
channel?: string
|
|
2426
2518
|
|
|
2519
|
+
/** Enable Chromium sandboxing. */
|
|
2427
2520
|
chromiumSandbox?: boolean
|
|
2428
2521
|
|
|
2429
2522
|
clientCertificates?: Array<{
|
|
2523
|
+
/** Exact origin that the certificate is valid for. */
|
|
2430
2524
|
origin: string
|
|
2431
2525
|
|
|
2526
|
+
/** Path to the file with the certificate in PEM format. */
|
|
2432
2527
|
certPath?: string
|
|
2433
2528
|
|
|
2529
|
+
/** Direct value of the certificate in PEM format. */
|
|
2434
2530
|
cert?: Buffer
|
|
2435
2531
|
|
|
2532
|
+
/** Path to the file with the private key in PEM format. */
|
|
2436
2533
|
keyPath?: string
|
|
2437
2534
|
|
|
2535
|
+
/** Direct value of the private key in PEM format. */
|
|
2438
2536
|
key?: Buffer
|
|
2439
2537
|
|
|
2440
2538
|
pfxPath?: string
|
|
2441
2539
|
|
|
2442
2540
|
pfx?: Buffer
|
|
2443
2541
|
|
|
2542
|
+
/** Passphrase for the private key (PEM or PFX). */
|
|
2444
2543
|
passphrase?: string
|
|
2445
2544
|
}>
|
|
2446
2545
|
|
|
@@ -2448,6 +2547,7 @@ interface BrowserType<Unused = {}> {
|
|
|
2448
2547
|
|
|
2449
2548
|
contrast?: null | 'no-preference' | 'more'
|
|
2450
2549
|
|
|
2550
|
+
/** Specify device scale factor (can be thought of as dpr). */
|
|
2451
2551
|
deviceScaleFactor?: number
|
|
2452
2552
|
|
|
2453
2553
|
downloadsPath?: string
|
|
@@ -2458,26 +2558,35 @@ interface BrowserType<Unused = {}> {
|
|
|
2458
2558
|
|
|
2459
2559
|
extraHTTPHeaders?: { [key: string]: string }
|
|
2460
2560
|
|
|
2561
|
+
/** Firefox user preferences. */
|
|
2461
2562
|
firefoxUserPrefs?: { [key: string]: string | number | boolean }
|
|
2462
2563
|
|
|
2463
2564
|
forcedColors?: null | 'active' | 'none'
|
|
2464
2565
|
|
|
2465
2566
|
geolocation?: {
|
|
2567
|
+
/** Latitude between -90 and 90. */
|
|
2466
2568
|
latitude: number
|
|
2467
2569
|
|
|
2570
|
+
/** Longitude between -180 and 180. */
|
|
2468
2571
|
longitude: number
|
|
2469
2572
|
|
|
2573
|
+
/** Non-negative accuracy value. */
|
|
2470
2574
|
accuracy?: number
|
|
2471
2575
|
}
|
|
2472
2576
|
|
|
2577
|
+
/** Close the browser process on SIGHUP. */
|
|
2473
2578
|
handleSIGHUP?: boolean
|
|
2474
2579
|
|
|
2580
|
+
/** Close the browser process on Ctrl-C. */
|
|
2475
2581
|
handleSIGINT?: boolean
|
|
2476
2582
|
|
|
2583
|
+
/** Close the browser process on SIGTERM. */
|
|
2477
2584
|
handleSIGTERM?: boolean
|
|
2478
2585
|
|
|
2586
|
+
/** Specifies if viewport supports touch events. */
|
|
2479
2587
|
hasTouch?: boolean
|
|
2480
2588
|
|
|
2589
|
+
/** Whether to run browser in headless mode. */
|
|
2481
2590
|
headless?: boolean
|
|
2482
2591
|
|
|
2483
2592
|
httpCredentials?:
|
|
@@ -2502,21 +2611,27 @@ interface BrowserType<Unused = {}> {
|
|
|
2502
2611
|
|
|
2503
2612
|
ignoreDefaultArgs?: boolean | Array<string>
|
|
2504
2613
|
|
|
2614
|
+
/** Whether to ignore HTTPS errors when sending network requests. */
|
|
2505
2615
|
ignoreHTTPSErrors?: boolean
|
|
2506
2616
|
|
|
2507
2617
|
isMobile?: boolean
|
|
2508
2618
|
|
|
2619
|
+
/** Whether or not to enable JavaScript in the context. */
|
|
2509
2620
|
javaScriptEnabled?: boolean
|
|
2510
2621
|
|
|
2511
2622
|
locale?: string
|
|
2512
2623
|
|
|
2513
2624
|
logger?: Logger
|
|
2514
2625
|
|
|
2626
|
+
/** Whether to emulate network being offline. */
|
|
2515
2627
|
offline?: boolean
|
|
2516
2628
|
|
|
2629
|
+
/** A list of permissions to grant to all pages in this context. */
|
|
2517
2630
|
permissions?: Array<string>
|
|
2518
2631
|
|
|
2632
|
+
/** Network proxy settings. */
|
|
2519
2633
|
proxy?: {
|
|
2634
|
+
/** Proxy to be used for all requests. */
|
|
2520
2635
|
server: string
|
|
2521
2636
|
|
|
2522
2637
|
bypass?: string
|
|
@@ -2529,8 +2644,10 @@ interface BrowserType<Unused = {}> {
|
|
|
2529
2644
|
recordHar?: {
|
|
2530
2645
|
omitContent?: boolean
|
|
2531
2646
|
|
|
2647
|
+
/** Optional setting to control resource content management. */
|
|
2532
2648
|
content?: 'omit' | 'embed' | 'attach'
|
|
2533
2649
|
|
|
2650
|
+
/** Path on the filesystem to write the HAR file to. */
|
|
2534
2651
|
path: string
|
|
2535
2652
|
|
|
2536
2653
|
mode?: 'full' | 'minimal'
|
|
@@ -2539,30 +2656,42 @@ interface BrowserType<Unused = {}> {
|
|
|
2539
2656
|
}
|
|
2540
2657
|
|
|
2541
2658
|
recordVideo?: {
|
|
2659
|
+
/** Path to the directory to put videos into. */
|
|
2542
2660
|
dir?: string
|
|
2543
2661
|
|
|
2662
|
+
/** Optional dimensions of the recorded videos. */
|
|
2544
2663
|
size?: {
|
|
2664
|
+
/** Video frame width. */
|
|
2545
2665
|
width: number
|
|
2546
2666
|
|
|
2667
|
+
/** Video frame height. */
|
|
2547
2668
|
height: number
|
|
2548
2669
|
}
|
|
2549
2670
|
|
|
2671
|
+
/** Frame rate of the recorded videos in frames per second. */
|
|
2550
2672
|
fps?: number
|
|
2551
2673
|
|
|
2552
2674
|
showActions?: {
|
|
2675
|
+
/** How long each annotation is displayed in milliseconds. */
|
|
2553
2676
|
duration?: number
|
|
2554
2677
|
|
|
2678
|
+
/** Position of the action title overlay. */
|
|
2555
2679
|
position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right'
|
|
2556
2680
|
|
|
2681
|
+
/** Font size of the action title in pixels. */
|
|
2557
2682
|
fontSize?: number
|
|
2558
2683
|
|
|
2684
|
+
/** Cursor decoration shown for pointer actions. */
|
|
2559
2685
|
cursor?: 'none' | 'pointer'
|
|
2560
2686
|
|
|
2687
|
+
/** Styles of the action decorations. */
|
|
2561
2688
|
style?: {
|
|
2562
2689
|
point?: string
|
|
2563
2690
|
|
|
2691
|
+
/** CSS declarations for the box that covers the target element. */
|
|
2564
2692
|
highlight?: string
|
|
2565
2693
|
|
|
2694
|
+
/** CSS declarations for the action title. */
|
|
2566
2695
|
title?: string
|
|
2567
2696
|
}
|
|
2568
2697
|
}
|
|
@@ -2571,88 +2700,116 @@ interface BrowserType<Unused = {}> {
|
|
|
2571
2700
|
reducedMotion?: null | 'reduce' | 'no-preference'
|
|
2572
2701
|
|
|
2573
2702
|
screen?: {
|
|
2703
|
+
/** page width in pixels. */
|
|
2574
2704
|
width: number
|
|
2575
2705
|
|
|
2706
|
+
/** page height in pixels. */
|
|
2576
2707
|
height: number
|
|
2577
2708
|
}
|
|
2578
2709
|
|
|
2710
|
+
/** Whether to allow sites to register Service workers. */
|
|
2579
2711
|
serviceWorkers?: 'allow' | 'block'
|
|
2580
2712
|
|
|
2581
2713
|
slowMo?: number
|
|
2582
2714
|
|
|
2715
|
+
/** If set to true, enables strict selectors mode for this context. */
|
|
2583
2716
|
strictSelectors?: boolean
|
|
2584
2717
|
|
|
2585
2718
|
timeout?: number
|
|
2586
2719
|
|
|
2720
|
+
/** Changes the timezone of the context. */
|
|
2587
2721
|
timezoneId?: string
|
|
2588
2722
|
|
|
2723
|
+
/** If specified, traces are saved into this directory. */
|
|
2589
2724
|
tracesDir?: string
|
|
2590
2725
|
|
|
2726
|
+
/** Specific user agent to use in this context. */
|
|
2591
2727
|
userAgent?: string
|
|
2592
2728
|
|
|
2729
|
+
/** Emulates consistent viewport for each page. */
|
|
2593
2730
|
viewport?: null | {
|
|
2731
|
+
/** page width in pixels. */
|
|
2594
2732
|
width: number
|
|
2595
2733
|
|
|
2734
|
+
/** page height in pixels. */
|
|
2596
2735
|
height: number
|
|
2597
2736
|
}
|
|
2598
2737
|
},
|
|
2599
2738
|
): Promise<BrowserContext>
|
|
2600
2739
|
|
|
2740
|
+
/** Returns the browser app instance. */
|
|
2601
2741
|
launchServer(options?: {
|
|
2602
2742
|
args?: Array<string>
|
|
2603
2743
|
|
|
2604
2744
|
artifactsDir?: string
|
|
2605
2745
|
|
|
2746
|
+
/** Browser distribution channel. */
|
|
2606
2747
|
channel?: string
|
|
2607
2748
|
|
|
2749
|
+
/** Enable Chromium sandboxing. */
|
|
2608
2750
|
chromiumSandbox?: boolean
|
|
2609
2751
|
|
|
2610
2752
|
downloadsPath?: string
|
|
2611
2753
|
|
|
2612
2754
|
env?: { [key: string]: string | undefined }
|
|
2613
2755
|
|
|
2756
|
+
/** Path to a browser executable to run instead of the bundled one. */
|
|
2614
2757
|
executablePath?: string
|
|
2615
2758
|
|
|
2759
|
+
/** Firefox user preferences. */
|
|
2616
2760
|
firefoxUserPrefs?: { [key: string]: string | number | boolean }
|
|
2617
2761
|
|
|
2762
|
+
/** Close the browser process on SIGHUP. */
|
|
2618
2763
|
handleSIGHUP?: boolean
|
|
2619
2764
|
|
|
2765
|
+
/** Close the browser process on Ctrl-C. */
|
|
2620
2766
|
handleSIGINT?: boolean
|
|
2621
2767
|
|
|
2768
|
+
/** Close the browser process on SIGTERM. */
|
|
2622
2769
|
handleSIGTERM?: boolean
|
|
2623
2770
|
|
|
2771
|
+
/** Whether to run browser in headless mode. */
|
|
2624
2772
|
headless?: boolean
|
|
2625
2773
|
|
|
2774
|
+
/** Host to use for the web socket. */
|
|
2626
2775
|
host?: string
|
|
2627
2776
|
|
|
2628
2777
|
ignoreDefaultArgs?: boolean | Array<string>
|
|
2629
2778
|
|
|
2630
2779
|
logger?: Logger
|
|
2631
2780
|
|
|
2781
|
+
/** Port to use for the web socket. */
|
|
2632
2782
|
port?: number
|
|
2633
2783
|
|
|
2784
|
+
/** Network proxy settings. */
|
|
2634
2785
|
proxy?: {
|
|
2786
|
+
/** Proxy to be used for all requests. */
|
|
2635
2787
|
server: string
|
|
2636
2788
|
|
|
2637
2789
|
bypass?: string
|
|
2638
2790
|
|
|
2791
|
+
/** Optional username to use if HTTP proxy requires authentication. */
|
|
2639
2792
|
username?: string
|
|
2640
2793
|
|
|
2794
|
+
/** Optional password to use if HTTP proxy requires authentication. */
|
|
2641
2795
|
password?: string
|
|
2642
2796
|
}
|
|
2643
2797
|
|
|
2644
2798
|
timeout?: number
|
|
2645
2799
|
|
|
2800
|
+
/** If specified, traces are saved into this directory. */
|
|
2646
2801
|
tracesDir?: string
|
|
2647
2802
|
|
|
2803
|
+
/** Path at which to serve the Browser Server. */
|
|
2648
2804
|
wsPath?: string
|
|
2649
2805
|
}): Promise<BrowserServer>
|
|
2650
2806
|
|
|
2807
|
+
/** Returns browser name. */
|
|
2651
2808
|
name(): string
|
|
2652
2809
|
}
|
|
2653
2810
|
```
|
|
2654
2811
|
|
|
2655
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
2812
|
+
_(Member comments are shortened to their first sentence, and the 49 longest are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
2656
2813
|
|
|
2657
2814
|
#### `APIRequestContext`
|
|
2658
2815
|
|
|
@@ -2682,6 +2839,7 @@ If you want API requests that do **not** share cookies with the browser, create
|
|
|
2682
2839
|
|
|
2683
2840
|
```typescript
|
|
2684
2841
|
interface APIRequestContext {
|
|
2842
|
+
/** Adds cookies into this request context. */
|
|
2685
2843
|
addCookies(
|
|
2686
2844
|
cookies: ReadonlyArray<{
|
|
2687
2845
|
name: string
|
|
@@ -2694,23 +2852,30 @@ interface APIRequestContext {
|
|
|
2694
2852
|
|
|
2695
2853
|
path?: string
|
|
2696
2854
|
|
|
2855
|
+
/** Unix time in seconds. */
|
|
2697
2856
|
expires?: number
|
|
2698
2857
|
|
|
2858
|
+
/** Optional. */
|
|
2699
2859
|
httpOnly?: boolean
|
|
2700
2860
|
|
|
2861
|
+
/** Optional. */
|
|
2701
2862
|
secure?: boolean
|
|
2702
2863
|
|
|
2864
|
+
/** Optional. */
|
|
2703
2865
|
sameSite?: 'Strict' | 'Lax' | 'None'
|
|
2704
2866
|
|
|
2705
2867
|
partitionKey?: string
|
|
2706
2868
|
}>,
|
|
2707
2869
|
): Promise<void>
|
|
2708
2870
|
|
|
2871
|
+
/** Removes cookies from this request context. */
|
|
2709
2872
|
clearCookies(options?: {
|
|
2710
2873
|
domain?: string | RegExp
|
|
2711
2874
|
|
|
2875
|
+
/** Only removes cookies with the given name. */
|
|
2712
2876
|
name?: string | RegExp
|
|
2713
2877
|
|
|
2878
|
+
/** Only removes cookies with the given path. */
|
|
2714
2879
|
path?: string | RegExp
|
|
2715
2880
|
}): Promise<void>
|
|
2716
2881
|
|
|
@@ -2724,6 +2889,7 @@ interface APIRequestContext {
|
|
|
2724
2889
|
|
|
2725
2890
|
path: string
|
|
2726
2891
|
|
|
2892
|
+
/** Unix time in seconds. */
|
|
2727
2893
|
expires: number
|
|
2728
2894
|
|
|
2729
2895
|
httpOnly: boolean
|
|
@@ -2739,12 +2905,14 @@ interface APIRequestContext {
|
|
|
2739
2905
|
delete<T = any>(
|
|
2740
2906
|
url: string,
|
|
2741
2907
|
options?: {
|
|
2908
|
+
/** Allows to set post data of the request. */
|
|
2742
2909
|
data?: string | Buffer | Serializable
|
|
2743
2910
|
|
|
2744
2911
|
failOnStatusCode?: boolean
|
|
2745
2912
|
|
|
2746
2913
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
2747
2914
|
|
|
2915
|
+
/** Allows to set HTTP headers. */
|
|
2748
2916
|
headers?: { [key: string]: string }
|
|
2749
2917
|
|
|
2750
2918
|
ignoreHTTPSErrors?: boolean
|
|
@@ -2762,18 +2930,23 @@ interface APIRequestContext {
|
|
|
2762
2930
|
| boolean
|
|
2763
2931
|
| ReadStream
|
|
2764
2932
|
| {
|
|
2933
|
+
/** File name */
|
|
2765
2934
|
name: string
|
|
2766
2935
|
|
|
2936
|
+
/** File type */
|
|
2767
2937
|
mimeType: string
|
|
2768
2938
|
|
|
2939
|
+
/** File content */
|
|
2769
2940
|
buffer: Buffer
|
|
2770
2941
|
}
|
|
2771
2942
|
}
|
|
2772
2943
|
|
|
2944
|
+
/** Query parameters to be sent with the URL. */
|
|
2773
2945
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
2774
2946
|
|
|
2775
2947
|
signal?: AbortSignal
|
|
2776
2948
|
|
|
2949
|
+
/** Request timeout in milliseconds. */
|
|
2777
2950
|
timeout?: number
|
|
2778
2951
|
},
|
|
2779
2952
|
): Promise<APIResponse<T>>
|
|
@@ -2783,12 +2956,14 @@ interface APIRequestContext {
|
|
|
2783
2956
|
fetch<T = any>(
|
|
2784
2957
|
urlOrRequest: string | Request,
|
|
2785
2958
|
options?: {
|
|
2959
|
+
/** Allows to set post data of the request. */
|
|
2786
2960
|
data?: string | Buffer | Serializable
|
|
2787
2961
|
|
|
2788
2962
|
failOnStatusCode?: boolean
|
|
2789
2963
|
|
|
2790
2964
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
2791
2965
|
|
|
2966
|
+
/** Allows to set HTTP headers. */
|
|
2792
2967
|
headers?: { [key: string]: string }
|
|
2793
2968
|
|
|
2794
2969
|
ignoreHTTPSErrors?: boolean
|
|
@@ -2808,18 +2983,23 @@ interface APIRequestContext {
|
|
|
2808
2983
|
| boolean
|
|
2809
2984
|
| ReadStream
|
|
2810
2985
|
| {
|
|
2986
|
+
/** File name */
|
|
2811
2987
|
name: string
|
|
2812
2988
|
|
|
2989
|
+
/** File type */
|
|
2813
2990
|
mimeType: string
|
|
2814
2991
|
|
|
2992
|
+
/** File content */
|
|
2815
2993
|
buffer: Buffer
|
|
2816
2994
|
}
|
|
2817
2995
|
}
|
|
2818
2996
|
|
|
2997
|
+
/** Query parameters to be sent with the URL. */
|
|
2819
2998
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
2820
2999
|
|
|
2821
3000
|
signal?: AbortSignal
|
|
2822
3001
|
|
|
3002
|
+
/** Request timeout in milliseconds. */
|
|
2823
3003
|
timeout?: number
|
|
2824
3004
|
},
|
|
2825
3005
|
): Promise<APIResponse<T>>
|
|
@@ -2827,12 +3007,14 @@ interface APIRequestContext {
|
|
|
2827
3007
|
get<T = any>(
|
|
2828
3008
|
url: string,
|
|
2829
3009
|
options?: {
|
|
3010
|
+
/** Allows to set post data of the request. */
|
|
2830
3011
|
data?: string | Buffer | Serializable
|
|
2831
3012
|
|
|
2832
3013
|
failOnStatusCode?: boolean
|
|
2833
3014
|
|
|
2834
3015
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
2835
3016
|
|
|
3017
|
+
/** Allows to set HTTP headers. */
|
|
2836
3018
|
headers?: { [key: string]: string }
|
|
2837
3019
|
|
|
2838
3020
|
ignoreHTTPSErrors?: boolean
|
|
@@ -2850,18 +3032,23 @@ interface APIRequestContext {
|
|
|
2850
3032
|
| boolean
|
|
2851
3033
|
| ReadStream
|
|
2852
3034
|
| {
|
|
3035
|
+
/** File name */
|
|
2853
3036
|
name: string
|
|
2854
3037
|
|
|
3038
|
+
/** File type */
|
|
2855
3039
|
mimeType: string
|
|
2856
3040
|
|
|
3041
|
+
/** File content */
|
|
2857
3042
|
buffer: Buffer
|
|
2858
3043
|
}
|
|
2859
3044
|
}
|
|
2860
3045
|
|
|
3046
|
+
/** Query parameters to be sent with the URL. */
|
|
2861
3047
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
2862
3048
|
|
|
2863
3049
|
signal?: AbortSignal
|
|
2864
3050
|
|
|
3051
|
+
/** Request timeout in milliseconds. */
|
|
2865
3052
|
timeout?: number
|
|
2866
3053
|
},
|
|
2867
3054
|
): Promise<APIResponse<T>>
|
|
@@ -2869,12 +3056,14 @@ interface APIRequestContext {
|
|
|
2869
3056
|
head<T = any>(
|
|
2870
3057
|
url: string,
|
|
2871
3058
|
options?: {
|
|
3059
|
+
/** Allows to set post data of the request. */
|
|
2872
3060
|
data?: string | Buffer | Serializable
|
|
2873
3061
|
|
|
2874
3062
|
failOnStatusCode?: boolean
|
|
2875
3063
|
|
|
2876
3064
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
2877
3065
|
|
|
3066
|
+
/** Allows to set HTTP headers. */
|
|
2878
3067
|
headers?: { [key: string]: string }
|
|
2879
3068
|
|
|
2880
3069
|
ignoreHTTPSErrors?: boolean
|
|
@@ -2892,18 +3081,23 @@ interface APIRequestContext {
|
|
|
2892
3081
|
| boolean
|
|
2893
3082
|
| ReadStream
|
|
2894
3083
|
| {
|
|
3084
|
+
/** File name */
|
|
2895
3085
|
name: string
|
|
2896
3086
|
|
|
3087
|
+
/** File type */
|
|
2897
3088
|
mimeType: string
|
|
2898
3089
|
|
|
3090
|
+
/** File content */
|
|
2899
3091
|
buffer: Buffer
|
|
2900
3092
|
}
|
|
2901
3093
|
}
|
|
2902
3094
|
|
|
3095
|
+
/** Query parameters to be sent with the URL. */
|
|
2903
3096
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
2904
3097
|
|
|
2905
3098
|
signal?: AbortSignal
|
|
2906
3099
|
|
|
3100
|
+
/** Request timeout in milliseconds. */
|
|
2907
3101
|
timeout?: number
|
|
2908
3102
|
},
|
|
2909
3103
|
): Promise<APIResponse<T>>
|
|
@@ -2911,12 +3105,14 @@ interface APIRequestContext {
|
|
|
2911
3105
|
patch<T = any>(
|
|
2912
3106
|
url: string,
|
|
2913
3107
|
options?: {
|
|
3108
|
+
/** Allows to set post data of the request. */
|
|
2914
3109
|
data?: string | Buffer | Serializable
|
|
2915
3110
|
|
|
2916
3111
|
failOnStatusCode?: boolean
|
|
2917
3112
|
|
|
2918
3113
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
2919
3114
|
|
|
3115
|
+
/** Allows to set HTTP headers. */
|
|
2920
3116
|
headers?: { [key: string]: string }
|
|
2921
3117
|
|
|
2922
3118
|
ignoreHTTPSErrors?: boolean
|
|
@@ -2934,18 +3130,23 @@ interface APIRequestContext {
|
|
|
2934
3130
|
| boolean
|
|
2935
3131
|
| ReadStream
|
|
2936
3132
|
| {
|
|
3133
|
+
/** File name */
|
|
2937
3134
|
name: string
|
|
2938
3135
|
|
|
3136
|
+
/** File type */
|
|
2939
3137
|
mimeType: string
|
|
2940
3138
|
|
|
3139
|
+
/** File content */
|
|
2941
3140
|
buffer: Buffer
|
|
2942
3141
|
}
|
|
2943
3142
|
}
|
|
2944
3143
|
|
|
3144
|
+
/** Query parameters to be sent with the URL. */
|
|
2945
3145
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
2946
3146
|
|
|
2947
3147
|
signal?: AbortSignal
|
|
2948
3148
|
|
|
3149
|
+
/** Request timeout in milliseconds. */
|
|
2949
3150
|
timeout?: number
|
|
2950
3151
|
},
|
|
2951
3152
|
): Promise<APIResponse<T>>
|
|
@@ -2953,12 +3154,14 @@ interface APIRequestContext {
|
|
|
2953
3154
|
post<T = any>(
|
|
2954
3155
|
url: string,
|
|
2955
3156
|
options?: {
|
|
3157
|
+
/** Allows to set post data of the request. */
|
|
2956
3158
|
data?: string | Buffer | Serializable
|
|
2957
3159
|
|
|
2958
3160
|
failOnStatusCode?: boolean
|
|
2959
3161
|
|
|
2960
3162
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
2961
3163
|
|
|
3164
|
+
/** Allows to set HTTP headers. */
|
|
2962
3165
|
headers?: { [key: string]: string }
|
|
2963
3166
|
|
|
2964
3167
|
ignoreHTTPSErrors?: boolean
|
|
@@ -2976,18 +3179,23 @@ interface APIRequestContext {
|
|
|
2976
3179
|
| boolean
|
|
2977
3180
|
| ReadStream
|
|
2978
3181
|
| {
|
|
3182
|
+
/** File name */
|
|
2979
3183
|
name: string
|
|
2980
3184
|
|
|
3185
|
+
/** File type */
|
|
2981
3186
|
mimeType: string
|
|
2982
3187
|
|
|
3188
|
+
/** File content */
|
|
2983
3189
|
buffer: Buffer
|
|
2984
3190
|
}
|
|
2985
3191
|
}
|
|
2986
3192
|
|
|
3193
|
+
/** Query parameters to be sent with the URL. */
|
|
2987
3194
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
2988
3195
|
|
|
2989
3196
|
signal?: AbortSignal
|
|
2990
3197
|
|
|
3198
|
+
/** Request timeout in milliseconds. */
|
|
2991
3199
|
timeout?: number
|
|
2992
3200
|
},
|
|
2993
3201
|
): Promise<APIResponse<T>>
|
|
@@ -2995,12 +3203,14 @@ interface APIRequestContext {
|
|
|
2995
3203
|
put<T = any>(
|
|
2996
3204
|
url: string,
|
|
2997
3205
|
options?: {
|
|
3206
|
+
/** Allows to set post data of the request. */
|
|
2998
3207
|
data?: string | Buffer | Serializable
|
|
2999
3208
|
|
|
3000
3209
|
failOnStatusCode?: boolean
|
|
3001
3210
|
|
|
3002
3211
|
form?: { [key: string]: string | number | boolean } | FormData
|
|
3003
3212
|
|
|
3213
|
+
/** Allows to set HTTP headers. */
|
|
3004
3214
|
headers?: { [key: string]: string }
|
|
3005
3215
|
|
|
3006
3216
|
ignoreHTTPSErrors?: boolean
|
|
@@ -3018,18 +3228,23 @@ interface APIRequestContext {
|
|
|
3018
3228
|
| boolean
|
|
3019
3229
|
| ReadStream
|
|
3020
3230
|
| {
|
|
3231
|
+
/** File name */
|
|
3021
3232
|
name: string
|
|
3022
3233
|
|
|
3234
|
+
/** File type */
|
|
3023
3235
|
mimeType: string
|
|
3024
3236
|
|
|
3237
|
+
/** File content */
|
|
3025
3238
|
buffer: Buffer
|
|
3026
3239
|
}
|
|
3027
3240
|
}
|
|
3028
3241
|
|
|
3242
|
+
/** Query parameters to be sent with the URL. */
|
|
3029
3243
|
params?: { [key: string]: string | number | boolean } | URLSearchParams | string
|
|
3030
3244
|
|
|
3031
3245
|
signal?: AbortSignal
|
|
3032
3246
|
|
|
3247
|
+
/** Request timeout in milliseconds. */
|
|
3033
3248
|
timeout?: number
|
|
3034
3249
|
},
|
|
3035
3250
|
): Promise<APIResponse<T>>
|
|
@@ -3050,6 +3265,7 @@ interface APIRequestContext {
|
|
|
3050
3265
|
|
|
3051
3266
|
path: string
|
|
3052
3267
|
|
|
3268
|
+
/** Unix time in seconds. */
|
|
3053
3269
|
expires: number
|
|
3054
3270
|
|
|
3055
3271
|
httpOnly: boolean
|
|
@@ -3076,7 +3292,7 @@ interface APIRequestContext {
|
|
|
3076
3292
|
}
|
|
3077
3293
|
```
|
|
3078
3294
|
|
|
3079
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
3295
|
+
_(Member comments are shortened to their first sentence, and the 70 longest are left out to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
3080
3296
|
|
|
3081
3297
|
#### `ConsoleMessage`
|
|
3082
3298
|
|
|
@@ -3508,17 +3724,45 @@ If you have a [FrameLocator](https://playwright.dev/docs/api/class-framelocator)
|
|
|
3508
3724
|
|
|
3509
3725
|
````typescript
|
|
3510
3726
|
interface FrameLocator {
|
|
3511
|
-
/**
|
|
3727
|
+
/**
|
|
3728
|
+
* Returns locator to the first matching frame.
|
|
3729
|
+
* @deprecated Use [locator.first()](https://playwright.dev/docs/api/class-locator#locator-first) followed by
|
|
3730
|
+
* [locator.contentFrame()](https://playwright.dev/docs/api/class-locator#locator-content-frame) instead.
|
|
3731
|
+
*/
|
|
3512
3732
|
first(): FrameLocator
|
|
3513
3733
|
|
|
3514
|
-
/**
|
|
3734
|
+
/**
|
|
3735
|
+
* When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements
|
|
3736
|
+
* in that iframe.
|
|
3737
|
+
* @param selector A selector to use when resolving DOM element.
|
|
3738
|
+
*/
|
|
3515
3739
|
frameLocator(selector: string): FrameLocator
|
|
3516
3740
|
|
|
3517
|
-
/**
|
|
3741
|
+
/**
|
|
3742
|
+
* Allows locating elements by their alt text.
|
|
3743
|
+
*
|
|
3744
|
+
* **Usage**
|
|
3745
|
+
*
|
|
3746
|
+
* For example, this method will find the image by alt text "Playwright logo":
|
|
3747
|
+
*
|
|
3748
|
+
* ```html
|
|
3749
|
+
* <img alt='Playwright logo'>
|
|
3750
|
+
* ```
|
|
3751
|
+
*
|
|
3752
|
+
* ```js
|
|
3753
|
+
* await page.getByAltText('Playwright logo').click();
|
|
3754
|
+
* ```
|
|
3755
|
+
*
|
|
3756
|
+
* @param text Text to locate the element for.
|
|
3757
|
+
* @param options
|
|
3758
|
+
*/
|
|
3518
3759
|
getByAltText(
|
|
3519
3760
|
text: string | RegExp,
|
|
3520
3761
|
options?: {
|
|
3521
|
-
/**
|
|
3762
|
+
/**
|
|
3763
|
+
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
|
|
3764
|
+
* regular expression. Note that exact match still trims whitespace.
|
|
3765
|
+
*/
|
|
3522
3766
|
exact?: boolean
|
|
3523
3767
|
},
|
|
3524
3768
|
): Locator
|
|
@@ -3527,7 +3771,10 @@ interface FrameLocator {
|
|
|
3527
3771
|
getByLabel(
|
|
3528
3772
|
text: string | RegExp,
|
|
3529
3773
|
options?: {
|
|
3530
|
-
/**
|
|
3774
|
+
/**
|
|
3775
|
+
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
|
|
3776
|
+
* regular expression. Note that exact match still trims whitespace.
|
|
3777
|
+
*/
|
|
3531
3778
|
exact?: boolean
|
|
3532
3779
|
},
|
|
3533
3780
|
): Locator
|
|
@@ -3536,7 +3783,10 @@ interface FrameLocator {
|
|
|
3536
3783
|
getByPlaceholder(
|
|
3537
3784
|
text: string | RegExp,
|
|
3538
3785
|
options?: {
|
|
3539
|
-
/**
|
|
3786
|
+
/**
|
|
3787
|
+
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
|
|
3788
|
+
* regular expression. Note that exact match still trims whitespace.
|
|
3789
|
+
*/
|
|
3540
3790
|
exact?: boolean
|
|
3541
3791
|
},
|
|
3542
3792
|
): Locator
|
|
@@ -3627,34 +3877,61 @@ interface FrameLocator {
|
|
|
3627
3877
|
| 'treegrid'
|
|
3628
3878
|
| 'treeitem',
|
|
3629
3879
|
options?: {
|
|
3630
|
-
/**
|
|
3880
|
+
/**
|
|
3881
|
+
* An attribute that is usually set by `aria-checked` or native `<input type=checkbox>` controls.
|
|
3882
|
+
*
|
|
3883
|
+
* Learn more about [`aria-checked`](https://www.w3.org/TR/wai-aria-1.2/#aria-checked).
|
|
3884
|
+
*/
|
|
3631
3885
|
checked?: boolean
|
|
3632
3886
|
|
|
3633
3887
|
/** Option to match the [accessible description](https://w3c.github.io/accname/#dfn-accessible-description). */
|
|
3634
3888
|
description?: string | RegExp
|
|
3635
3889
|
|
|
3636
|
-
/**
|
|
3890
|
+
/**
|
|
3891
|
+
* An attribute that is usually set by `aria-disabled` or `disabled`.
|
|
3892
|
+
*
|
|
3893
|
+
* **NOTE** Unlike most other attributes, `disabled` is inherited through the DOM hierarchy. Learn more about
|
|
3894
|
+
* [`aria-disabled`](https://www.w3.org/TR/wai-aria-1.2/#aria-disabled).
|
|
3895
|
+
*
|
|
3896
|
+
*/
|
|
3637
3897
|
disabled?: boolean
|
|
3638
3898
|
|
|
3639
3899
|
/** Whether [`name`](https://playwright.dev/docs/api/class-framelocator#frame-locator-get-by-role-option-name) and [`description`](https://playwright.dev/docs/api/… */
|
|
3640
3900
|
exact?: boolean
|
|
3641
3901
|
|
|
3642
|
-
/**
|
|
3902
|
+
/**
|
|
3903
|
+
* An attribute that is usually set by `aria-expanded`.
|
|
3904
|
+
*
|
|
3905
|
+
* Learn more about [`aria-expanded`](https://www.w3.org/TR/wai-aria-1.2/#aria-expanded).
|
|
3906
|
+
*/
|
|
3643
3907
|
expanded?: boolean
|
|
3644
3908
|
|
|
3645
3909
|
/** Option that controls whether hidden elements are matched. */
|
|
3646
3910
|
includeHidden?: boolean
|
|
3647
3911
|
|
|
3648
|
-
/**
|
|
3912
|
+
/**
|
|
3913
|
+
* A number attribute that is usually present for roles `heading`, `listitem`, `row`, `treeitem`, with default values
|
|
3914
|
+
* for `<h1>-<h6>` elements.
|
|
3915
|
+
*
|
|
3916
|
+
* Learn more about [`aria-level`](https://www.w3.org/TR/wai-aria-1.2/#aria-level).
|
|
3917
|
+
*/
|
|
3649
3918
|
level?: number
|
|
3650
3919
|
|
|
3651
3920
|
/** Option to match the [accessible name](https://w3c.github.io/accname/#dfn-accessible-name). */
|
|
3652
3921
|
name?: string | RegExp
|
|
3653
3922
|
|
|
3654
|
-
/**
|
|
3923
|
+
/**
|
|
3924
|
+
* An attribute that is usually set by `aria-pressed`.
|
|
3925
|
+
*
|
|
3926
|
+
* Learn more about [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.2/#aria-pressed).
|
|
3927
|
+
*/
|
|
3655
3928
|
pressed?: boolean
|
|
3656
3929
|
|
|
3657
|
-
/**
|
|
3930
|
+
/**
|
|
3931
|
+
* An attribute that is usually set by `aria-selected`.
|
|
3932
|
+
*
|
|
3933
|
+
* Learn more about [`aria-selected`](https://www.w3.org/TR/wai-aria-1.2/#aria-selected).
|
|
3934
|
+
*/
|
|
3658
3935
|
selected?: boolean
|
|
3659
3936
|
},
|
|
3660
3937
|
): Locator
|
|
@@ -3666,7 +3943,10 @@ interface FrameLocator {
|
|
|
3666
3943
|
getByText(
|
|
3667
3944
|
text: string | RegExp,
|
|
3668
3945
|
options?: {
|
|
3669
|
-
/**
|
|
3946
|
+
/**
|
|
3947
|
+
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
|
|
3948
|
+
* regular expression. Note that exact match still trims whitespace.
|
|
3949
|
+
*/
|
|
3670
3950
|
exact?: boolean
|
|
3671
3951
|
},
|
|
3672
3952
|
): Locator
|
|
@@ -3675,12 +3955,19 @@ interface FrameLocator {
|
|
|
3675
3955
|
getByTitle(
|
|
3676
3956
|
text: string | RegExp,
|
|
3677
3957
|
options?: {
|
|
3678
|
-
/**
|
|
3958
|
+
/**
|
|
3959
|
+
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
|
|
3960
|
+
* regular expression. Note that exact match still trims whitespace.
|
|
3961
|
+
*/
|
|
3679
3962
|
exact?: boolean
|
|
3680
3963
|
},
|
|
3681
3964
|
): Locator
|
|
3682
3965
|
|
|
3683
|
-
/**
|
|
3966
|
+
/**
|
|
3967
|
+
* Returns locator to the last matching frame.
|
|
3968
|
+
* @deprecated Use [locator.last()](https://playwright.dev/docs/api/class-locator#locator-last) followed by
|
|
3969
|
+
* [locator.contentFrame()](https://playwright.dev/docs/api/class-locator#locator-content-frame) instead.
|
|
3970
|
+
*/
|
|
3684
3971
|
last(): FrameLocator
|
|
3685
3972
|
|
|
3686
3973
|
/** The method finds an element matching the specified selector in the locator's subtree. */
|
|
@@ -3693,15 +3980,27 @@ interface FrameLocator {
|
|
|
3693
3980
|
/** Matches elements that do not contain an element that matches an inner locator. */
|
|
3694
3981
|
hasNot?: Locator
|
|
3695
3982
|
|
|
3696
|
-
/**
|
|
3983
|
+
/**
|
|
3984
|
+
* Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element.
|
|
3985
|
+
* When passed a [string], matching is case-insensitive and searches for a substring.
|
|
3986
|
+
*/
|
|
3697
3987
|
hasNotText?: string | RegExp
|
|
3698
3988
|
|
|
3699
|
-
/**
|
|
3989
|
+
/**
|
|
3990
|
+
* Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When
|
|
3991
|
+
* passed a [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
|
|
3992
|
+
* `<article><div>Playwright</div></article>`.
|
|
3993
|
+
*/
|
|
3700
3994
|
hasText?: string | RegExp
|
|
3701
3995
|
},
|
|
3702
3996
|
): Locator
|
|
3703
3997
|
|
|
3704
|
-
/**
|
|
3998
|
+
/**
|
|
3999
|
+
* Returns locator to the n-th matching frame. It's zero based, `nth(0)` selects the first frame.
|
|
4000
|
+
* @deprecated Use [locator.nth(index)](https://playwright.dev/docs/api/class-locator#locator-nth) followed by
|
|
4001
|
+
* [locator.contentFrame()](https://playwright.dev/docs/api/class-locator#locator-content-frame) instead.
|
|
4002
|
+
* @param index
|
|
4003
|
+
*/
|
|
3705
4004
|
nth(index: number): FrameLocator
|
|
3706
4005
|
|
|
3707
4006
|
/** Returns a [Locator](https://playwright.dev/docs/api/class-locator) object pointing to the same `iframe` as this frame locator. */
|
|
@@ -3709,7 +4008,7 @@ interface FrameLocator {
|
|
|
3709
4008
|
}
|
|
3710
4009
|
````
|
|
3711
4010
|
|
|
3712
|
-
_(
|
|
4011
|
+
_(The 14 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
3713
4012
|
|
|
3714
4013
|
#### `Keyboard`
|
|
3715
4014
|
|
|
@@ -4070,119 +4369,244 @@ new request is issued to a redirected url.
|
|
|
4070
4369
|
|
|
4071
4370
|
````typescript
|
|
4072
4371
|
interface Request {
|
|
4073
|
-
/**
|
|
4372
|
+
/**
|
|
4373
|
+
* An object with all the request HTTP headers associated with this request. The header names are lower-cased.
|
|
4374
|
+
*/
|
|
4074
4375
|
allHeaders(): Promise<{ [key: string]: string }>
|
|
4075
4376
|
|
|
4076
|
-
/**
|
|
4377
|
+
/**
|
|
4378
|
+
* Returns the [Response](https://playwright.dev/docs/api/class-response) object if the response has already been
|
|
4379
|
+
* received, `null` otherwise.
|
|
4380
|
+
*
|
|
4381
|
+
* Unlike [request.response()](https://playwright.dev/docs/api/class-request#request-response), this method does not
|
|
4382
|
+
* wait for the response to arrive. It returns immediately with the response object if the response has been received,
|
|
4383
|
+
* or `null` if the response has not been received yet.
|
|
4384
|
+
*/
|
|
4077
4385
|
existingResponse(): null | Response
|
|
4078
4386
|
|
|
4079
|
-
/**
|
|
4387
|
+
/**
|
|
4388
|
+
* The method returns `null` unless this request has failed, as reported by `requestfailed` event.
|
|
4389
|
+
*
|
|
4390
|
+
* **Usage**
|
|
4391
|
+
*
|
|
4392
|
+
* Example of logging of all the failed requests:
|
|
4393
|
+
*
|
|
4394
|
+
* ```js
|
|
4395
|
+
* page.on('requestfailed', request => {
|
|
4396
|
+
* console.log(request.url() + ' ' + request.failure().errorText);
|
|
4397
|
+
* });
|
|
4398
|
+
* ```
|
|
4399
|
+
*
|
|
4400
|
+
*/
|
|
4080
4401
|
failure(): null | {
|
|
4081
|
-
/**
|
|
4402
|
+
/**
|
|
4403
|
+
* Human-readable error message, e.g. `'net::ERR_FAILED'`.
|
|
4404
|
+
*/
|
|
4082
4405
|
errorText: string
|
|
4083
4406
|
}
|
|
4084
4407
|
|
|
4085
4408
|
/** Returns the [Frame](https://playwright.dev/docs/api/class-frame) that initiated this request. **Usage** ```js const frameUrl = request.frame().url(); ``` **Det… */
|
|
4086
4409
|
frame(): Frame
|
|
4087
4410
|
|
|
4088
|
-
/**
|
|
4411
|
+
/**
|
|
4412
|
+
* An object with the request HTTP headers. The header names are lower-cased. Note that this method does not return
|
|
4413
|
+
* security-related headers, including cookie-related ones. You can use
|
|
4414
|
+
* [request.allHeaders()](https://playwright.dev/docs/api/class-request#request-all-headers) for complete list of
|
|
4415
|
+
* headers that include `cookie` information.
|
|
4416
|
+
*/
|
|
4089
4417
|
headers(): { [key: string]: string }
|
|
4090
4418
|
|
|
4091
|
-
/**
|
|
4419
|
+
/**
|
|
4420
|
+
* An array with all the request HTTP headers associated with this request. Unlike
|
|
4421
|
+
* [request.allHeaders()](https://playwright.dev/docs/api/class-request#request-all-headers), header names are NOT
|
|
4422
|
+
* lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
|
|
4423
|
+
*/
|
|
4092
4424
|
headersArray(): Promise<
|
|
4093
4425
|
Array<{
|
|
4094
|
-
/**
|
|
4426
|
+
/**
|
|
4427
|
+
* Name of the header.
|
|
4428
|
+
*/
|
|
4095
4429
|
name: string
|
|
4096
4430
|
|
|
4097
|
-
/**
|
|
4431
|
+
/**
|
|
4432
|
+
* Value of the header.
|
|
4433
|
+
*/
|
|
4098
4434
|
value: string
|
|
4099
4435
|
}>
|
|
4100
4436
|
>
|
|
4101
4437
|
|
|
4102
|
-
/**
|
|
4438
|
+
/**
|
|
4439
|
+
* Returns the value of the header matching the name. The name is case-insensitive.
|
|
4440
|
+
* @param name Name of the header.
|
|
4441
|
+
*/
|
|
4103
4442
|
headerValue(name: string): Promise<null | string>
|
|
4104
4443
|
|
|
4105
|
-
/**
|
|
4444
|
+
/**
|
|
4445
|
+
* Whether this request is driving frame's navigation.
|
|
4446
|
+
*
|
|
4447
|
+
* Some navigation requests are issued before the corresponding frame is created, and therefore do not have
|
|
4448
|
+
* [request.frame()](https://playwright.dev/docs/api/class-request#request-frame) available.
|
|
4449
|
+
*/
|
|
4106
4450
|
isNavigationRequest(): boolean
|
|
4107
4451
|
|
|
4108
|
-
/**
|
|
4452
|
+
/**
|
|
4453
|
+
* Request's method (GET, POST, etc.)
|
|
4454
|
+
*/
|
|
4109
4455
|
method(): string
|
|
4110
4456
|
|
|
4111
|
-
/**
|
|
4457
|
+
/**
|
|
4458
|
+
* Request's post body, if any.
|
|
4459
|
+
*/
|
|
4112
4460
|
postData(): null | string
|
|
4113
4461
|
|
|
4114
|
-
/**
|
|
4462
|
+
/**
|
|
4463
|
+
* Request's post body in a binary form, if any.
|
|
4464
|
+
*/
|
|
4115
4465
|
postDataBuffer(): null | Buffer
|
|
4116
4466
|
|
|
4117
|
-
/**
|
|
4467
|
+
/**
|
|
4468
|
+
* Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.
|
|
4469
|
+
*
|
|
4470
|
+
* When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned.
|
|
4471
|
+
* Otherwise it will be parsed as JSON.
|
|
4472
|
+
*/
|
|
4118
4473
|
postDataJSON(): null | Serializable
|
|
4119
4474
|
|
|
4120
4475
|
/** Request that was redirected by the server to this one, if any. */
|
|
4121
4476
|
redirectedFrom(): null | Request
|
|
4122
4477
|
|
|
4123
|
-
/**
|
|
4478
|
+
/**
|
|
4479
|
+
* New request issued by the browser if the server responded with redirect.
|
|
4480
|
+
*
|
|
4481
|
+
* **Usage**
|
|
4482
|
+
*
|
|
4483
|
+
* This method is the opposite of
|
|
4484
|
+
* [request.redirectedFrom()](https://playwright.dev/docs/api/class-request#request-redirected-from):
|
|
4485
|
+
*
|
|
4486
|
+
* ```js
|
|
4487
|
+
* console.log(request.redirectedFrom().redirectedTo() === request); // true
|
|
4488
|
+
* ```
|
|
4489
|
+
*
|
|
4490
|
+
*/
|
|
4124
4491
|
redirectedTo(): null | Request
|
|
4125
4492
|
|
|
4126
|
-
/**
|
|
4493
|
+
/**
|
|
4494
|
+
* Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the
|
|
4495
|
+
* following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`,
|
|
4496
|
+
* `eventsource`, `websocket`, `manifest`, `beacon`, `ping`, `cspreport`, `other`.
|
|
4497
|
+
*/
|
|
4127
4498
|
resourceType(): string
|
|
4128
4499
|
|
|
4129
|
-
/**
|
|
4500
|
+
/**
|
|
4501
|
+
* Returns the matching [Response](https://playwright.dev/docs/api/class-response) object, or `null` if the response
|
|
4502
|
+
* was not received due to error.
|
|
4503
|
+
*/
|
|
4130
4504
|
response(): Promise<null | Response>
|
|
4131
4505
|
|
|
4132
|
-
/**
|
|
4506
|
+
/**
|
|
4507
|
+
* The Service [Worker](https://playwright.dev/docs/api/class-worker) that is performing the request.
|
|
4508
|
+
*
|
|
4509
|
+
* **Details**
|
|
4510
|
+
*
|
|
4511
|
+
* This method is Chromium only. It's safe to call when using other browsers, but it will always be `null`.
|
|
4512
|
+
*
|
|
4513
|
+
* Requests originated in a Service Worker do not have a
|
|
4514
|
+
* [request.frame()](https://playwright.dev/docs/api/class-request#request-frame) available.
|
|
4515
|
+
*/
|
|
4133
4516
|
serviceWorker(): null | Worker
|
|
4134
4517
|
|
|
4135
|
-
/**
|
|
4518
|
+
/**
|
|
4519
|
+
* Returns resource size information for given request.
|
|
4520
|
+
*/
|
|
4136
4521
|
sizes(): Promise<{
|
|
4137
|
-
/**
|
|
4522
|
+
/**
|
|
4523
|
+
* Size of the request body (POST data payload) in bytes. Set to 0 if there was no body.
|
|
4524
|
+
*/
|
|
4138
4525
|
requestBodySize: number
|
|
4139
4526
|
|
|
4140
|
-
/**
|
|
4527
|
+
/**
|
|
4528
|
+
* Total number of bytes from the start of the HTTP request message until (and including) the double CRLF before the
|
|
4529
|
+
* body.
|
|
4530
|
+
*/
|
|
4141
4531
|
requestHeadersSize: number
|
|
4142
4532
|
|
|
4143
|
-
/**
|
|
4533
|
+
/**
|
|
4534
|
+
* Size of the received response body (encoded) in bytes.
|
|
4535
|
+
*/
|
|
4144
4536
|
responseBodySize: number
|
|
4145
4537
|
|
|
4146
|
-
/**
|
|
4538
|
+
/**
|
|
4539
|
+
* Total number of bytes from the start of the HTTP response message until (and including) the double CRLF before the
|
|
4540
|
+
* body.
|
|
4541
|
+
*/
|
|
4147
4542
|
responseHeadersSize: number
|
|
4148
4543
|
}>
|
|
4149
4544
|
|
|
4150
4545
|
/** Returns resource timing information for given request. */
|
|
4151
4546
|
timing(): {
|
|
4152
|
-
/**
|
|
4547
|
+
/**
|
|
4548
|
+
* Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
|
|
4549
|
+
*/
|
|
4153
4550
|
startTime: number
|
|
4154
4551
|
|
|
4155
|
-
/**
|
|
4552
|
+
/**
|
|
4553
|
+
* Time immediately before the client starts the domain name lookup for the resource. The value is given in
|
|
4554
|
+
* milliseconds relative to `startTime`, -1 if not available.
|
|
4555
|
+
*/
|
|
4156
4556
|
domainLookupStart: number
|
|
4157
4557
|
|
|
4158
|
-
/**
|
|
4558
|
+
/**
|
|
4559
|
+
* Time immediately after the client ends the domain name lookup for the resource. The value is given in milliseconds
|
|
4560
|
+
* relative to `startTime`, -1 if not available.
|
|
4561
|
+
*/
|
|
4159
4562
|
domainLookupEnd: number
|
|
4160
4563
|
|
|
4161
|
-
/**
|
|
4564
|
+
/**
|
|
4565
|
+
* Time immediately before the client starts establishing the connection to the server to retrieve the resource. The
|
|
4566
|
+
* value is given in milliseconds relative to `startTime`, -1 if not available.
|
|
4567
|
+
*/
|
|
4162
4568
|
connectStart: number
|
|
4163
4569
|
|
|
4164
|
-
/**
|
|
4570
|
+
/**
|
|
4571
|
+
* Time immediately before the client starts the handshake process to secure the current connection. The value is
|
|
4572
|
+
* given in milliseconds relative to `startTime`, -1 if not available.
|
|
4573
|
+
*/
|
|
4165
4574
|
secureConnectionStart: number
|
|
4166
4575
|
|
|
4167
|
-
/**
|
|
4576
|
+
/**
|
|
4577
|
+
* Time immediately after the client establishes the connection to the server to retrieve the resource. The value is
|
|
4578
|
+
* given in milliseconds relative to `startTime`, -1 if not available.
|
|
4579
|
+
*/
|
|
4168
4580
|
connectEnd: number
|
|
4169
4581
|
|
|
4170
|
-
/**
|
|
4582
|
+
/**
|
|
4583
|
+
* Time immediately before the client starts requesting the resource from the server, cache, or local resource. The
|
|
4584
|
+
* value is given in milliseconds relative to `startTime`, -1 if not available.
|
|
4585
|
+
*/
|
|
4171
4586
|
requestStart: number
|
|
4172
4587
|
|
|
4173
|
-
/**
|
|
4588
|
+
/**
|
|
4589
|
+
* Time immediately after the client receives the first byte of the response from the server, cache, or local
|
|
4590
|
+
* resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
|
|
4591
|
+
*/
|
|
4174
4592
|
responseStart: number
|
|
4175
4593
|
|
|
4176
|
-
/**
|
|
4594
|
+
/**
|
|
4595
|
+
* Time immediately after the client receives the last byte of the resource or immediately before the transport
|
|
4596
|
+
* connection is closed, whichever comes first. The value is given in milliseconds relative to `startTime`, -1 if not
|
|
4597
|
+
* available.
|
|
4598
|
+
*/
|
|
4177
4599
|
responseEnd: number
|
|
4178
4600
|
}
|
|
4179
4601
|
|
|
4180
|
-
/**
|
|
4602
|
+
/**
|
|
4603
|
+
* URL of the request.
|
|
4604
|
+
*/
|
|
4181
4605
|
url(): string
|
|
4182
4606
|
}
|
|
4183
4607
|
````
|
|
4184
4608
|
|
|
4185
|
-
_(
|
|
4609
|
+
_(The 3 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
4186
4610
|
|
|
4187
4611
|
#### `Response`
|
|
4188
4612
|
|
|
@@ -4357,96 +4781,223 @@ Learn more about [networking](https://playwright.dev/docs/network).
|
|
|
4357
4781
|
|
|
4358
4782
|
````typescript
|
|
4359
4783
|
interface Route {
|
|
4360
|
-
/**
|
|
4784
|
+
/**
|
|
4785
|
+
* Aborts the route's request.
|
|
4786
|
+
* @param errorCode Optional error code. Defaults to `failed`, could be one of the following:
|
|
4787
|
+
* - `'aborted'` - An operation was aborted (due to user action)
|
|
4788
|
+
* - `'accessdenied'` - Permission to access a resource, other than the network, was denied
|
|
4789
|
+
* - `'addressunreachable'` - The IP address is unreachable. This usually means that there is no route to the
|
|
4790
|
+
* specified host or network.
|
|
4791
|
+
* - `'blockedbyclient'` - The client chose to block the request.
|
|
4792
|
+
* - `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are
|
|
4793
|
+
* not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance).
|
|
4794
|
+
* - `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent.
|
|
4795
|
+
* - `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN).
|
|
4796
|
+
* - `'connectionfailed'` - A connection attempt failed.
|
|
4797
|
+
* - `'connectionrefused'` - A connection attempt was refused.
|
|
4798
|
+
* - `'connectionreset'` - A connection was reset (corresponding to a TCP RST).
|
|
4799
|
+
* - `'internetdisconnected'` - The Internet connection has been lost.
|
|
4800
|
+
* - `'namenotresolved'` - The host name could not be resolved.
|
|
4801
|
+
* - `'timedout'` - An operation timed out.
|
|
4802
|
+
* - `'failed'` - A generic failure occurred.
|
|
4803
|
+
*/
|
|
4361
4804
|
abort(errorCode?: string): Promise<void>
|
|
4362
4805
|
|
|
4363
4806
|
/** Sends route's request to the network with optional overrides. **Usage** ```js await page.route('**\/*', async (route, request) => { // Override headers const h… */
|
|
4364
4807
|
continue(options?: {
|
|
4365
|
-
/**
|
|
4808
|
+
/**
|
|
4809
|
+
* If set changes the request HTTP headers. Header values will be converted to a string.
|
|
4810
|
+
*/
|
|
4366
4811
|
headers?: { [key: string]: string }
|
|
4367
4812
|
|
|
4368
|
-
/**
|
|
4813
|
+
/**
|
|
4814
|
+
* If set changes the request method (e.g. GET or POST).
|
|
4815
|
+
*/
|
|
4369
4816
|
method?: string
|
|
4370
4817
|
|
|
4371
|
-
/**
|
|
4818
|
+
/**
|
|
4819
|
+
* If set changes the post data of request.
|
|
4820
|
+
*/
|
|
4372
4821
|
postData?: string | Buffer | Serializable
|
|
4373
4822
|
|
|
4374
|
-
/**
|
|
4823
|
+
/**
|
|
4824
|
+
* If set changes the request URL. New URL must have same protocol as original one.
|
|
4825
|
+
*/
|
|
4375
4826
|
url?: string
|
|
4376
4827
|
}): Promise<void>
|
|
4377
4828
|
|
|
4378
4829
|
/** Continues route's request with optional overrides. */
|
|
4379
4830
|
fallback(options?: {
|
|
4380
|
-
/**
|
|
4831
|
+
/**
|
|
4832
|
+
* If set changes the request HTTP headers. Header values will be converted to a string.
|
|
4833
|
+
*/
|
|
4381
4834
|
headers?: { [key: string]: string }
|
|
4382
4835
|
|
|
4383
|
-
/**
|
|
4836
|
+
/**
|
|
4837
|
+
* If set changes the request method (e.g. GET or POST).
|
|
4838
|
+
*/
|
|
4384
4839
|
method?: string
|
|
4385
4840
|
|
|
4386
|
-
/**
|
|
4841
|
+
/**
|
|
4842
|
+
* If set changes the post data of request.
|
|
4843
|
+
*/
|
|
4387
4844
|
postData?: string | Buffer | Serializable
|
|
4388
4845
|
|
|
4389
|
-
/**
|
|
4846
|
+
/**
|
|
4847
|
+
* If set changes the request URL. New URL must have same protocol as original one. Changing the URL won't affect the
|
|
4848
|
+
* route matching, all the routes are matched using the original request URL.
|
|
4849
|
+
*/
|
|
4390
4850
|
url?: string
|
|
4391
4851
|
}): Promise<void>
|
|
4392
4852
|
|
|
4393
|
-
/**
|
|
4853
|
+
/**
|
|
4854
|
+
* Performs the request and fetches result without fulfilling it, so that the response could be modified and then
|
|
4855
|
+
* fulfilled.
|
|
4856
|
+
*
|
|
4857
|
+
* **Usage**
|
|
4858
|
+
*
|
|
4859
|
+
* ```js
|
|
4860
|
+
* await page.route('https://dog.ceo/api/breeds/list/all', async route => {
|
|
4861
|
+
* const response = await route.fetch();
|
|
4862
|
+
* const json = await response.json();
|
|
4863
|
+
* json.message['big_red_dog'] = [];
|
|
4864
|
+
* await route.fulfill({ response, json });
|
|
4865
|
+
* });
|
|
4866
|
+
* ```
|
|
4867
|
+
*
|
|
4868
|
+
* **Details**
|
|
4869
|
+
*
|
|
4870
|
+
* Note that [`headers`](https://playwright.dev/docs/api/class-route#route-fetch-option-headers) option will apply to
|
|
4871
|
+
* the fetched request as well as any redirects initiated by it. If you want to only apply
|
|
4872
|
+
* [`headers`](https://playwright.dev/docs/api/class-route#route-fetch-option-headers) to the original request, but
|
|
4873
|
+
* not to redirects, look into [route.continue([options])](https://playwright.dev/docs/api/class-route#route-continue)
|
|
4874
|
+
* instead.
|
|
4875
|
+
* @param options
|
|
4876
|
+
*/
|
|
4394
4877
|
fetch<T = any>(options?: {
|
|
4395
|
-
/**
|
|
4878
|
+
/**
|
|
4879
|
+
* If set changes the request HTTP headers. Header values will be converted to a string.
|
|
4880
|
+
*/
|
|
4396
4881
|
headers?: { [key: string]: string }
|
|
4397
4882
|
|
|
4398
|
-
/**
|
|
4883
|
+
/**
|
|
4884
|
+
* Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is
|
|
4885
|
+
* exceeded. Defaults to `20`. Pass `0` to not follow redirects.
|
|
4886
|
+
*/
|
|
4399
4887
|
maxRedirects?: number
|
|
4400
4888
|
|
|
4401
|
-
/**
|
|
4889
|
+
/**
|
|
4890
|
+
* Maximum number of times network errors should be retried. Currently only `ECONNRESET` error is retried. Does not
|
|
4891
|
+
* retry based on HTTP response codes. An error will be thrown if the limit is exceeded. Defaults to `0` - no retries.
|
|
4892
|
+
*/
|
|
4402
4893
|
maxRetries?: number
|
|
4403
4894
|
|
|
4404
|
-
/**
|
|
4895
|
+
/**
|
|
4896
|
+
* If set changes the request method (e.g. GET or POST).
|
|
4897
|
+
*/
|
|
4405
4898
|
method?: string
|
|
4406
4899
|
|
|
4407
|
-
/**
|
|
4900
|
+
/**
|
|
4901
|
+
* Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string
|
|
4902
|
+
* and `content-type` header will be set to `application/json` if not explicitly set. Otherwise the `content-type`
|
|
4903
|
+
* header will be set to `application/octet-stream` if not explicitly set.
|
|
4904
|
+
*/
|
|
4408
4905
|
postData?: string | Buffer | Serializable
|
|
4409
4906
|
|
|
4410
|
-
/**
|
|
4907
|
+
/**
|
|
4908
|
+
* Allows to cancel the operation using an
|
|
4909
|
+
* [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). If the signal is aborted, the
|
|
4910
|
+
* operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout,
|
|
4911
|
+
* which can be changed using
|
|
4912
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
4913
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout); pass
|
|
4914
|
+
* `timeout: 0` to disable the timeout entirely.
|
|
4915
|
+
*/
|
|
4411
4916
|
signal?: AbortSignal
|
|
4412
4917
|
|
|
4413
|
-
/**
|
|
4918
|
+
/**
|
|
4919
|
+
* Request timeout in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
|
|
4920
|
+
*/
|
|
4414
4921
|
timeout?: number
|
|
4415
4922
|
|
|
4416
|
-
/**
|
|
4923
|
+
/**
|
|
4924
|
+
* If set changes the request URL. New URL must have same protocol as original one.
|
|
4925
|
+
*/
|
|
4417
4926
|
url?: string
|
|
4418
4927
|
}): Promise<APIResponse<T>>
|
|
4419
4928
|
|
|
4420
|
-
/**
|
|
4929
|
+
/**
|
|
4930
|
+
* Fulfills route's request with given response.
|
|
4931
|
+
*
|
|
4932
|
+
* **Usage**
|
|
4933
|
+
*
|
|
4934
|
+
* An example of fulfilling all requests with 404 responses:
|
|
4935
|
+
*
|
|
4936
|
+
* ```js
|
|
4937
|
+
* await page.route('**\/*', async route => {
|
|
4938
|
+
* await route.fulfill({
|
|
4939
|
+
* status: 404,
|
|
4940
|
+
* contentType: 'text/plain',
|
|
4941
|
+
* body: 'Not Found!'
|
|
4942
|
+
* });
|
|
4943
|
+
* });
|
|
4944
|
+
* ```
|
|
4945
|
+
*
|
|
4946
|
+
* An example of serving static file:
|
|
4947
|
+
*
|
|
4948
|
+
* ```js
|
|
4949
|
+
* await page.route('**\/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));
|
|
4950
|
+
* ```
|
|
4951
|
+
*
|
|
4952
|
+
* @param options
|
|
4953
|
+
*/
|
|
4421
4954
|
fulfill(options?: {
|
|
4422
|
-
/**
|
|
4955
|
+
/**
|
|
4956
|
+
* Response body.
|
|
4957
|
+
*/
|
|
4423
4958
|
body?: string | Buffer
|
|
4424
4959
|
|
|
4425
|
-
/**
|
|
4960
|
+
/**
|
|
4961
|
+
* If set, equals to setting `Content-Type` response header.
|
|
4962
|
+
*/
|
|
4426
4963
|
contentType?: string
|
|
4427
4964
|
|
|
4428
|
-
/**
|
|
4965
|
+
/**
|
|
4966
|
+
* Response headers. Header values will be converted to a string.
|
|
4967
|
+
*/
|
|
4429
4968
|
headers?: { [key: string]: string }
|
|
4430
4969
|
|
|
4431
|
-
/**
|
|
4970
|
+
/**
|
|
4971
|
+
* JSON response. This method will set the content type to `application/json` if not set.
|
|
4972
|
+
*/
|
|
4432
4973
|
json?: Serializable
|
|
4433
4974
|
|
|
4434
|
-
/**
|
|
4975
|
+
/**
|
|
4976
|
+
* File path to respond with. The content type will be inferred from file extension. If `path` is a relative path,
|
|
4977
|
+
* then it is resolved relative to the current working directory.
|
|
4978
|
+
*/
|
|
4435
4979
|
path?: string
|
|
4436
4980
|
|
|
4437
|
-
/**
|
|
4981
|
+
/**
|
|
4982
|
+
* [APIResponse](https://playwright.dev/docs/api/class-apiresponse) to fulfill route's request with. Individual fields
|
|
4983
|
+
* of the response (such as headers) can be overridden using fulfill options.
|
|
4984
|
+
*/
|
|
4438
4985
|
response?: APIResponse
|
|
4439
4986
|
|
|
4440
|
-
/**
|
|
4987
|
+
/**
|
|
4988
|
+
* Response status code, defaults to `200`.
|
|
4989
|
+
*/
|
|
4441
4990
|
status?: number
|
|
4442
4991
|
}): Promise<void>
|
|
4443
4992
|
|
|
4444
|
-
/**
|
|
4993
|
+
/**
|
|
4994
|
+
* A request to be routed.
|
|
4995
|
+
*/
|
|
4445
4996
|
request(): Request
|
|
4446
4997
|
}
|
|
4447
4998
|
````
|
|
4448
4999
|
|
|
4449
|
-
_(
|
|
5000
|
+
_(The 2 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/playwright-core/types/types.d.ts`.)_
|
|
4450
5001
|
|
|
4451
5002
|
#### `Touchscreen`
|
|
4452
5003
|
|
|
@@ -4758,13 +5309,24 @@ interface TestInfo {
|
|
|
4758
5309
|
attach(
|
|
4759
5310
|
name: string,
|
|
4760
5311
|
options?: {
|
|
4761
|
-
/**
|
|
5312
|
+
/**
|
|
5313
|
+
* Attachment body. Mutually exclusive with
|
|
5314
|
+
* [`path`](https://playwright.dev/docs/api/class-testinfo#test-info-attach-option-path).
|
|
5315
|
+
*/
|
|
4762
5316
|
body?: string | Buffer
|
|
4763
5317
|
|
|
4764
|
-
/**
|
|
5318
|
+
/**
|
|
5319
|
+
* Content type of this attachment to properly present in the report, for example `'application/json'` or
|
|
5320
|
+
* `'image/png'`. If omitted, content type is inferred based on the
|
|
5321
|
+
* [`path`](https://playwright.dev/docs/api/class-testinfo#test-info-attach-option-path), or defaults to `text/plain`
|
|
5322
|
+
* for [string] attachments and `application/octet-stream` for [Buffer] attachments.
|
|
5323
|
+
*/
|
|
4765
5324
|
contentType?: string
|
|
4766
5325
|
|
|
4767
|
-
/**
|
|
5326
|
+
/**
|
|
5327
|
+
* Path on the filesystem to the attached file. Mutually exclusive with
|
|
5328
|
+
* [`body`](https://playwright.dev/docs/api/class-testinfo#test-info-attach-option-body).
|
|
5329
|
+
*/
|
|
4768
5330
|
path?: string
|
|
4769
5331
|
},
|
|
4770
5332
|
): Promise<void>
|
|
@@ -4775,7 +5337,10 @@ interface TestInfo {
|
|
|
4775
5337
|
/** Conditionally mark the currently running test as "should fail" with an optional description. */
|
|
4776
5338
|
fail(condition: boolean, description?: string): void
|
|
4777
5339
|
|
|
4778
|
-
/**
|
|
5340
|
+
/**
|
|
5341
|
+
* Mark a test as "fixme", with the intention to fix it. Test is immediately aborted. This is similar to
|
|
5342
|
+
* [test.fixme([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fixme).
|
|
5343
|
+
*/
|
|
4779
5344
|
fixme(): void
|
|
4780
5345
|
|
|
4781
5346
|
/** Conditionally mark the currently running test as "fixme" with an optional description. */
|
|
@@ -4787,13 +5352,19 @@ interface TestInfo {
|
|
|
4787
5352
|
/** Changes the timeout for the currently running test. */
|
|
4788
5353
|
setTimeout(timeout: number): void
|
|
4789
5354
|
|
|
4790
|
-
/**
|
|
5355
|
+
/**
|
|
5356
|
+
* Unconditionally skip the currently running test. Test is immediately aborted. This is similar to
|
|
5357
|
+
* [test.skip([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-skip).
|
|
5358
|
+
*/
|
|
4791
5359
|
skip(): void
|
|
4792
5360
|
|
|
4793
5361
|
/** Conditionally skips the currently running test with an optional description. */
|
|
4794
5362
|
skip(condition: boolean, description?: string): void
|
|
4795
5363
|
|
|
4796
|
-
/**
|
|
5364
|
+
/**
|
|
5365
|
+
* Marks the currently running test as "slow", giving it triple the default timeout. This is similar to
|
|
5366
|
+
* [test.slow([condition, callback, description])](https://playwright.dev/docs/api/class-test#test-slow).
|
|
5367
|
+
*/
|
|
4797
5368
|
slow(): void
|
|
4798
5369
|
|
|
4799
5370
|
/** Conditionally mark the currently running test as "slow" with an optional description, giving it triple the default timeout. */
|
|
@@ -4801,74 +5372,129 @@ interface TestInfo {
|
|
|
4801
5372
|
|
|
4802
5373
|
/** The list of annotations applicable to the current test. */
|
|
4803
5374
|
annotations: Array<{
|
|
4804
|
-
/**
|
|
5375
|
+
/**
|
|
5376
|
+
* Annotation type, for example `'skip'` or `'fail'`.
|
|
5377
|
+
*/
|
|
4805
5378
|
type: string
|
|
4806
5379
|
|
|
4807
|
-
/**
|
|
5380
|
+
/**
|
|
5381
|
+
* Optional description.
|
|
5382
|
+
*/
|
|
4808
5383
|
description?: string
|
|
4809
5384
|
|
|
4810
|
-
/**
|
|
5385
|
+
/**
|
|
5386
|
+
* Optional location in the source where the annotation is added.
|
|
5387
|
+
*/
|
|
4811
5388
|
location?: Location
|
|
4812
5389
|
}>
|
|
4813
5390
|
|
|
4814
|
-
/**
|
|
5391
|
+
/**
|
|
5392
|
+
* The list of files or buffers attached to the current test. Some reporters show test attachments.
|
|
5393
|
+
*
|
|
5394
|
+
* To add an attachment, use
|
|
5395
|
+
* [testInfo.attach(name[, options])](https://playwright.dev/docs/api/class-testinfo#test-info-attach) instead of
|
|
5396
|
+
* directly pushing onto this array.
|
|
5397
|
+
*/
|
|
4815
5398
|
attachments: Array<{
|
|
4816
|
-
/**
|
|
5399
|
+
/**
|
|
5400
|
+
* Attachment name.
|
|
5401
|
+
*/
|
|
4817
5402
|
name: string
|
|
4818
5403
|
|
|
4819
|
-
/**
|
|
5404
|
+
/**
|
|
5405
|
+
* Content type of this attachment to properly present in the report, for example `'application/json'` or
|
|
5406
|
+
* `'image/png'`.
|
|
5407
|
+
*/
|
|
4820
5408
|
contentType: string
|
|
4821
5409
|
|
|
4822
|
-
/**
|
|
5410
|
+
/**
|
|
5411
|
+
* Optional path on the filesystem to the attached file.
|
|
5412
|
+
*/
|
|
4823
5413
|
path?: string
|
|
4824
5414
|
|
|
4825
|
-
/**
|
|
5415
|
+
/**
|
|
5416
|
+
* Optional attachment body used instead of a file.
|
|
5417
|
+
*/
|
|
4826
5418
|
body?: Buffer
|
|
4827
5419
|
}>
|
|
4828
5420
|
|
|
4829
|
-
/**
|
|
5421
|
+
/**
|
|
5422
|
+
* Column number where the currently running test is declared.
|
|
5423
|
+
*/
|
|
4830
5424
|
column: number
|
|
4831
5425
|
|
|
4832
|
-
/**
|
|
5426
|
+
/**
|
|
5427
|
+
* Processed configuration from the [configuration file](https://playwright.dev/docs/test-configuration).
|
|
5428
|
+
*/
|
|
4833
5429
|
config: FullConfig
|
|
4834
5430
|
|
|
4835
|
-
/**
|
|
5431
|
+
/**
|
|
5432
|
+
* The number of milliseconds the test took to finish. Always zero before the test finishes, either successfully or
|
|
5433
|
+
* not. Can be used in
|
|
5434
|
+
* [test.afterEach([title, hookFunction])](https://playwright.dev/docs/api/class-test#test-after-each) hook.
|
|
5435
|
+
*/
|
|
4836
5436
|
duration: number
|
|
4837
5437
|
|
|
4838
|
-
/**
|
|
5438
|
+
/**
|
|
5439
|
+
* First error thrown during test execution, if any. This is equal to the first element in
|
|
5440
|
+
* [testInfo.errors](https://playwright.dev/docs/api/class-testinfo#test-info-errors).
|
|
5441
|
+
*/
|
|
4839
5442
|
error?: TestInfoError
|
|
4840
5443
|
|
|
4841
|
-
/**
|
|
5444
|
+
/**
|
|
5445
|
+
* Errors thrown during test execution, if any.
|
|
5446
|
+
*/
|
|
4842
5447
|
errors: Array<TestInfoError>
|
|
4843
5448
|
|
|
4844
5449
|
/** Expected status for the currently running test. */
|
|
4845
5450
|
expectedStatus: 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted'
|
|
4846
5451
|
|
|
4847
|
-
/**
|
|
5452
|
+
/**
|
|
5453
|
+
* Absolute path to a file where the currently running test is declared.
|
|
5454
|
+
*/
|
|
4848
5455
|
file: string
|
|
4849
5456
|
|
|
4850
|
-
/**
|
|
5457
|
+
/**
|
|
5458
|
+
* Test function as passed to `test(title, testFunction)`.
|
|
5459
|
+
*/
|
|
4851
5460
|
fn: Function
|
|
4852
5461
|
|
|
4853
|
-
/**
|
|
5462
|
+
/**
|
|
5463
|
+
* Line number where the currently running test is declared.
|
|
5464
|
+
*/
|
|
4854
5465
|
line: number
|
|
4855
5466
|
|
|
4856
|
-
/**
|
|
5467
|
+
/**
|
|
5468
|
+
* Absolute path to the output directory for this specific test run. Each test run gets its own directory so they
|
|
5469
|
+
* cannot conflict.
|
|
5470
|
+
*/
|
|
4857
5471
|
outputDir: string
|
|
4858
5472
|
|
|
4859
5473
|
/** The index of the worker between `0` and `workers - 1`. */
|
|
4860
5474
|
parallelIndex: number
|
|
4861
5475
|
|
|
4862
|
-
/**
|
|
5476
|
+
/**
|
|
5477
|
+
* Processed project configuration from the [configuration file](https://playwright.dev/docs/test-configuration).
|
|
5478
|
+
*/
|
|
4863
5479
|
project: FullProject
|
|
4864
5480
|
|
|
4865
|
-
/**
|
|
5481
|
+
/**
|
|
5482
|
+
* Specifies a unique repeat index when running in "repeat each" mode. This mode is enabled by passing `--repeat-each`
|
|
5483
|
+
* to the [command line](https://playwright.dev/docs/test-cli).
|
|
5484
|
+
*/
|
|
4866
5485
|
repeatEachIndex: number
|
|
4867
5486
|
|
|
4868
5487
|
/** Specifies the retry number when the test is retried after a failure. */
|
|
4869
5488
|
retry: number
|
|
4870
5489
|
|
|
4871
|
-
/**
|
|
5490
|
+
/**
|
|
5491
|
+
* Absolute path to the snapshot output directory for this specific test. Each test suite gets its own directory so
|
|
5492
|
+
* they cannot conflict.
|
|
5493
|
+
*
|
|
5494
|
+
* This property does not account for the
|
|
5495
|
+
* [testProject.snapshotPathTemplate](https://playwright.dev/docs/api/class-testproject#test-project-snapshot-path-template)
|
|
5496
|
+
* configuration.
|
|
5497
|
+
*/
|
|
4872
5498
|
snapshotDir: string
|
|
4873
5499
|
|
|
4874
5500
|
/** **NOTE** Use of [testInfo.snapshotSuffix](https://playwright.dev/docs/api/class-testinfo#test-info-snapshot-suffix) is discouraged. */
|
|
@@ -4877,27 +5503,44 @@ interface TestInfo {
|
|
|
4877
5503
|
/** Actual status for the currently running test. */
|
|
4878
5504
|
status?: 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted'
|
|
4879
5505
|
|
|
4880
|
-
/**
|
|
5506
|
+
/**
|
|
5507
|
+
* Tags that apply to the test. Learn more about [tags](https://playwright.dev/docs/test-annotations#tag-tests).
|
|
5508
|
+
*
|
|
5509
|
+
* **NOTE** Any changes made to this list while the test is running will not be visible to test reporters.
|
|
5510
|
+
*
|
|
5511
|
+
*/
|
|
4881
5512
|
tags: Array<string>
|
|
4882
5513
|
|
|
4883
|
-
/**
|
|
5514
|
+
/**
|
|
5515
|
+
* Test id matching the test case id in the reporter API.
|
|
5516
|
+
*/
|
|
4884
5517
|
testId: string
|
|
4885
5518
|
|
|
4886
5519
|
/** Timeout in milliseconds for the currently running test. */
|
|
4887
5520
|
timeout: number
|
|
4888
5521
|
|
|
4889
|
-
/**
|
|
5522
|
+
/**
|
|
5523
|
+
* The title of the currently running test as passed to `test(title, testFunction)`.
|
|
5524
|
+
*/
|
|
4890
5525
|
title: string
|
|
4891
5526
|
|
|
4892
|
-
/**
|
|
5527
|
+
/**
|
|
5528
|
+
* The full title path starting with the test file name.
|
|
5529
|
+
*/
|
|
4893
5530
|
titlePath: Array<string>
|
|
4894
5531
|
|
|
4895
|
-
/**
|
|
5532
|
+
/**
|
|
5533
|
+
* The unique index of the worker process that is running the test. When a worker is restarted, for example after a
|
|
5534
|
+
* failure, the new worker process gets a new unique `workerIndex`.
|
|
5535
|
+
*
|
|
5536
|
+
* Also available as `process.env.TEST_WORKER_INDEX`. Learn more about [parallelism and sharding](https://playwright.dev/docs/test-parallel)
|
|
5537
|
+
* with Playwright Test.
|
|
5538
|
+
*/
|
|
4896
5539
|
workerIndex: number
|
|
4897
5540
|
}
|
|
4898
5541
|
```
|
|
4899
5542
|
|
|
4900
|
-
_(
|
|
5543
|
+
_(The 17 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/playwright/types/test.d.ts`.)_
|
|
4901
5544
|
|
|
4902
5545
|
#### `TestType`
|
|
4903
5546
|
|
|
@@ -4918,7 +5561,9 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4918
5561
|
(title: string, body: TestBody<TestArgs & WorkerArgs>): void
|
|
4919
5562
|
(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void
|
|
4920
5563
|
|
|
5564
|
+
/** Declares a focused test. */
|
|
4921
5565
|
only(title: string, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5566
|
+
/** Declares a focused test. */
|
|
4922
5567
|
only(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void
|
|
4923
5568
|
|
|
4924
5569
|
describe: {
|
|
@@ -4926,16 +5571,24 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4926
5571
|
(callback: () => void): void
|
|
4927
5572
|
(title: string, details: TestDetails, callback: () => void): void
|
|
4928
5573
|
|
|
5574
|
+
/** Declares a focused group of tests. */
|
|
4929
5575
|
only(title: string, callback: () => void): void
|
|
5576
|
+
/** Declares a focused group of tests. */
|
|
4930
5577
|
only(callback: () => void): void
|
|
5578
|
+
/** Declares a focused group of tests. */
|
|
4931
5579
|
only(title: string, details: TestDetails, callback: () => void): void
|
|
4932
5580
|
|
|
4933
5581
|
skip(title: string, callback: () => void): void
|
|
5582
|
+
/** Declares a skipped test group, similarly to [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe). */
|
|
4934
5583
|
skip(callback: () => void): void
|
|
5584
|
+
/** Declares a skipped test group, similarly to [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe). */
|
|
4935
5585
|
skip(title: string, details: TestDetails, callback: () => void): void
|
|
4936
5586
|
|
|
5587
|
+
/** Declares a test group similarly to [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe). */
|
|
4937
5588
|
fixme(title: string, callback: () => void): void
|
|
5589
|
+
/** Declares a test group similarly to [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe). */
|
|
4938
5590
|
fixme(callback: () => void): void
|
|
5591
|
+
/** Declares a test group similarly to [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe). */
|
|
4939
5592
|
fixme(title: string, details: TestDetails, callback: () => void): void
|
|
4940
5593
|
|
|
4941
5594
|
serial: {
|
|
@@ -4958,6 +5611,7 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4958
5611
|
only(title: string, details: TestDetails, callback: () => void): void
|
|
4959
5612
|
}
|
|
4960
5613
|
|
|
5614
|
+
/** Configures the enclosing scope. */
|
|
4961
5615
|
configure: (options: {
|
|
4962
5616
|
mode?: 'default' | 'parallel' | 'serial'
|
|
4963
5617
|
retries?: number
|
|
@@ -4966,52 +5620,83 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4966
5620
|
}) => void
|
|
4967
5621
|
}
|
|
4968
5622
|
|
|
5623
|
+
/** Skip a test. */
|
|
4969
5624
|
skip(title: string, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5625
|
+
/** Skip a test. */
|
|
4970
5626
|
skip(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5627
|
+
/** Skip a test. */
|
|
4971
5628
|
skip(): void
|
|
5629
|
+
/** Skip a test. */
|
|
4972
5630
|
skip(condition: boolean, description?: string): void
|
|
5631
|
+
/** Skip a test. */
|
|
4973
5632
|
skip(callback: ConditionBody<TestArgs & WorkerArgs>, description?: string): void
|
|
4974
5633
|
|
|
5634
|
+
/** Mark a test as "fixme", with the intention to fix it. */
|
|
4975
5635
|
fixme(title: string, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5636
|
+
/** Mark a test as "fixme", with the intention to fix it. */
|
|
4976
5637
|
fixme(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5638
|
+
/** Mark a test as "fixme", with the intention to fix it. */
|
|
4977
5639
|
fixme(): void
|
|
5640
|
+
/** Mark a test as "fixme", with the intention to fix it. */
|
|
4978
5641
|
fixme(condition: boolean, description?: string): void
|
|
5642
|
+
/** Mark a test as "fixme", with the intention to fix it. */
|
|
4979
5643
|
fixme(callback: ConditionBody<TestArgs & WorkerArgs>, description?: string): void
|
|
4980
5644
|
|
|
5645
|
+
/** Marks a test as "should fail". */
|
|
4981
5646
|
fail: {
|
|
5647
|
+
/** Marks a test as "should fail". */
|
|
4982
5648
|
(title: string, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5649
|
+
/** Marks a test as "should fail". */
|
|
4983
5650
|
(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5651
|
+
/** Marks a test as "should fail". */
|
|
4984
5652
|
(condition: boolean, description?: string): void
|
|
5653
|
+
/** Marks a test as "should fail". */
|
|
4985
5654
|
(callback: ConditionBody<TestArgs & WorkerArgs>, description?: string): void
|
|
5655
|
+
/** Marks a test as "should fail". */
|
|
4986
5656
|
(): void
|
|
4987
5657
|
|
|
5658
|
+
/** You can use `test.fail.only` to focus on a specific test that is expected to fail. */
|
|
4988
5659
|
only(title: string, body: TestBody<TestArgs & WorkerArgs>): void
|
|
5660
|
+
/** You can use `test.fail.only` to focus on a specific test that is expected to fail. */
|
|
4989
5661
|
only(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void
|
|
4990
5662
|
}
|
|
4991
5663
|
|
|
5664
|
+
/** Aborts the currently running test by throwing an error. */
|
|
4992
5665
|
abort(message?: string): never
|
|
4993
5666
|
|
|
5667
|
+
/** Marks a test as "slow". */
|
|
4994
5668
|
slow(): void
|
|
5669
|
+
/** Marks a test as "slow". */
|
|
4995
5670
|
slow(condition: boolean, description?: string): void
|
|
5671
|
+
/** Marks a test as "slow". */
|
|
4996
5672
|
slow(callback: ConditionBody<TestArgs & WorkerArgs>, description?: string): void
|
|
4997
5673
|
|
|
5674
|
+
/** Changes the timeout for the test. */
|
|
4998
5675
|
setTimeout(timeout: number): void
|
|
5676
|
+
/** Declares a `beforeEach` hook that is executed before each test. */
|
|
4999
5677
|
beforeEach(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void
|
|
5678
|
+
/** Declares a `beforeEach` hook that is executed before each test. */
|
|
5000
5679
|
beforeEach(
|
|
5001
5680
|
title: string,
|
|
5002
5681
|
inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any,
|
|
5003
5682
|
): void
|
|
5683
|
+
/** Declares an `afterEach` hook that is executed after each test. */
|
|
5004
5684
|
afterEach(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void
|
|
5685
|
+
/** Declares an `afterEach` hook that is executed after each test. */
|
|
5005
5686
|
afterEach(
|
|
5006
5687
|
title: string,
|
|
5007
5688
|
inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any,
|
|
5008
5689
|
): void
|
|
5690
|
+
/** Declares a `beforeAll` hook that is executed once per worker process before all tests. */
|
|
5009
5691
|
beforeAll(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void
|
|
5692
|
+
/** Declares a `beforeAll` hook that is executed once per worker process before all tests. */
|
|
5010
5693
|
beforeAll(
|
|
5011
5694
|
title: string,
|
|
5012
5695
|
inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any,
|
|
5013
5696
|
): void
|
|
5697
|
+
/** Declares an `afterAll` hook that is executed once per worker after all tests. */
|
|
5014
5698
|
afterAll(inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any): void
|
|
5699
|
+
/** Declares an `afterAll` hook that is executed once per worker after all tests. */
|
|
5015
5700
|
afterAll(
|
|
5016
5701
|
title: string,
|
|
5017
5702
|
inner: (args: TestArgs & WorkerArgs, testInfo: TestInfo) => Promise<any> | any,
|
|
@@ -5029,6 +5714,7 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5029
5714
|
subtitle?: string
|
|
5030
5715
|
},
|
|
5031
5716
|
): Promise<T>
|
|
5717
|
+
/** Mark a test step as "skip" to temporarily disable its execution, useful for steps that are currently failing and planned for a near-term fix. */
|
|
5032
5718
|
skip(
|
|
5033
5719
|
title: string,
|
|
5034
5720
|
body: (step: TestStepInfo) => any | Promise<any>,
|
|
@@ -5041,15 +5727,18 @@ interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5041
5727
|
},
|
|
5042
5728
|
): Promise<void>
|
|
5043
5729
|
}
|
|
5730
|
+
/** `expect` function can be used to create test assertions. */
|
|
5044
5731
|
expect: Expect<{}>
|
|
5732
|
+
/** Extends the `test` object by defining fixtures and/or options that can be used in the tests. **Usage** First define a fixture and/or an option. */
|
|
5045
5733
|
extend<T extends {}, W extends {} = {}>(
|
|
5046
5734
|
fixtures: Fixtures<T, W, TestArgs, WorkerArgs>,
|
|
5047
5735
|
): TestType<TestArgs & T, WorkerArgs & W>
|
|
5736
|
+
/** Returns information about the currently running test. */
|
|
5048
5737
|
info(): TestInfo
|
|
5049
5738
|
}
|
|
5050
5739
|
```
|
|
5051
5740
|
|
|
5052
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/playwright/types/test.d.ts`.)_
|
|
5741
|
+
_(Member comments are shortened to their first sentence, and the 24 longest are left out to fit; the full declaration is in `node_modules/playwright/types/test.d.ts`.)_
|
|
5053
5742
|
|
|
5054
5743
|
#### `PlaywrightWorkerOptions`
|
|
5055
5744
|
|
|
@@ -5091,24 +5780,191 @@ test('my portrait test', async ({ page }) => {
|
|
|
5091
5780
|
|
|
5092
5781
|
````typescript
|
|
5093
5782
|
interface PlaywrightWorkerOptions {
|
|
5094
|
-
/**
|
|
5783
|
+
/**
|
|
5784
|
+
* Name of the browser that runs tests. Defaults to `'chromium'`. Most of the time you should set `browserName` in
|
|
5785
|
+
* your [TestConfig](https://playwright.dev/docs/api/class-testconfig):
|
|
5786
|
+
*
|
|
5787
|
+
* **Usage**
|
|
5788
|
+
*
|
|
5789
|
+
* ```js
|
|
5790
|
+
* // playwright.config.ts
|
|
5791
|
+
* import { defineConfig, devices } from '@playwright/test';
|
|
5792
|
+
*
|
|
5793
|
+
* export default defineConfig({
|
|
5794
|
+
* use: {
|
|
5795
|
+
* browserName: 'firefox',
|
|
5796
|
+
* },
|
|
5797
|
+
* });
|
|
5798
|
+
* ```
|
|
5799
|
+
*
|
|
5800
|
+
*/
|
|
5095
5801
|
browserName: BrowserName
|
|
5096
5802
|
defaultBrowserType: BrowserName
|
|
5097
|
-
/**
|
|
5803
|
+
/**
|
|
5804
|
+
* Whether to run browser in headless mode. More details for
|
|
5805
|
+
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
|
|
5806
|
+
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
|
|
5807
|
+
*
|
|
5808
|
+
* **Usage**
|
|
5809
|
+
*
|
|
5810
|
+
* ```js
|
|
5811
|
+
* // playwright.config.ts
|
|
5812
|
+
* import { defineConfig } from '@playwright/test';
|
|
5813
|
+
*
|
|
5814
|
+
* export default defineConfig({
|
|
5815
|
+
* use: {
|
|
5816
|
+
* headless: false
|
|
5817
|
+
* },
|
|
5818
|
+
* });
|
|
5819
|
+
* ```
|
|
5820
|
+
*
|
|
5821
|
+
*/
|
|
5098
5822
|
headless: boolean
|
|
5099
|
-
/**
|
|
5823
|
+
/**
|
|
5824
|
+
* Browser distribution channel.
|
|
5825
|
+
*
|
|
5826
|
+
* Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#chromium-new-headless-mode).
|
|
5827
|
+
*
|
|
5828
|
+
* Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or
|
|
5829
|
+
* "msedge-canary" to use branded [Google Chrome and Microsoft Edge](https://playwright.dev/docs/browsers#google-chrome--microsoft-edge).
|
|
5830
|
+
*
|
|
5831
|
+
* **Usage**
|
|
5832
|
+
*
|
|
5833
|
+
* ```js
|
|
5834
|
+
* // playwright.config.ts
|
|
5835
|
+
* import { defineConfig } from '@playwright/test';
|
|
5836
|
+
*
|
|
5837
|
+
* export default defineConfig({
|
|
5838
|
+
* projects: [
|
|
5839
|
+
* {
|
|
5840
|
+
* name: 'Microsoft Edge',
|
|
5841
|
+
* use: {
|
|
5842
|
+
* ...devices['Desktop Edge'],
|
|
5843
|
+
* channel: 'msedge'
|
|
5844
|
+
* },
|
|
5845
|
+
* },
|
|
5846
|
+
* ]
|
|
5847
|
+
* });
|
|
5848
|
+
* ```
|
|
5849
|
+
*
|
|
5850
|
+
*/
|
|
5100
5851
|
channel: BrowserChannel | undefined
|
|
5101
|
-
/**
|
|
5852
|
+
/**
|
|
5853
|
+
* Options used to launch the browser, as passed to
|
|
5854
|
+
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch). Specific
|
|
5855
|
+
* options [testOptions.headless](https://playwright.dev/docs/api/class-testoptions#test-options-headless) and
|
|
5856
|
+
* [testOptions.channel](https://playwright.dev/docs/api/class-testoptions#test-options-channel) take priority over
|
|
5857
|
+
* this.
|
|
5858
|
+
*
|
|
5859
|
+
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
|
5860
|
+
*
|
|
5861
|
+
* **Usage**
|
|
5862
|
+
*
|
|
5863
|
+
* ```js
|
|
5864
|
+
* // playwright.config.ts
|
|
5865
|
+
* import { defineConfig } from '@playwright/test';
|
|
5866
|
+
*
|
|
5867
|
+
* export default defineConfig({
|
|
5868
|
+
* projects: [
|
|
5869
|
+
* {
|
|
5870
|
+
* name: 'chromium',
|
|
5871
|
+
* use: {
|
|
5872
|
+
* ...devices['Desktop Chrome'],
|
|
5873
|
+
* launchOptions: {
|
|
5874
|
+
* args: ['--start-maximized']
|
|
5875
|
+
* }
|
|
5876
|
+
* }
|
|
5877
|
+
* }
|
|
5878
|
+
* ]
|
|
5879
|
+
* });
|
|
5880
|
+
* ```
|
|
5881
|
+
*
|
|
5882
|
+
*/
|
|
5102
5883
|
launchOptions: Omit<LaunchOptions, 'tracesDir'>
|
|
5103
|
-
/**
|
|
5884
|
+
/**
|
|
5885
|
+
* **Usage**
|
|
5886
|
+
*
|
|
5887
|
+
* ```js
|
|
5888
|
+
* // playwright.config.ts
|
|
5889
|
+
* import { defineConfig } from '@playwright/test';
|
|
5890
|
+
*
|
|
5891
|
+
* export default defineConfig({
|
|
5892
|
+
* use: {
|
|
5893
|
+
* connectOptions: {
|
|
5894
|
+
* wsEndpoint: 'ws://localhost:5678',
|
|
5895
|
+
* },
|
|
5896
|
+
* },
|
|
5897
|
+
* });
|
|
5898
|
+
* ```
|
|
5899
|
+
*
|
|
5900
|
+
* When connect options are specified, default
|
|
5901
|
+
* [fixtures.browser](https://playwright.dev/docs/api/class-fixtures#fixtures-browser),
|
|
5902
|
+
* [fixtures.context](https://playwright.dev/docs/api/class-fixtures#fixtures-context) and
|
|
5903
|
+
* [fixtures.page](https://playwright.dev/docs/api/class-fixtures#fixtures-page) use the remote browser instead of
|
|
5904
|
+
* launching a browser locally.
|
|
5905
|
+
*/
|
|
5104
5906
|
connectOptions: ConnectOptions | undefined
|
|
5105
5907
|
/** **NOTE** This option trades test isolation for speed and is intended for component tests that drive a story gallery. */
|
|
5106
5908
|
reuseContext: boolean
|
|
5107
|
-
/**
|
|
5909
|
+
/**
|
|
5910
|
+
* Whether to automatically capture a screenshot after each test. Defaults to `'off'`.
|
|
5911
|
+
* - `'off'`: Do not capture screenshots.
|
|
5912
|
+
* - `'on'`: Capture screenshot after each test.
|
|
5913
|
+
* - `'only-on-failure'`: Capture screenshot after each test failure.
|
|
5914
|
+
* - `'on-first-failure'`: Capture screenshot after each test's first failure.
|
|
5915
|
+
*
|
|
5916
|
+
* **Usage**
|
|
5917
|
+
*
|
|
5918
|
+
* ```js
|
|
5919
|
+
* // playwright.config.ts
|
|
5920
|
+
* import { defineConfig } from '@playwright/test';
|
|
5921
|
+
*
|
|
5922
|
+
* export default defineConfig({
|
|
5923
|
+
* use: {
|
|
5924
|
+
* screenshot: 'only-on-failure',
|
|
5925
|
+
* },
|
|
5926
|
+
* });
|
|
5927
|
+
* ```
|
|
5928
|
+
*
|
|
5929
|
+
* Learn more about [automatic screenshots](https://playwright.dev/docs/test-use-options#recording-options).
|
|
5930
|
+
*/
|
|
5108
5931
|
screenshot:
|
|
5109
5932
|
| ScreenshotMode
|
|
5110
5933
|
| ({ mode: ScreenshotMode } & Pick<PageScreenshotOptions, 'fullPage' | 'omitBackground'>)
|
|
5111
|
-
/**
|
|
5934
|
+
/**
|
|
5935
|
+
* Whether to record trace for each test. Defaults to `'off'`. The initial run of a test is the "first run";
|
|
5936
|
+
* subsequent runs caused by [retries](https://playwright.dev/docs/test-retries) are "retries".
|
|
5937
|
+
* - `'off'`: Do not record trace.
|
|
5938
|
+
* - `'on'`: Record and keep a trace for every run.
|
|
5939
|
+
* - `'on-first-retry'`: Record and keep a trace only for the first retry of a test.
|
|
5940
|
+
* - `'on-all-retries'`: Record and keep a trace for every retry.
|
|
5941
|
+
* - `'retain-on-failure'`: Record a trace for every run, but keep it only for runs that failed. A failed run's
|
|
5942
|
+
* trace is kept even when a later retry passes.
|
|
5943
|
+
* - `'retain-on-first-failure'`: Record a trace only for the first run of a test (not for retries), and keep it
|
|
5944
|
+
* only if that run failed.
|
|
5945
|
+
* - `'retain-on-failure-and-retries'`: Record a trace for every run, and keep it for any run that failed or that is
|
|
5946
|
+
* a retry.
|
|
5947
|
+
*
|
|
5948
|
+
* See [trace modes](https://playwright.dev/docs/test-use-options#trace-modes) for a side-by-side comparison of what each mode records and
|
|
5949
|
+
* keeps.
|
|
5950
|
+
*
|
|
5951
|
+
* For more control, pass an object that specifies `mode` and trace features to enable.
|
|
5952
|
+
*
|
|
5953
|
+
* **Usage**
|
|
5954
|
+
*
|
|
5955
|
+
* ```js
|
|
5956
|
+
* // playwright.config.ts
|
|
5957
|
+
* import { defineConfig } from '@playwright/test';
|
|
5958
|
+
*
|
|
5959
|
+
* export default defineConfig({
|
|
5960
|
+
* use: {
|
|
5961
|
+
* trace: 'on-first-retry'
|
|
5962
|
+
* },
|
|
5963
|
+
* });
|
|
5964
|
+
* ```
|
|
5965
|
+
*
|
|
5966
|
+
* Learn more about [recording trace](https://playwright.dev/docs/test-use-options#recording-options).
|
|
5967
|
+
*/
|
|
5112
5968
|
trace:
|
|
5113
5969
|
| TraceMode
|
|
5114
5970
|
| /** deprecated */ 'retry-with-trace'
|
|
@@ -5145,7 +6001,7 @@ interface PlaywrightWorkerOptions {
|
|
|
5145
6001
|
}
|
|
5146
6002
|
````
|
|
5147
6003
|
|
|
5148
|
-
_(
|
|
6004
|
+
_(The 2 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/playwright/types/test.d.ts`.)_
|
|
5149
6005
|
|
|
5150
6006
|
#### `PlaywrightTestOptions`
|
|
5151
6007
|
|
|
@@ -5187,9 +6043,41 @@ test('my portrait test', async ({ page }) => {
|
|
|
5187
6043
|
|
|
5188
6044
|
````typescript
|
|
5189
6045
|
interface PlaywrightTestOptions {
|
|
5190
|
-
/**
|
|
6046
|
+
/**
|
|
6047
|
+
* Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.
|
|
6048
|
+
*
|
|
6049
|
+
* **Usage**
|
|
6050
|
+
*
|
|
6051
|
+
* ```js
|
|
6052
|
+
* // playwright.config.ts
|
|
6053
|
+
* import { defineConfig } from '@playwright/test';
|
|
6054
|
+
*
|
|
6055
|
+
* export default defineConfig({
|
|
6056
|
+
* use: {
|
|
6057
|
+
* acceptDownloads: false,
|
|
6058
|
+
* },
|
|
6059
|
+
* });
|
|
6060
|
+
* ```
|
|
6061
|
+
*
|
|
6062
|
+
*/
|
|
5191
6063
|
acceptDownloads: boolean
|
|
5192
|
-
/**
|
|
6064
|
+
/**
|
|
6065
|
+
* Toggles bypassing page's Content-Security-Policy. Defaults to `false`.
|
|
6066
|
+
*
|
|
6067
|
+
* **Usage**
|
|
6068
|
+
*
|
|
6069
|
+
* ```js
|
|
6070
|
+
* // playwright.config.ts
|
|
6071
|
+
* import { defineConfig } from '@playwright/test';
|
|
6072
|
+
*
|
|
6073
|
+
* export default defineConfig({
|
|
6074
|
+
* use: {
|
|
6075
|
+
* bypassCSP: true,
|
|
6076
|
+
* }
|
|
6077
|
+
* });
|
|
6078
|
+
* ```
|
|
6079
|
+
*
|
|
6080
|
+
*/
|
|
5193
6081
|
bypassCSP: boolean
|
|
5194
6082
|
/** Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media feature, supported values are `'light'` an… */
|
|
5195
6083
|
colorScheme: ColorScheme
|
|
@@ -5199,29 +6087,184 @@ interface PlaywrightTestOptions {
|
|
|
5199
6087
|
clientCertificates: ClientCertificate[] | undefined
|
|
5200
6088
|
/** Specify device scale factor (can be thought of as dpr). */
|
|
5201
6089
|
deviceScaleFactor: number | undefined
|
|
5202
|
-
/**
|
|
6090
|
+
/**
|
|
6091
|
+
* An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
|
6092
|
+
*
|
|
6093
|
+
* **Usage**
|
|
6094
|
+
*
|
|
6095
|
+
* ```js
|
|
6096
|
+
* // playwright.config.ts
|
|
6097
|
+
* import { defineConfig } from '@playwright/test';
|
|
6098
|
+
*
|
|
6099
|
+
* export default defineConfig({
|
|
6100
|
+
* use: {
|
|
6101
|
+
* extraHTTPHeaders: {
|
|
6102
|
+
* 'X-My-Header': 'value',
|
|
6103
|
+
* },
|
|
6104
|
+
* },
|
|
6105
|
+
* });
|
|
6106
|
+
* ```
|
|
6107
|
+
*
|
|
6108
|
+
*/
|
|
5203
6109
|
extraHTTPHeaders: ExtraHTTPHeaders | undefined
|
|
5204
6110
|
/** Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. */
|
|
5205
6111
|
forcedColors: ForcedColors
|
|
5206
|
-
/**
|
|
6112
|
+
/**
|
|
6113
|
+
* **Usage**
|
|
6114
|
+
*
|
|
6115
|
+
* ```js
|
|
6116
|
+
* // playwright.config.ts
|
|
6117
|
+
* import { defineConfig } from '@playwright/test';
|
|
6118
|
+
*
|
|
6119
|
+
* export default defineConfig({
|
|
6120
|
+
* use: {
|
|
6121
|
+
* geolocation: { longitude: 12.492507, latitude: 41.889938 },
|
|
6122
|
+
* },
|
|
6123
|
+
* });
|
|
6124
|
+
* ```
|
|
6125
|
+
*
|
|
6126
|
+
* Learn more about [geolocation](https://playwright.dev/docs/emulation#color-scheme-and-media).
|
|
6127
|
+
*/
|
|
5207
6128
|
geolocation: Geolocation | undefined
|
|
5208
|
-
/**
|
|
6129
|
+
/**
|
|
6130
|
+
* Specifies if viewport supports touch events. Defaults to false. Learn more about
|
|
6131
|
+
* [mobile emulation](https://playwright.dev/docs/emulation#devices).
|
|
6132
|
+
*
|
|
6133
|
+
* **Usage**
|
|
6134
|
+
*
|
|
6135
|
+
* ```js
|
|
6136
|
+
* // playwright.config.ts
|
|
6137
|
+
* import { defineConfig } from '@playwright/test';
|
|
6138
|
+
*
|
|
6139
|
+
* export default defineConfig({
|
|
6140
|
+
* use: {
|
|
6141
|
+
* hasTouch: true
|
|
6142
|
+
* },
|
|
6143
|
+
* });
|
|
6144
|
+
* ```
|
|
6145
|
+
*
|
|
6146
|
+
*/
|
|
5209
6147
|
hasTouch: boolean
|
|
5210
6148
|
/** Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). */
|
|
5211
6149
|
httpCredentials: HTTPCredentials | HTTPCredentials[] | undefined
|
|
5212
|
-
/**
|
|
6150
|
+
/**
|
|
6151
|
+
* Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.
|
|
6152
|
+
*
|
|
6153
|
+
* **Usage**
|
|
6154
|
+
*
|
|
6155
|
+
* ```js
|
|
6156
|
+
* // playwright.config.ts
|
|
6157
|
+
* import { defineConfig } from '@playwright/test';
|
|
6158
|
+
*
|
|
6159
|
+
* export default defineConfig({
|
|
6160
|
+
* use: {
|
|
6161
|
+
* ignoreHTTPSErrors: true,
|
|
6162
|
+
* },
|
|
6163
|
+
* });
|
|
6164
|
+
* ```
|
|
6165
|
+
*
|
|
6166
|
+
*/
|
|
5213
6167
|
ignoreHTTPSErrors: boolean
|
|
5214
|
-
/**
|
|
6168
|
+
/**
|
|
6169
|
+
* Whether the `meta viewport` tag is taken into account and touch events are enabled. isMobile is a part of device,
|
|
6170
|
+
* so you don't actually need to set it manually. Defaults to `false`. Learn more about
|
|
6171
|
+
* [mobile emulation](https://playwright.dev/docs/emulation#ismobile).
|
|
6172
|
+
*
|
|
6173
|
+
* **Usage**
|
|
6174
|
+
*
|
|
6175
|
+
* ```js
|
|
6176
|
+
* // playwright.config.ts
|
|
6177
|
+
* import { defineConfig } from '@playwright/test';
|
|
6178
|
+
*
|
|
6179
|
+
* export default defineConfig({
|
|
6180
|
+
* use: {
|
|
6181
|
+
* isMobile: false,
|
|
6182
|
+
* },
|
|
6183
|
+
* });
|
|
6184
|
+
* ```
|
|
6185
|
+
*
|
|
6186
|
+
*/
|
|
5215
6187
|
isMobile: boolean
|
|
5216
|
-
/**
|
|
6188
|
+
/**
|
|
6189
|
+
* Whether or not to enable JavaScript in the context. Defaults to `true`. Learn more about
|
|
6190
|
+
* [disabling JavaScript](https://playwright.dev/docs/emulation#javascript-enabled).
|
|
6191
|
+
*
|
|
6192
|
+
* **Usage**
|
|
6193
|
+
*
|
|
6194
|
+
* ```js
|
|
6195
|
+
* // playwright.config.ts
|
|
6196
|
+
* import { defineConfig } from '@playwright/test';
|
|
6197
|
+
*
|
|
6198
|
+
* export default defineConfig({
|
|
6199
|
+
* use: {
|
|
6200
|
+
* javaScriptEnabled: false,
|
|
6201
|
+
* },
|
|
6202
|
+
* });
|
|
6203
|
+
* ```
|
|
6204
|
+
*
|
|
6205
|
+
*/
|
|
5217
6206
|
javaScriptEnabled: boolean
|
|
5218
|
-
/**
|
|
6207
|
+
/**
|
|
6208
|
+
* Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value,
|
|
6209
|
+
* `Accept-Language` request header value as well as number and date formatting rules. Defaults to `en-US`. Learn more
|
|
6210
|
+
* about emulation in our [emulation guide](https://playwright.dev/docs/emulation#locale--timezone).
|
|
6211
|
+
*
|
|
6212
|
+
* **Usage**
|
|
6213
|
+
*
|
|
6214
|
+
* ```js
|
|
6215
|
+
* // playwright.config.ts
|
|
6216
|
+
* import { defineConfig } from '@playwright/test';
|
|
6217
|
+
*
|
|
6218
|
+
* export default defineConfig({
|
|
6219
|
+
* use: {
|
|
6220
|
+
* locale: 'it-IT',
|
|
6221
|
+
* },
|
|
6222
|
+
* });
|
|
6223
|
+
* ```
|
|
6224
|
+
*
|
|
6225
|
+
*/
|
|
5219
6226
|
locale: string | undefined
|
|
5220
|
-
/**
|
|
6227
|
+
/**
|
|
6228
|
+
* Whether to emulate network being offline. Defaults to `false`. Learn more about
|
|
6229
|
+
* [network emulation](https://playwright.dev/docs/emulation#offline).
|
|
6230
|
+
*
|
|
6231
|
+
* **Usage**
|
|
6232
|
+
*
|
|
6233
|
+
* ```js
|
|
6234
|
+
* // playwright.config.ts
|
|
6235
|
+
* import { defineConfig } from '@playwright/test';
|
|
6236
|
+
*
|
|
6237
|
+
* export default defineConfig({
|
|
6238
|
+
* use: {
|
|
6239
|
+
* offline: true
|
|
6240
|
+
* },
|
|
6241
|
+
* });
|
|
6242
|
+
* ```
|
|
6243
|
+
*
|
|
6244
|
+
*/
|
|
5221
6245
|
offline: boolean
|
|
5222
6246
|
/** A list of permissions to grant to all pages in this context. */
|
|
5223
6247
|
permissions: string[] | undefined
|
|
5224
|
-
/**
|
|
6248
|
+
/**
|
|
6249
|
+
* Network proxy settings.
|
|
6250
|
+
*
|
|
6251
|
+
* **Usage**
|
|
6252
|
+
*
|
|
6253
|
+
* ```js
|
|
6254
|
+
* // playwright.config.ts
|
|
6255
|
+
* import { defineConfig } from '@playwright/test';
|
|
6256
|
+
*
|
|
6257
|
+
* export default defineConfig({
|
|
6258
|
+
* use: {
|
|
6259
|
+
* proxy: {
|
|
6260
|
+
* server: 'http://myproxy.com:3128',
|
|
6261
|
+
* bypass: 'localhost',
|
|
6262
|
+
* },
|
|
6263
|
+
* },
|
|
6264
|
+
* });
|
|
6265
|
+
* ```
|
|
6266
|
+
*
|
|
6267
|
+
*/
|
|
5225
6268
|
proxy: Proxy | undefined
|
|
5226
6269
|
/** Emulates `'prefers-reduced-motion'` media feature, supported values are `'reduce'`, `'no-preference'`. */
|
|
5227
6270
|
reducedMotion: ReducedMotion
|
|
@@ -5231,7 +6274,23 @@ interface PlaywrightTestOptions {
|
|
|
5231
6274
|
storageState: StorageState | undefined
|
|
5232
6275
|
/** Changes the timezone of the context. */
|
|
5233
6276
|
timezoneId: string | undefined
|
|
5234
|
-
/**
|
|
6277
|
+
/**
|
|
6278
|
+
* Specific user agent to use in this context.
|
|
6279
|
+
*
|
|
6280
|
+
* **Usage**
|
|
6281
|
+
*
|
|
6282
|
+
* ```js
|
|
6283
|
+
* // playwright.config.ts
|
|
6284
|
+
* import { defineConfig } from '@playwright/test';
|
|
6285
|
+
*
|
|
6286
|
+
* export default defineConfig({
|
|
6287
|
+
* use: {
|
|
6288
|
+
* userAgent: 'some custom ua',
|
|
6289
|
+
* },
|
|
6290
|
+
* });
|
|
6291
|
+
* ```
|
|
6292
|
+
*
|
|
6293
|
+
*/
|
|
5235
6294
|
userAgent: string | undefined
|
|
5236
6295
|
/** Emulates consistent viewport for each page. */
|
|
5237
6296
|
viewport: ViewportSize | null
|
|
@@ -5250,7 +6309,7 @@ interface PlaywrightTestOptions {
|
|
|
5250
6309
|
}
|
|
5251
6310
|
````
|
|
5252
6311
|
|
|
5253
|
-
_(
|
|
6312
|
+
_(The 18 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/playwright/types/test.d.ts`.)_
|
|
5254
6313
|
|
|
5255
6314
|
#### `PlaywrightWorkerArgs`
|
|
5256
6315
|
|
|
@@ -5974,7 +7033,8 @@ class PageImpl {
|
|
|
5974
7033
|
this.check(res, `request.${method.toLowerCase()}()`)
|
|
5975
7034
|
return new ResponseImpl(
|
|
5976
7035
|
res.value as ConstructorParameters<typeof ResponseImpl>[0],
|
|
5977
|
-
|
|
7036
|
+
this.bondName,
|
|
7037
|
+
)
|
|
5978
7038
|
}
|
|
5979
7039
|
this.request = {
|
|
5980
7040
|
get: (url: string, opts?: Dict) => fetchCall('GET', url, opts),
|
|
@@ -6117,7 +7177,7 @@ function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig
|
|
|
6117
7177
|
|
|
6118
7178
|
#### `withConsoleGuard(base)`
|
|
6119
7179
|
|
|
6120
|
-
Extend a Playwright `test` with
|
|
7180
|
+
Extend a Playwright `test` with a console-error guard that attaches when its page is requested.
|
|
6121
7181
|
|
|
6122
7182
|
To intentionally let a known error through (rare — almost always a smell
|
|
6123
7183
|
that should be fixed in the app), use
|
|
@@ -6294,12 +7354,12 @@ const e2eProviderName: E2EProviderName
|
|
|
6294
7354
|
|
|
6295
7355
|
Drop-in for `import { test } from '@playwright/test'`.
|
|
6296
7356
|
|
|
6297
|
-
With the `playwright` provider
|
|
6298
|
-
traces
|
|
7357
|
+
With the `playwright` provider, Playwright's browser fixture supplies real browsers,
|
|
7358
|
+
traces and videos after any needed browser setup. With any other provider (the live
|
|
6299
7359
|
preview inside a molecule sandbox) the `page` fixture comes from the bonded
|
|
6300
7360
|
provider's `connect()`, honouring the project's `baseURL`, `viewport`,
|
|
6301
7361
|
`actionTimeout` and `navigationTimeout` options, and no browser is launched.
|
|
6302
|
-
Either way the console-error guard is attached
|
|
7362
|
+
Either way the console-error guard is attached when the test uses the page fixture.
|
|
6303
7363
|
|
|
6304
7364
|
```typescript
|
|
6305
7365
|
const test: TestType<
|
|
@@ -6322,6 +7382,7 @@ Peer dependencies:
|
|
|
6322
7382
|
|
|
6323
7383
|
- `@molecule/app-bond`
|
|
6324
7384
|
- `@molecule/app-e2e`
|
|
7385
|
+
- `@molecule/app-e2e-playwright`
|
|
6325
7386
|
- `@playwright/test`
|
|
6326
7387
|
|
|
6327
7388
|
- **What works over the preview** (the `@molecule/app-e2e-preview` bond):
|
|
@@ -6381,5 +7442,4 @@ waitForRequest` (read the response with `page.request` or `fetch` in
|
|
|
6381
7442
|
bond uses it, and so can any future one.
|
|
6382
7443
|
- `@playwright/test` is a peer dependency: it supplies the runner
|
|
6383
7444
|
(`npx playwright test`), `expect` for plain values, and the `Page` types.
|
|
6384
|
-
|
|
6385
|
-
`npx playwright install`.
|
|
7445
|
+
Browser setup happens separately when a test requests a managed browser.
|