@checkly/playwright-core 1.51.17-beta.2 → 1.54.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/ThirdPartyNotices.txt +65 -123
  2. package/browsers.json +16 -14
  3. package/index.js +1 -1
  4. package/lib/androidServerImpl.js +47 -50
  5. package/lib/browserServerImpl.js +89 -69
  6. package/lib/checkly/escapeRegExp.js +23 -27
  7. package/lib/checkly/fetch.js +64 -46
  8. package/lib/checkly/secretsFilter.js +49 -35
  9. package/lib/cli/driver.js +71 -69
  10. package/lib/cli/program.js +400 -359
  11. package/lib/cli/programWithTestStub.js +51 -45
  12. package/lib/client/accessibility.js +31 -32
  13. package/lib/client/android.js +151 -242
  14. package/lib/client/api.js +135 -283
  15. package/lib/client/artifact.js +39 -36
  16. package/lib/client/browser.js +96 -71
  17. package/lib/client/browserContext.js +314 -345
  18. package/lib/client/browserType.js +103 -127
  19. package/lib/client/cdpSession.js +29 -31
  20. package/lib/client/channelOwner.js +90 -113
  21. package/lib/client/clientHelper.js +48 -39
  22. package/lib/client/clientInstrumentation.js +40 -37
  23. package/lib/client/clientStackTrace.js +41 -37
  24. package/lib/client/clock.js +36 -36
  25. package/lib/client/connection.js +188 -214
  26. package/lib/client/consoleMessage.js +31 -28
  27. package/lib/client/coverage.js +25 -22
  28. package/lib/client/dialog.js +30 -31
  29. package/lib/client/download.js +25 -25
  30. package/lib/client/electron.js +80 -77
  31. package/lib/client/elementHandle.js +120 -159
  32. package/lib/client/errors.js +53 -53
  33. package/lib/client/eventEmitter.js +124 -121
  34. package/lib/client/events.js +72 -68
  35. package/lib/client/fetch.js +166 -190
  36. package/lib/client/fileChooser.js +25 -24
  37. package/lib/client/fileUtils.js +31 -28
  38. package/lib/client/frame.js +207 -306
  39. package/lib/client/harRouter.js +42 -52
  40. package/lib/client/input.js +42 -69
  41. package/lib/client/jsHandle.js +54 -69
  42. package/lib/client/jsonPipe.js +27 -23
  43. package/lib/client/localUtils.js +29 -29
  44. package/lib/client/locator.js +145 -237
  45. package/lib/client/network.js +282 -307
  46. package/lib/client/page.js +269 -318
  47. package/lib/client/platform.js +46 -43
  48. package/lib/client/playwright.js +51 -76
  49. package/lib/client/selectors.js +45 -63
  50. package/lib/client/stream.js +29 -25
  51. package/lib/client/timeoutSettings.js +55 -41
  52. package/lib/client/tracing.js +49 -96
  53. package/lib/client/types.js +26 -22
  54. package/lib/client/video.js +35 -27
  55. package/lib/client/waiter.js +69 -88
  56. package/lib/client/webError.js +25 -23
  57. package/lib/client/webSocket.js +43 -56
  58. package/lib/client/worker.js +48 -56
  59. package/lib/client/writableStream.js +27 -23
  60. package/lib/generated/bindingsControllerSource.js +28 -0
  61. package/lib/generated/clockSource.js +26 -6
  62. package/lib/generated/consoleApiSource.js +26 -6
  63. package/lib/generated/injectedScriptSource.js +26 -6
  64. package/lib/generated/pollingRecorderSource.js +26 -6
  65. package/lib/generated/storageScriptSource.js +28 -0
  66. package/lib/generated/utilityScriptSource.js +26 -6
  67. package/lib/generated/webSocketMockSource.js +333 -5
  68. package/lib/inProcessFactory.js +51 -53
  69. package/lib/inprocess.js +2 -19
  70. package/lib/outofprocess.js +51 -46
  71. package/lib/protocol/serializers.js +153 -134
  72. package/lib/protocol/validator.js +2807 -2739
  73. package/lib/protocol/validatorPrimitives.js +114 -73
  74. package/lib/remote/playwrightConnection.js +88 -242
  75. package/lib/remote/playwrightServer.js +305 -92
  76. package/lib/server/accessibility.js +44 -37
  77. package/lib/server/android/android.js +251 -241
  78. package/lib/server/android/backendAdb.js +87 -82
  79. package/lib/server/artifact.js +78 -55
  80. package/lib/server/bidi/bidiBrowser.js +297 -158
  81. package/lib/server/bidi/bidiChromium.js +119 -89
  82. package/lib/server/bidi/bidiConnection.js +66 -83
  83. package/lib/server/bidi/bidiExecutionContext.js +129 -113
  84. package/lib/server/bidi/bidiFirefox.js +86 -76
  85. package/lib/server/bidi/bidiInput.js +106 -117
  86. package/lib/server/bidi/bidiNetworkManager.js +142 -159
  87. package/lib/server/bidi/bidiOverCdp.js +57 -58
  88. package/lib/server/bidi/bidiPage.js +260 -260
  89. package/lib/server/bidi/bidiPdf.js +52 -86
  90. package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
  91. package/lib/server/bidi/third_party/bidiDeserializer.js +55 -50
  92. package/lib/server/bidi/third_party/bidiKeyboard.js +236 -220
  93. package/lib/server/bidi/third_party/bidiProtocol.js +22 -137
  94. package/lib/server/bidi/third_party/bidiProtocolCore.js +152 -0
  95. package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
  96. package/lib/server/bidi/third_party/bidiSerializer.js +67 -63
  97. package/lib/server/bidi/third_party/firefoxPrefs.js +141 -119
  98. package/lib/server/browser.js +93 -95
  99. package/lib/server/browserContext.js +419 -429
  100. package/lib/server/browserType.js +186 -216
  101. package/lib/server/callLog.js +47 -44
  102. package/lib/server/chromium/chromium.js +235 -203
  103. package/lib/server/chromium/chromiumSwitches.js +100 -67
  104. package/lib/server/chromium/crAccessibility.js +157 -131
  105. package/lib/server/chromium/crBrowser.js +310 -292
  106. package/lib/server/chromium/crConnection.js +95 -121
  107. package/lib/server/chromium/crCoverage.js +121 -131
  108. package/lib/server/chromium/crDevTools.js +60 -51
  109. package/lib/server/chromium/crDragDrop.js +68 -84
  110. package/lib/server/chromium/crExecutionContext.js +89 -83
  111. package/lib/server/chromium/crInput.js +118 -113
  112. package/lib/server/chromium/crNetworkManager.js +274 -375
  113. package/lib/server/chromium/crPage.js +536 -593
  114. package/lib/server/chromium/crPdf.js +54 -86
  115. package/lib/server/chromium/crProtocolHelper.js +92 -80
  116. package/lib/server/chromium/crServiceWorker.js +84 -73
  117. package/lib/server/chromium/defaultFontFamilies.js +152 -135
  118. package/lib/server/chromium/protocol.d.js +16 -0
  119. package/lib/server/chromium/videoRecorder.js +66 -99
  120. package/lib/server/clock.js +107 -83
  121. package/lib/server/codegen/csharp.js +192 -162
  122. package/lib/server/codegen/java.js +156 -129
  123. package/lib/server/codegen/javascript.js +163 -148
  124. package/lib/server/codegen/jsonl.js +32 -28
  125. package/lib/server/codegen/language.js +75 -52
  126. package/lib/server/codegen/languages.js +65 -27
  127. package/lib/server/codegen/python.js +141 -126
  128. package/lib/server/codegen/types.js +15 -4
  129. package/lib/server/console.js +28 -32
  130. package/lib/server/cookieStore.js +108 -86
  131. package/lib/server/debugController.js +147 -151
  132. package/lib/server/debugger.js +86 -78
  133. package/lib/server/deviceDescriptors.js +37 -24
  134. package/lib/server/deviceDescriptorsSource.json +238 -128
  135. package/lib/server/dialog.js +84 -39
  136. package/lib/server/dispatchers/androidDispatcher.js +257 -148
  137. package/lib/server/dispatchers/artifactDispatcher.js +79 -79
  138. package/lib/server/dispatchers/browserContextDispatcher.js +289 -259
  139. package/lib/server/dispatchers/browserDispatcher.js +96 -148
  140. package/lib/server/dispatchers/browserTypeDispatcher.js +50 -41
  141. package/lib/server/dispatchers/cdpSessionDispatcher.js +35 -39
  142. package/lib/server/dispatchers/debugControllerDispatcher.js +65 -83
  143. package/lib/server/dispatchers/dialogDispatcher.js +34 -31
  144. package/lib/server/dispatchers/dispatcher.js +208 -248
  145. package/lib/server/dispatchers/electronDispatcher.js +66 -70
  146. package/lib/server/dispatchers/elementHandlerDispatcher.js +164 -216
  147. package/lib/server/dispatchers/frameDispatcher.js +211 -272
  148. package/lib/server/dispatchers/jsHandleDispatcher.js +63 -75
  149. package/lib/server/dispatchers/jsonPipeDispatcher.js +37 -38
  150. package/lib/server/dispatchers/localUtilsDispatcher.js +121 -119
  151. package/lib/server/dispatchers/networkDispatchers.js +117 -128
  152. package/lib/server/dispatchers/pageDispatcher.js +256 -248
  153. package/lib/server/dispatchers/playwrightDispatcher.js +92 -87
  154. package/lib/server/dispatchers/streamDispatcher.js +52 -48
  155. package/lib/server/dispatchers/tracingDispatcher.js +47 -52
  156. package/lib/server/dispatchers/webSocketRouteDispatcher.js +126 -150
  157. package/lib/server/dispatchers/writableStreamDispatcher.js +65 -43
  158. package/lib/server/dom.js +485 -582
  159. package/lib/server/download.js +47 -37
  160. package/lib/server/electron/electron.js +216 -243
  161. package/lib/server/electron/loader.js +9 -37
  162. package/lib/server/errors.js +47 -46
  163. package/lib/server/fetch.js +317 -360
  164. package/lib/server/fileChooser.js +25 -24
  165. package/lib/server/fileUploadUtils.js +66 -60
  166. package/lib/server/firefox/ffAccessibility.js +153 -131
  167. package/lib/server/firefox/ffBrowser.js +268 -305
  168. package/lib/server/firefox/ffConnection.js +63 -84
  169. package/lib/server/firefox/ffExecutionContext.js +92 -73
  170. package/lib/server/firefox/ffInput.js +82 -84
  171. package/lib/server/firefox/ffNetworkManager.js +137 -114
  172. package/lib/server/firefox/ffPage.js +261 -293
  173. package/lib/server/firefox/firefox.js +80 -72
  174. package/lib/server/firefox/protocol.d.js +16 -0
  175. package/lib/server/formData.js +107 -35
  176. package/lib/server/frameSelectors.js +98 -114
  177. package/lib/server/frames.js +845 -1055
  178. package/lib/server/har/harRecorder.js +85 -77
  179. package/lib/server/har/harTracer.js +290 -223
  180. package/lib/server/harBackend.js +80 -80
  181. package/lib/server/helper.js +55 -59
  182. package/lib/server/index.js +59 -99
  183. package/lib/server/input.js +151 -189
  184. package/lib/server/instrumentation.js +57 -44
  185. package/lib/server/javascript.js +133 -134
  186. package/lib/server/launchApp.js +113 -75
  187. package/lib/server/localUtils.js +150 -142
  188. package/lib/server/macEditingCommands.js +141 -137
  189. package/lib/server/network.js +299 -303
  190. package/lib/server/page.js +513 -544
  191. package/lib/server/pipeTransport.js +49 -45
  192. package/lib/server/playwright.js +58 -67
  193. package/lib/server/progress.js +137 -68
  194. package/lib/server/protocolError.js +34 -31
  195. package/lib/server/recorder/chat.js +70 -86
  196. package/lib/server/recorder/recorderApp.js +341 -176
  197. package/lib/server/recorder/recorderInTraceViewer.js +65 -94
  198. package/lib/server/recorder/recorderRunner.js +93 -116
  199. package/lib/server/recorder/recorderSignalProcessor.js +83 -0
  200. package/lib/server/recorder/recorderUtils.js +104 -47
  201. package/lib/server/recorder/throttledFile.js +42 -30
  202. package/lib/server/recorder.js +395 -275
  203. package/lib/server/registry/browserFetcher.js +106 -101
  204. package/lib/server/registry/dependencies.js +245 -196
  205. package/lib/server/registry/index.js +930 -803
  206. package/lib/server/registry/nativeDeps.js +1073 -464
  207. package/lib/server/registry/oopDownloadBrowserMain.js +57 -75
  208. package/lib/server/screenshotter.js +160 -191
  209. package/lib/server/selectors.js +90 -51
  210. package/lib/server/socksClientCertificatesInterceptor.js +171 -186
  211. package/lib/server/socksInterceptor.js +62 -70
  212. package/lib/server/trace/recorder/snapshotter.js +76 -102
  213. package/lib/server/trace/recorder/snapshotterInjected.js +238 -217
  214. package/lib/server/trace/recorder/tracing.js +354 -362
  215. package/lib/server/trace/test/inMemorySnapshotter.js +46 -52
  216. package/lib/server/trace/viewer/traceViewer.js +160 -147
  217. package/lib/server/transport.js +119 -134
  218. package/lib/server/types.js +26 -22
  219. package/lib/server/usKeyboardLayout.js +135 -545
  220. package/lib/server/utils/ascii.js +39 -26
  221. package/lib/server/utils/comparators.js +105 -103
  222. package/lib/server/utils/crypto.js +157 -112
  223. package/lib/server/utils/debug.js +36 -32
  224. package/lib/server/utils/debugLogger.js +77 -48
  225. package/lib/server/utils/env.js +52 -37
  226. package/lib/server/utils/eventsHelper.js +29 -28
  227. package/lib/server/utils/expectUtils.js +31 -26
  228. package/lib/server/utils/fileUtils.js +123 -136
  229. package/lib/server/utils/happyEyeballs.js +141 -126
  230. package/lib/server/utils/hostPlatform.js +84 -120
  231. package/lib/server/utils/httpServer.js +106 -121
  232. package/lib/server/utils/image_tools/colorUtils.js +42 -51
  233. package/lib/server/utils/image_tools/compare.js +44 -43
  234. package/lib/server/utils/image_tools/imageChannel.js +38 -30
  235. package/lib/server/utils/image_tools/stats.js +40 -40
  236. package/lib/server/utils/linuxUtils.js +50 -37
  237. package/lib/server/utils/network.js +152 -96
  238. package/lib/server/utils/nodePlatform.js +87 -79
  239. package/lib/server/utils/pipeTransport.js +44 -42
  240. package/lib/server/utils/processLauncher.js +111 -121
  241. package/lib/server/utils/profiler.js +52 -39
  242. package/lib/server/utils/socksProxy.js +280 -339
  243. package/lib/server/utils/spawnAsync.js +37 -41
  244. package/lib/server/utils/task.js +31 -38
  245. package/lib/server/utils/userAgent.js +73 -66
  246. package/lib/server/utils/wsServer.js +68 -75
  247. package/lib/server/utils/zipFile.js +36 -37
  248. package/lib/server/utils/zones.js +37 -34
  249. package/lib/server/webkit/protocol.d.js +16 -0
  250. package/lib/server/webkit/webkit.js +77 -61
  251. package/lib/server/webkit/wkAccessibility.js +161 -118
  252. package/lib/server/webkit/wkBrowser.js +193 -184
  253. package/lib/server/webkit/wkConnection.js +59 -83
  254. package/lib/server/webkit/wkExecutionContext.js +85 -70
  255. package/lib/server/webkit/wkInput.js +97 -95
  256. package/lib/server/webkit/wkInterceptableRequest.js +102 -95
  257. package/lib/server/webkit/wkPage.js +568 -667
  258. package/lib/server/webkit/wkProvisionalPage.js +45 -56
  259. package/lib/server/webkit/wkWorkers.js +79 -79
  260. package/lib/utils/expectUtils.js +31 -26
  261. package/lib/utils/isomorphic/ariaSnapshot.js +149 -152
  262. package/lib/utils/isomorphic/assert.js +28 -22
  263. package/lib/utils/isomorphic/colors.js +66 -59
  264. package/lib/utils/isomorphic/cssParser.js +120 -125
  265. package/lib/utils/isomorphic/cssTokenizer.js +436 -364
  266. package/lib/utils/isomorphic/headers.js +38 -37
  267. package/lib/utils/isomorphic/locatorGenerators.js +358 -357
  268. package/lib/utils/isomorphic/locatorParser.js +96 -105
  269. package/lib/utils/isomorphic/locatorUtils.js +63 -44
  270. package/lib/utils/isomorphic/manualPromise.js +46 -39
  271. package/lib/utils/isomorphic/mimeType.js +447 -25
  272. package/lib/utils/isomorphic/multimap.js +34 -27
  273. package/lib/utils/isomorphic/protocolFormatter.js +68 -0
  274. package/lib/utils/isomorphic/protocolMetainfo.js +321 -0
  275. package/lib/utils/isomorphic/recorderUtils.js +140 -181
  276. package/lib/utils/isomorphic/rtti.js +35 -33
  277. package/lib/utils/isomorphic/selectorParser.js +182 -193
  278. package/lib/utils/isomorphic/semaphore.js +27 -24
  279. package/lib/utils/isomorphic/stackTrace.js +87 -98
  280. package/lib/utils/isomorphic/stringUtils.js +98 -112
  281. package/lib/utils/isomorphic/time.js +46 -22
  282. package/lib/utils/isomorphic/timeoutRunner.js +53 -53
  283. package/lib/utils/isomorphic/traceUtils.js +37 -41
  284. package/lib/utils/isomorphic/types.js +15 -4
  285. package/lib/utils/isomorphic/urlMatch.js +113 -67
  286. package/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
  287. package/lib/utils.js +101 -443
  288. package/lib/utilsBundle.js +101 -52
  289. package/lib/utilsBundleImpl/index.js +160 -150
  290. package/lib/zipBundle.js +32 -23
  291. package/lib/zipBundleImpl.js +4 -4
  292. package/package.json +1 -1
  293. package/types/protocol.d.ts +1267 -1057
  294. package/types/types.d.ts +131 -29
  295. package/lib/common/socksProxy.js +0 -569
  296. package/lib/common/timeoutSettings.js +0 -73
  297. package/lib/common/types.js +0 -5
  298. package/lib/image_tools/colorUtils.js +0 -98
  299. package/lib/image_tools/compare.js +0 -108
  300. package/lib/image_tools/imageChannel.js +0 -70
  301. package/lib/image_tools/stats.js +0 -102
  302. package/lib/protocol/debug.js +0 -27
  303. package/lib/protocol/transport.js +0 -82
  304. package/lib/server/dispatchers/selectorsDispatcher.js +0 -36
  305. package/lib/server/isomorphic/utilityScriptSerializers.js +0 -229
  306. package/lib/server/recorder/contextRecorder.js +0 -290
  307. package/lib/server/recorder/recorderCollection.js +0 -104
  308. package/lib/server/recorder/recorderFrontend.js +0 -5
  309. package/lib/server/storageScript.js +0 -160
  310. package/lib/server/timeoutSettings.js +0 -74
  311. package/lib/third_party/diff_match_patch.js +0 -2222
  312. package/lib/utils/ascii.js +0 -31
  313. package/lib/utils/comparators.js +0 -171
  314. package/lib/utils/crypto.js +0 -174
  315. package/lib/utils/debug.js +0 -46
  316. package/lib/utils/debugLogger.js +0 -91
  317. package/lib/utils/env.js +0 -49
  318. package/lib/utils/eventsHelper.js +0 -38
  319. package/lib/utils/fileUtils.js +0 -205
  320. package/lib/utils/happy-eyeballs.js +0 -210
  321. package/lib/utils/headers.js +0 -52
  322. package/lib/utils/hostPlatform.js +0 -133
  323. package/lib/utils/httpServer.js +0 -237
  324. package/lib/utils/index.js +0 -368
  325. package/lib/utils/linuxUtils.js +0 -78
  326. package/lib/utils/manualPromise.js +0 -109
  327. package/lib/utils/multimap.js +0 -75
  328. package/lib/utils/network.js +0 -160
  329. package/lib/utils/processLauncher.js +0 -248
  330. package/lib/utils/profiler.js +0 -53
  331. package/lib/utils/rtti.js +0 -44
  332. package/lib/utils/semaphore.js +0 -51
  333. package/lib/utils/spawnAsync.js +0 -45
  334. package/lib/utils/stackTrace.js +0 -121
  335. package/lib/utils/task.js +0 -58
  336. package/lib/utils/time.js +0 -37
  337. package/lib/utils/timeoutRunner.js +0 -66
  338. package/lib/utils/traceUtils.js +0 -44
  339. package/lib/utils/userAgent.js +0 -105
  340. package/lib/utils/wsServer.js +0 -127
  341. package/lib/utils/zipFile.js +0 -75
  342. package/lib/utils/zones.js +0 -62
  343. package/lib/vite/htmlReport/index.html +0 -69
  344. package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +0 -24
  345. package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
  346. package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  347. package/lib/vite/recorder/assets/index-ELPgmkwA.js +0 -184
  348. package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
  349. package/lib/vite/recorder/index.html +0 -29
  350. package/lib/vite/recorder/playwright-logo.svg +0 -9
  351. package/lib/vite/traceViewer/assets/codeMirrorModule-gU1OOCQO.js +0 -24
  352. package/lib/vite/traceViewer/assets/defaultSettingsView-B5n_FjMx.js +0 -1
  353. package/lib/vite/traceViewer/assets/inspectorTab-6Tru8Mn_.js +0 -235
  354. package/lib/vite/traceViewer/assets/workbench-B_Nj4NA2.js +0 -25
  355. package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
  356. package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
  357. package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  358. package/lib/vite/traceViewer/defaultSettingsView.CO3FR0CX.css +0 -1
  359. package/lib/vite/traceViewer/embedded.DpNPH6mk.js +0 -2
  360. package/lib/vite/traceViewer/embedded.html +0 -18
  361. package/lib/vite/traceViewer/embedded.mLhjB5IF.css +0 -1
  362. package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
  363. package/lib/vite/traceViewer/index.CuE3SYGw.js +0 -2
  364. package/lib/vite/traceViewer/index.html +0 -47
  365. package/lib/vite/traceViewer/inspectorTab.CXDulcFG.css +0 -1
  366. package/lib/vite/traceViewer/playwright-logo.svg +0 -9
  367. package/lib/vite/traceViewer/recorder.BD-uZJs7.js +0 -2
  368. package/lib/vite/traceViewer/recorder.html +0 -17
  369. package/lib/vite/traceViewer/recorder.tn0RQdqM.css +0 -0
  370. package/lib/vite/traceViewer/snapshot.html +0 -21
  371. package/lib/vite/traceViewer/sw.bundle.js +0 -3
  372. package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
  373. package/lib/vite/traceViewer/uiMode.DHrNgddz.js +0 -5
  374. package/lib/vite/traceViewer/uiMode.html +0 -21
  375. package/lib/vite/traceViewer/workbench.B9vIAzH9.css +0 -1
  376. package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
@@ -1,123 +1,138 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var frame_exports = {};
30
+ __export(frame_exports, {
31
+ Frame: () => Frame,
32
+ verifyLoadState: () => verifyLoadState
5
33
  });
6
- exports.Frame = void 0;
7
- exports.verifyLoadState = verifyLoadState;
8
- var _eventEmitter = require("./eventEmitter");
9
- var _channelOwner = require("./channelOwner");
10
- var _clientHelper = require("./clientHelper");
11
- var _elementHandle = require("./elementHandle");
12
- var _events = require("./events");
13
- var _jsHandle = require("./jsHandle");
14
- var _locator = require("./locator");
15
- var network = _interopRequireWildcard(require("./network"));
16
- var _types = require("./types");
17
- var _waiter = require("./waiter");
18
- var _assert = require("../utils/isomorphic/assert");
19
- var _locatorUtils = require("../utils/isomorphic/locatorUtils");
20
- var _urlMatch = require("../utils/isomorphic/urlMatch");
21
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
- /**
24
- * Copyright 2017 Google Inc. All rights reserved.
25
- * Modifications copyright (c) Microsoft Corporation.
26
- *
27
- * Licensed under the Apache License, Version 2.0 (the "License");
28
- * you may not use this file except in compliance with the License.
29
- * You may obtain a copy of the License at
30
- *
31
- * http://www.apache.org/licenses/LICENSE-2.0
32
- *
33
- * Unless required by applicable law or agreed to in writing, software
34
- * distributed under the License is distributed on an "AS IS" BASIS,
35
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36
- * See the License for the specific language governing permissions and
37
- * limitations under the License.
38
- */
39
-
40
- class Frame extends _channelOwner.ChannelOwner {
41
- static from(frame) {
42
- return frame._object;
43
- }
44
- static fromNullable(frame) {
45
- return frame ? Frame.from(frame) : null;
46
- }
34
+ module.exports = __toCommonJS(frame_exports);
35
+ var import_eventEmitter = require("./eventEmitter");
36
+ var import_channelOwner = require("./channelOwner");
37
+ var import_clientHelper = require("./clientHelper");
38
+ var import_elementHandle = require("./elementHandle");
39
+ var import_events = require("./events");
40
+ var import_jsHandle = require("./jsHandle");
41
+ var import_locator = require("./locator");
42
+ var network = __toESM(require("./network"));
43
+ var import_types = require("./types");
44
+ var import_waiter = require("./waiter");
45
+ var import_assert = require("../utils/isomorphic/assert");
46
+ var import_locatorUtils = require("../utils/isomorphic/locatorUtils");
47
+ var import_urlMatch = require("../utils/isomorphic/urlMatch");
48
+ var import_timeoutSettings = require("./timeoutSettings");
49
+ class Frame extends import_channelOwner.ChannelOwner {
47
50
  constructor(parent, type, guid, initializer) {
48
51
  super(parent, type, guid, initializer);
49
- this._eventEmitter = void 0;
50
- this._loadStates = void 0;
51
52
  this._parentFrame = null;
52
- this._url = '';
53
- this._name = '';
53
+ this._url = "";
54
+ this._name = "";
54
55
  this._detached = false;
55
- this._childFrames = new Set();
56
- this._page = void 0;
57
- this._eventEmitter = new _eventEmitter.EventEmitter(parent._platform);
56
+ this._childFrames = /* @__PURE__ */ new Set();
57
+ this._eventEmitter = new import_eventEmitter.EventEmitter(parent._platform);
58
58
  this._eventEmitter.setMaxListeners(0);
59
59
  this._parentFrame = Frame.fromNullable(initializer.parentFrame);
60
- if (this._parentFrame) this._parentFrame._childFrames.add(this);
60
+ if (this._parentFrame)
61
+ this._parentFrame._childFrames.add(this);
61
62
  this._name = initializer.name;
62
63
  this._url = initializer.url;
63
64
  this._loadStates = new Set(initializer.loadStates);
64
- this._channel.on('loadstate', event => {
65
+ this._channel.on("loadstate", (event) => {
65
66
  if (event.add) {
66
67
  this._loadStates.add(event.add);
67
- this._eventEmitter.emit('loadstate', event.add);
68
+ this._eventEmitter.emit("loadstate", event.add);
68
69
  }
69
- if (event.remove) this._loadStates.delete(event.remove);
70
- if (!this._parentFrame && event.add === 'load' && this._page) this._page.emit(_events.Events.Page.Load, this._page);
71
- if (!this._parentFrame && event.add === 'domcontentloaded' && this._page) this._page.emit(_events.Events.Page.DOMContentLoaded, this._page);
70
+ if (event.remove)
71
+ this._loadStates.delete(event.remove);
72
+ if (!this._parentFrame && event.add === "load" && this._page)
73
+ this._page.emit(import_events.Events.Page.Load, this._page);
74
+ if (!this._parentFrame && event.add === "domcontentloaded" && this._page)
75
+ this._page.emit(import_events.Events.Page.DOMContentLoaded, this._page);
72
76
  });
73
- this._channel.on('navigated', event => {
77
+ this._channel.on("navigated", (event) => {
74
78
  this._url = event.url;
75
79
  this._name = event.name;
76
- this._eventEmitter.emit('navigated', event);
77
- if (!event.error && this._page) this._page.emit(_events.Events.Page.FrameNavigated, this);
80
+ this._eventEmitter.emit("navigated", event);
81
+ if (!event.error && this._page)
82
+ this._page.emit(import_events.Events.Page.FrameNavigated, this);
78
83
  });
79
84
  }
85
+ static from(frame) {
86
+ return frame._object;
87
+ }
88
+ static fromNullable(frame) {
89
+ return frame ? Frame.from(frame) : null;
90
+ }
80
91
  page() {
81
92
  return this._page;
82
93
  }
94
+ _timeout(options) {
95
+ const timeoutSettings = this._page?._timeoutSettings || new import_timeoutSettings.TimeoutSettings(this._platform);
96
+ return timeoutSettings.timeout(options || {});
97
+ }
98
+ _navigationTimeout(options) {
99
+ const timeoutSettings = this._page?._timeoutSettings || new import_timeoutSettings.TimeoutSettings(this._platform);
100
+ return timeoutSettings.navigationTimeout(options || {});
101
+ }
83
102
  async goto(url, options = {}) {
84
- const waitUntil = verifyLoadState('waitUntil', options.waitUntil === undefined ? 'load' : options.waitUntil);
85
- return network.Response.fromNullable((await this._channel.goto({
86
- url,
87
- ...options,
88
- waitUntil
89
- })).response);
103
+ const waitUntil = verifyLoadState("waitUntil", options.waitUntil === void 0 ? "load" : options.waitUntil);
104
+ return network.Response.fromNullable((await this._channel.goto({ url, ...options, waitUntil, timeout: this._navigationTimeout(options) })).response);
90
105
  }
91
106
  _setupNavigationWaiter(options) {
92
- const waiter = new _waiter.Waiter(this._page, '');
93
- if (this._page.isClosed()) waiter.rejectImmediately(this._page._closeErrorWithReason());
94
- waiter.rejectOnEvent(this._page, _events.Events.Page.Close, () => this._page._closeErrorWithReason());
95
- waiter.rejectOnEvent(this._page, _events.Events.Page.Crash, new Error('Navigation failed because page crashed!'));
96
- waiter.rejectOnEvent(this._page, _events.Events.Page.FrameDetached, new Error('Navigating frame was detached!'), frame => frame === this);
107
+ const waiter = new import_waiter.Waiter(this._page, "");
108
+ if (this._page.isClosed())
109
+ waiter.rejectImmediately(this._page._closeErrorWithReason());
110
+ waiter.rejectOnEvent(this._page, import_events.Events.Page.Close, () => this._page._closeErrorWithReason());
111
+ waiter.rejectOnEvent(this._page, import_events.Events.Page.Crash, new Error("Navigation failed because page crashed!"));
112
+ waiter.rejectOnEvent(this._page, import_events.Events.Page.FrameDetached, new Error("Navigating frame was detached!"), (frame) => frame === this);
97
113
  const timeout = this._page._timeoutSettings.navigationTimeout(options);
98
114
  waiter.rejectOnTimeout(timeout, `Timeout ${timeout}ms exceeded.`);
99
115
  return waiter;
100
116
  }
101
117
  async waitForNavigation(options = {}) {
102
118
  return await this._page._wrapApiCall(async () => {
103
- const waitUntil = verifyLoadState('waitUntil', options.waitUntil === undefined ? 'load' : options.waitUntil);
119
+ const waitUntil = verifyLoadState("waitUntil", options.waitUntil === void 0 ? "load" : options.waitUntil);
104
120
  const waiter = this._setupNavigationWaiter(options);
105
- const toUrl = typeof options.url === 'string' ? ` to "${options.url}"` : '';
121
+ const toUrl = typeof options.url === "string" ? ` to "${options.url}"` : "";
106
122
  waiter.log(`waiting for navigation${toUrl} until "${waitUntil}"`);
107
- const navigatedEvent = await waiter.waitForEvent(this._eventEmitter, 'navigated', event => {
108
- var _this$_page;
109
- // Any failed navigation results in a rejection.
110
- if (event.error) return true;
123
+ const navigatedEvent = await waiter.waitForEvent(this._eventEmitter, "navigated", (event) => {
124
+ if (event.error)
125
+ return true;
111
126
  waiter.log(` navigated to "${event.url}"`);
112
- return (0, _urlMatch.urlMatches)((_this$_page = this._page) === null || _this$_page === void 0 ? void 0 : _this$_page.context()._options.baseURL, event.url, options.url);
127
+ return (0, import_urlMatch.urlMatches)(this._page?.context()._options.baseURL, event.url, options.url);
113
128
  });
114
129
  if (navigatedEvent.error) {
115
130
  const e = new Error(navigatedEvent.error);
116
- e.stack = '';
131
+ e.stack = "";
117
132
  await waiter.waitForPromise(Promise.reject(e));
118
133
  }
119
134
  if (!this._loadStates.has(waitUntil)) {
120
- await waiter.waitForEvent(this._eventEmitter, 'loadstate', s => {
135
+ await waiter.waitForEvent(this._eventEmitter, "loadstate", (s) => {
121
136
  waiter.log(` "${s}" event fired`);
122
137
  return s === waitUntil;
123
138
  });
@@ -126,129 +141,87 @@ class Frame extends _channelOwner.ChannelOwner {
126
141
  const response = request ? await waiter.waitForPromise(request._finalRequest()._internalResponse()) : null;
127
142
  waiter.dispose();
128
143
  return response;
129
- });
144
+ }, { title: "Wait for navigation" });
130
145
  }
131
- async waitForLoadState(state = 'load', options = {}) {
132
- state = verifyLoadState('state', state);
146
+ async waitForLoadState(state = "load", options = {}) {
147
+ state = verifyLoadState("state", state);
133
148
  return await this._page._wrapApiCall(async () => {
134
149
  const waiter = this._setupNavigationWaiter(options);
135
150
  if (this._loadStates.has(state)) {
136
151
  waiter.log(` not waiting, "${state}" event already fired`);
137
152
  } else {
138
- await waiter.waitForEvent(this._eventEmitter, 'loadstate', s => {
153
+ await waiter.waitForEvent(this._eventEmitter, "loadstate", (s) => {
139
154
  waiter.log(` "${s}" event fired`);
140
155
  return s === state;
141
156
  });
142
157
  }
143
158
  waiter.dispose();
144
- });
159
+ }, { title: `Wait for load state "${state}"` });
145
160
  }
146
161
  async waitForURL(url, options = {}) {
147
- var _this$_page2;
148
- if ((0, _urlMatch.urlMatches)((_this$_page2 = this._page) === null || _this$_page2 === void 0 ? void 0 : _this$_page2.context()._options.baseURL, this.url(), url)) return await this.waitForLoadState(options.waitUntil, options);
149
- await this.waitForNavigation({
150
- url,
151
- ...options
152
- });
162
+ if ((0, import_urlMatch.urlMatches)(this._page?.context()._options.baseURL, this.url(), url))
163
+ return await this.waitForLoadState(options.waitUntil, options);
164
+ await this.waitForNavigation({ url, ...options });
153
165
  }
154
166
  async frameElement() {
155
- return _elementHandle.ElementHandle.from((await this._channel.frameElement()).element);
167
+ return import_elementHandle.ElementHandle.from((await this._channel.frameElement()).element);
156
168
  }
157
169
  async evaluateHandle(pageFunction, arg) {
158
- (0, _jsHandle.assertMaxArguments)(arguments.length, 2);
159
- const result = await this._channel.evaluateExpressionHandle({
160
- expression: String(pageFunction),
161
- isFunction: typeof pageFunction === 'function',
162
- arg: (0, _jsHandle.serializeArgument)(arg)
163
- });
164
- return _jsHandle.JSHandle.from(result.handle);
170
+ (0, import_jsHandle.assertMaxArguments)(arguments.length, 2);
171
+ const result = await this._channel.evaluateExpressionHandle({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
172
+ return import_jsHandle.JSHandle.from(result.handle);
165
173
  }
166
174
  async evaluate(pageFunction, arg) {
167
- (0, _jsHandle.assertMaxArguments)(arguments.length, 2);
168
- const result = await this._channel.evaluateExpression({
169
- expression: String(pageFunction),
170
- isFunction: typeof pageFunction === 'function',
171
- arg: (0, _jsHandle.serializeArgument)(arg)
172
- });
173
- return (0, _jsHandle.parseResult)(result.value);
175
+ (0, import_jsHandle.assertMaxArguments)(arguments.length, 2);
176
+ const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
177
+ return (0, import_jsHandle.parseResult)(result.value);
174
178
  }
175
179
  async _evaluateExposeUtilityScript(pageFunction, arg) {
176
- (0, _jsHandle.assertMaxArguments)(arguments.length, 2);
177
- const result = await this._channel.evaluateExpression({
178
- expression: String(pageFunction),
179
- isFunction: typeof pageFunction === 'function',
180
- arg: (0, _jsHandle.serializeArgument)(arg)
181
- });
182
- return (0, _jsHandle.parseResult)(result.value);
180
+ (0, import_jsHandle.assertMaxArguments)(arguments.length, 2);
181
+ const result = await this._channel.evaluateExpression({ expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
182
+ return (0, import_jsHandle.parseResult)(result.value);
183
183
  }
184
184
  async $(selector, options) {
185
- const result = await this._channel.querySelector({
186
- selector,
187
- ...options
188
- });
189
- return _elementHandle.ElementHandle.fromNullable(result.element);
185
+ const result = await this._channel.querySelector({ selector, ...options });
186
+ return import_elementHandle.ElementHandle.fromNullable(result.element);
190
187
  }
191
188
  async waitForSelector(selector, options = {}) {
192
- if (options.visibility) throw new Error('options.visibility is not supported, did you mean options.state?');
193
- if (options.waitFor && options.waitFor !== 'visible') throw new Error('options.waitFor is not supported, did you mean options.state?');
194
- const result = await this._channel.waitForSelector({
195
- selector,
196
- ...options
197
- });
198
- return _elementHandle.ElementHandle.fromNullable(result.element);
189
+ if (options.visibility)
190
+ throw new Error("options.visibility is not supported, did you mean options.state?");
191
+ if (options.waitFor && options.waitFor !== "visible")
192
+ throw new Error("options.waitFor is not supported, did you mean options.state?");
193
+ const result = await this._channel.waitForSelector({ selector, ...options, timeout: this._timeout(options) });
194
+ return import_elementHandle.ElementHandle.fromNullable(result.element);
199
195
  }
200
196
  async dispatchEvent(selector, type, eventInit, options = {}) {
201
- await this._channel.dispatchEvent({
202
- selector,
203
- type,
204
- eventInit: (0, _jsHandle.serializeArgument)(eventInit),
205
- ...options
206
- });
197
+ await this._channel.dispatchEvent({ selector, type, eventInit: (0, import_jsHandle.serializeArgument)(eventInit), ...options, timeout: this._timeout(options) });
207
198
  }
208
199
  async $eval(selector, pageFunction, arg) {
209
- (0, _jsHandle.assertMaxArguments)(arguments.length, 3);
210
- const result = await this._channel.evalOnSelector({
211
- selector,
212
- expression: String(pageFunction),
213
- isFunction: typeof pageFunction === 'function',
214
- arg: (0, _jsHandle.serializeArgument)(arg)
215
- });
216
- return (0, _jsHandle.parseResult)(result.value);
200
+ (0, import_jsHandle.assertMaxArguments)(arguments.length, 3);
201
+ const result = await this._channel.evalOnSelector({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
202
+ return (0, import_jsHandle.parseResult)(result.value);
217
203
  }
218
204
  async $$eval(selector, pageFunction, arg) {
219
- (0, _jsHandle.assertMaxArguments)(arguments.length, 3);
220
- const result = await this._channel.evalOnSelectorAll({
221
- selector,
222
- expression: String(pageFunction),
223
- isFunction: typeof pageFunction === 'function',
224
- arg: (0, _jsHandle.serializeArgument)(arg)
225
- });
226
- return (0, _jsHandle.parseResult)(result.value);
205
+ (0, import_jsHandle.assertMaxArguments)(arguments.length, 3);
206
+ const result = await this._channel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
207
+ return (0, import_jsHandle.parseResult)(result.value);
227
208
  }
228
209
  async $$(selector) {
229
- const result = await this._channel.querySelectorAll({
230
- selector
231
- });
232
- return result.elements.map(e => _elementHandle.ElementHandle.from(e));
210
+ const result = await this._channel.querySelectorAll({ selector });
211
+ return result.elements.map((e) => import_elementHandle.ElementHandle.from(e));
233
212
  }
234
213
  async _queryCount(selector) {
235
- return (await this._channel.queryCount({
236
- selector
237
- })).value;
214
+ return (await this._channel.queryCount({ selector })).value;
238
215
  }
239
216
  async content() {
240
217
  return (await this._channel.content()).value;
241
218
  }
242
219
  async setContent(html, options = {}) {
243
- const waitUntil = verifyLoadState('waitUntil', options.waitUntil === undefined ? 'load' : options.waitUntil);
244
- await this._channel.setContent({
245
- html,
246
- ...options,
247
- waitUntil
248
- });
220
+ const waitUntil = verifyLoadState("waitUntil", options.waitUntil === void 0 ? "load" : options.waitUntil);
221
+ await this._channel.setContent({ html, ...options, waitUntil, timeout: this._navigationTimeout(options) });
249
222
  }
250
223
  name() {
251
- return this._name || '';
224
+ return this._name || "";
252
225
  }
253
226
  url() {
254
227
  return this._url;
@@ -263,241 +236,169 @@ class Frame extends _channelOwner.ChannelOwner {
263
236
  return this._detached;
264
237
  }
265
238
  async addScriptTag(options = {}) {
266
- const copy = {
267
- ...options
268
- };
239
+ const copy = { ...options };
269
240
  if (copy.path) {
270
241
  copy.content = (await this._platform.fs().promises.readFile(copy.path)).toString();
271
- copy.content = (0, _clientHelper.addSourceUrlToScript)(copy.content, copy.path);
242
+ copy.content = (0, import_clientHelper.addSourceUrlToScript)(copy.content, copy.path);
272
243
  }
273
- return _elementHandle.ElementHandle.from((await this._channel.addScriptTag({
274
- ...copy
275
- })).element);
244
+ return import_elementHandle.ElementHandle.from((await this._channel.addScriptTag({ ...copy })).element);
276
245
  }
277
246
  async addStyleTag(options = {}) {
278
- const copy = {
279
- ...options
280
- };
247
+ const copy = { ...options };
281
248
  if (copy.path) {
282
249
  copy.content = (await this._platform.fs().promises.readFile(copy.path)).toString();
283
- copy.content += '/*# sourceURL=' + copy.path.replace(/\n/g, '') + '*/';
250
+ copy.content += "/*# sourceURL=" + copy.path.replace(/\n/g, "") + "*/";
284
251
  }
285
- return _elementHandle.ElementHandle.from((await this._channel.addStyleTag({
286
- ...copy
287
- })).element);
252
+ return import_elementHandle.ElementHandle.from((await this._channel.addStyleTag({ ...copy })).element);
288
253
  }
289
254
  async click(selector, options = {}) {
290
- return await this._channel.click({
291
- selector,
292
- ...options
293
- });
255
+ return await this._channel.click({ selector, ...options, timeout: this._timeout(options) });
294
256
  }
295
257
  async dblclick(selector, options = {}) {
296
- return await this._channel.dblclick({
297
- selector,
298
- ...options
299
- });
258
+ return await this._channel.dblclick({ selector, ...options, timeout: this._timeout(options) });
300
259
  }
301
260
  async dragAndDrop(source, target, options = {}) {
302
- return await this._channel.dragAndDrop({
303
- source,
304
- target,
305
- ...options
306
- });
261
+ return await this._channel.dragAndDrop({ source, target, ...options, timeout: this._timeout(options) });
307
262
  }
308
263
  async tap(selector, options = {}) {
309
- return await this._channel.tap({
310
- selector,
311
- ...options
312
- });
264
+ return await this._channel.tap({ selector, ...options, timeout: this._timeout(options) });
313
265
  }
314
266
  async fill(selector, value, options = {}) {
315
- return await this._channel.fill({
316
- selector,
317
- value,
318
- ...options
319
- });
267
+ return await this._channel.fill({ selector, value, ...options, timeout: this._timeout(options) });
320
268
  }
321
269
  async _highlight(selector) {
322
- return await this._channel.highlight({
323
- selector
324
- });
270
+ return await this._channel.highlight({ selector });
325
271
  }
326
272
  locator(selector, options) {
327
- return new _locator.Locator(this, selector, options);
273
+ return new import_locator.Locator(this, selector, options);
328
274
  }
329
275
  getByTestId(testId) {
330
- return this.locator((0, _locatorUtils.getByTestIdSelector)((0, _locator.testIdAttributeName)(), testId));
276
+ return this.locator((0, import_locatorUtils.getByTestIdSelector)((0, import_locator.testIdAttributeName)(), testId));
331
277
  }
332
278
  getByAltText(text, options) {
333
- return this.locator((0, _locatorUtils.getByAltTextSelector)(text, options));
279
+ return this.locator((0, import_locatorUtils.getByAltTextSelector)(text, options));
334
280
  }
335
281
  getByLabel(text, options) {
336
- return this.locator((0, _locatorUtils.getByLabelSelector)(text, options));
282
+ return this.locator((0, import_locatorUtils.getByLabelSelector)(text, options));
337
283
  }
338
284
  getByPlaceholder(text, options) {
339
- return this.locator((0, _locatorUtils.getByPlaceholderSelector)(text, options));
285
+ return this.locator((0, import_locatorUtils.getByPlaceholderSelector)(text, options));
340
286
  }
341
287
  getByText(text, options) {
342
- return this.locator((0, _locatorUtils.getByTextSelector)(text, options));
288
+ return this.locator((0, import_locatorUtils.getByTextSelector)(text, options));
343
289
  }
344
290
  getByTitle(text, options) {
345
- return this.locator((0, _locatorUtils.getByTitleSelector)(text, options));
291
+ return this.locator((0, import_locatorUtils.getByTitleSelector)(text, options));
346
292
  }
347
293
  getByRole(role, options = {}) {
348
- return this.locator((0, _locatorUtils.getByRoleSelector)(role, options));
294
+ return this.locator((0, import_locatorUtils.getByRoleSelector)(role, options));
349
295
  }
350
296
  frameLocator(selector) {
351
- return new _locator.FrameLocator(this, selector);
297
+ return new import_locator.FrameLocator(this, selector);
352
298
  }
353
299
  async focus(selector, options = {}) {
354
- await this._channel.focus({
355
- selector,
356
- ...options
357
- });
300
+ await this._channel.focus({ selector, ...options, timeout: this._timeout(options) });
358
301
  }
359
302
  async textContent(selector, options = {}) {
360
- const value = (await this._channel.textContent({
361
- selector,
362
- ...options
363
- })).value;
364
- return value === undefined ? null : value;
303
+ const value = (await this._channel.textContent({ selector, ...options, timeout: this._timeout(options) })).value;
304
+ return value === void 0 ? null : value;
365
305
  }
366
306
  async innerText(selector, options = {}) {
367
- return (await this._channel.innerText({
368
- selector,
369
- ...options
370
- })).value;
307
+ return (await this._channel.innerText({ selector, ...options, timeout: this._timeout(options) })).value;
371
308
  }
372
309
  async innerHTML(selector, options = {}) {
373
- return (await this._channel.innerHTML({
374
- selector,
375
- ...options
376
- })).value;
310
+ return (await this._channel.innerHTML({ selector, ...options, timeout: this._timeout(options) })).value;
377
311
  }
378
312
  async getAttribute(selector, name, options = {}) {
379
- const value = (await this._channel.getAttribute({
380
- selector,
381
- name,
382
- ...options
383
- })).value;
384
- return value === undefined ? null : value;
313
+ const value = (await this._channel.getAttribute({ selector, name, ...options, timeout: this._timeout(options) })).value;
314
+ return value === void 0 ? null : value;
385
315
  }
386
316
  async inputValue(selector, options = {}) {
387
- return (await this._channel.inputValue({
388
- selector,
389
- ...options
390
- })).value;
317
+ return (await this._channel.inputValue({ selector, ...options, timeout: this._timeout(options) })).value;
391
318
  }
392
319
  async isChecked(selector, options = {}) {
393
- return (await this._channel.isChecked({
394
- selector,
395
- ...options
396
- })).value;
320
+ return (await this._channel.isChecked({ selector, ...options, timeout: this._timeout(options) })).value;
397
321
  }
398
322
  async isDisabled(selector, options = {}) {
399
- return (await this._channel.isDisabled({
400
- selector,
401
- ...options
402
- })).value;
323
+ return (await this._channel.isDisabled({ selector, ...options, timeout: this._timeout(options) })).value;
403
324
  }
404
325
  async isEditable(selector, options = {}) {
405
- return (await this._channel.isEditable({
406
- selector,
407
- ...options
408
- })).value;
326
+ return (await this._channel.isEditable({ selector, ...options, timeout: this._timeout(options) })).value;
409
327
  }
410
328
  async isEnabled(selector, options = {}) {
411
- return (await this._channel.isEnabled({
412
- selector,
413
- ...options
414
- })).value;
329
+ return (await this._channel.isEnabled({ selector, ...options, timeout: this._timeout(options) })).value;
415
330
  }
416
331
  async isHidden(selector, options = {}) {
417
- return (await this._channel.isHidden({
418
- selector,
419
- ...options
420
- })).value;
332
+ return (await this._channel.isHidden({ selector, ...options })).value;
421
333
  }
422
334
  async isVisible(selector, options = {}) {
423
- return (await this._channel.isVisible({
424
- selector,
425
- ...options
426
- })).value;
335
+ return (await this._channel.isVisible({ selector, ...options })).value;
427
336
  }
428
337
  async hover(selector, options = {}) {
429
- await this._channel.hover({
430
- selector,
431
- ...options
432
- });
338
+ await this._channel.hover({ selector, ...options, timeout: this._timeout(options) });
433
339
  }
434
340
  async selectOption(selector, values, options = {}) {
435
- return (await this._channel.selectOption({
436
- selector,
437
- ...(0, _elementHandle.convertSelectOptionValues)(values),
438
- ...options
439
- })).values;
341
+ return (await this._channel.selectOption({ selector, ...(0, import_elementHandle.convertSelectOptionValues)(values), ...options, timeout: this._timeout(options) })).values;
440
342
  }
441
343
  async setInputFiles(selector, files, options = {}) {
442
- const converted = await (0, _elementHandle.convertInputFiles)(this._platform, files, this.page().context());
443
- await this._channel.setInputFiles({
444
- selector,
445
- ...converted,
446
- ...options
447
- });
344
+ const converted = await (0, import_elementHandle.convertInputFiles)(this._platform, files, this.page().context());
345
+ await this._channel.setInputFiles({ selector, ...converted, ...options, timeout: this._timeout(options) });
448
346
  }
449
347
  async type(selector, text, options = {}) {
450
- await this._channel.type({
451
- selector,
452
- text,
453
- ...options
454
- });
348
+ await this._channel.type({ selector, text, ...options, timeout: this._timeout(options) });
455
349
  }
456
350
  async press(selector, key, options = {}) {
457
- await this._channel.press({
458
- selector,
459
- key,
460
- ...options
461
- });
351
+ await this._channel.press({ selector, key, ...options, timeout: this._timeout(options) });
462
352
  }
463
353
  async check(selector, options = {}) {
464
- await this._channel.check({
465
- selector,
466
- ...options
467
- });
354
+ await this._channel.check({ selector, ...options, timeout: this._timeout(options) });
468
355
  }
469
356
  async uncheck(selector, options = {}) {
470
- await this._channel.uncheck({
471
- selector,
472
- ...options
473
- });
357
+ await this._channel.uncheck({ selector, ...options, timeout: this._timeout(options) });
474
358
  }
475
359
  async setChecked(selector, checked, options) {
476
- if (checked) await this.check(selector, options);else await this.uncheck(selector, options);
360
+ if (checked)
361
+ await this.check(selector, options);
362
+ else
363
+ await this.uncheck(selector, options);
477
364
  }
478
365
  async waitForTimeout(timeout) {
479
- await this._channel.waitForTimeout({
480
- timeout
481
- });
366
+ await this._channel.waitForTimeout({ waitTimeout: timeout });
482
367
  }
483
368
  async waitForFunction(pageFunction, arg, options = {}) {
484
- if (typeof options.polling === 'string') (0, _assert.assert)(options.polling === 'raf', 'Unknown polling option: ' + options.polling);
369
+ if (typeof options.polling === "string")
370
+ (0, import_assert.assert)(options.polling === "raf", "Unknown polling option: " + options.polling);
485
371
  const result = await this._channel.waitForFunction({
486
372
  ...options,
487
- pollingInterval: options.polling === 'raf' ? undefined : options.polling,
373
+ pollingInterval: options.polling === "raf" ? void 0 : options.polling,
488
374
  expression: String(pageFunction),
489
- isFunction: typeof pageFunction === 'function',
490
- arg: (0, _jsHandle.serializeArgument)(arg)
375
+ isFunction: typeof pageFunction === "function",
376
+ arg: (0, import_jsHandle.serializeArgument)(arg),
377
+ timeout: this._timeout(options)
491
378
  });
492
- return _jsHandle.JSHandle.from(result.handle);
379
+ return import_jsHandle.JSHandle.from(result.handle);
493
380
  }
494
381
  async title() {
495
382
  return (await this._channel.title()).value;
496
383
  }
384
+ async _expect(expression, options) {
385
+ const params = { expression, ...options, isNot: !!options.isNot };
386
+ params.expectedValue = (0, import_jsHandle.serializeArgument)(options.expectedValue);
387
+ const result = await this._channel.expect(params);
388
+ if (result.received !== void 0)
389
+ result.received = (0, import_jsHandle.parseResult)(result.received);
390
+ return result;
391
+ }
497
392
  }
498
- exports.Frame = Frame;
499
393
  function verifyLoadState(name, waitUntil) {
500
- if (waitUntil === 'networkidle0') waitUntil = 'networkidle';
501
- if (!_types.kLifecycleEvents.has(waitUntil)) throw new Error(`${name}: expected one of (load|domcontentloaded|networkidle|commit)`);
394
+ if (waitUntil === "networkidle0")
395
+ waitUntil = "networkidle";
396
+ if (!import_types.kLifecycleEvents.has(waitUntil))
397
+ throw new Error(`${name}: expected one of (load|domcontentloaded|networkidle|commit)`);
502
398
  return waitUntil;
503
- }
399
+ }
400
+ // Annotate the CommonJS export names for ESM import in node:
401
+ 0 && (module.exports = {
402
+ Frame,
403
+ verifyLoadState
404
+ });