rebrowser-playwright-core 1.49.1 → 1.64.1

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 (393) hide show
  1. package/ThirdPartyNotices.txt +7 -1228
  2. package/bin/install_webkit_wsl.ps1 +33 -0
  3. package/bin/reinstall_chrome_beta_linux.sh +1 -1
  4. package/bin/reinstall_chrome_beta_mac.sh +1 -1
  5. package/bin/reinstall_chrome_stable_linux.sh +1 -1
  6. package/bin/reinstall_chrome_stable_mac.sh +1 -1
  7. package/bin/reinstall_msedge_beta_linux.sh +7 -1
  8. package/bin/reinstall_msedge_beta_mac.sh +1 -1
  9. package/bin/reinstall_msedge_dev_linux.sh +7 -1
  10. package/bin/reinstall_msedge_dev_mac.sh +1 -1
  11. package/bin/reinstall_msedge_stable_linux.sh +7 -1
  12. package/bin/reinstall_msedge_stable_mac.sh +1 -1
  13. package/browsers.json +21 -34
  14. package/cli.js +5 -1
  15. package/index.js +2 -18
  16. package/lib/bootstrap.js +149 -0
  17. package/lib/coreBundle.js +78218 -0
  18. package/lib/entry/cliDaemon.js +5 -0
  19. package/lib/entry/dashboardApp.js +3 -0
  20. package/lib/entry/mcp.js +10 -0
  21. package/lib/entry/oopBrowserDownload.js +3 -0
  22. package/lib/package.js +50 -0
  23. package/lib/server/electron/loader.js +109 -43
  24. package/lib/serverRegistry.js +1939 -0
  25. package/lib/serverRegistry.js.LICENSE +65 -0
  26. package/lib/tools/cli-client/channelSessions.js +141 -0
  27. package/lib/tools/cli-client/cli.js +7 -0
  28. package/lib/tools/cli-client/help.json +808 -0
  29. package/lib/tools/cli-client/minimist.js +128 -0
  30. package/lib/tools/cli-client/output.js +352 -0
  31. package/lib/tools/cli-client/program.js +422 -0
  32. package/lib/tools/cli-client/registry.js +180 -0
  33. package/lib/tools/cli-client/session.js +261 -0
  34. package/lib/tools/dashboard/appIcon.png +0 -0
  35. package/lib/tools/skills/playwright-cli/SKILL.md +493 -0
  36. package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  37. package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  38. package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
  39. package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  40. package/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
  41. package/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
  42. package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  43. package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  44. package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  45. package/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
  46. package/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
  47. package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  48. package/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
  49. package/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
  50. package/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
  51. package/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
  52. package/lib/tools/skills/playwright-trace/SKILL.md +174 -0
  53. package/lib/tools/utils/extension.js +112 -0
  54. package/lib/tools/utils/socketConnection.js +108 -0
  55. package/lib/utilsBundle.js +86076 -79
  56. package/lib/utilsBundle.js.LICENSE +1890 -0
  57. package/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
  58. package/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
  59. package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  60. package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  61. package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  62. package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  63. package/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
  64. package/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
  65. package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  66. package/lib/vite/dashboard/index.html +29 -0
  67. package/lib/vite/dashboard/playwright-logo.svg +24 -0
  68. package/lib/vite/htmlReport/index.html +3 -56
  69. package/lib/vite/htmlReport/report.css +2 -0
  70. package/lib/vite/htmlReport/report.js +32 -0
  71. package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  72. package/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
  73. package/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
  74. package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
  75. package/lib/vite/recorder/index.html +3 -3
  76. package/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
  77. package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
  78. package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  79. package/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
  80. package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  81. package/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
  82. package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  83. package/lib/vite/traceViewer/index.html +9 -11
  84. package/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
  85. package/lib/vite/traceViewer/manifest.webmanifest +16 -0
  86. package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  87. package/lib/vite/traceViewer/snapshot.html +4 -15
  88. package/lib/vite/traceViewer/sw.bundle.js +4 -3
  89. package/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
  90. package/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
  91. package/lib/vite/traceViewer/uiMode.html +6 -8
  92. package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  93. package/lib/webp_codec.LICENSE +173 -0
  94. package/lib/webp_codec.wasm +0 -0
  95. package/lib/{utilsBundleImpl/xdg-open → xdg-open} +338 -137
  96. package/package.json +6 -16
  97. package/types/protocol.d.ts +9357 -6200
  98. package/types/structs.d.ts +8 -1
  99. package/types/types.d.ts +9490 -4947
  100. package/bin/PrintDeps.exe +0 -0
  101. package/bin/README.md +0 -2
  102. package/lib/androidServerImpl.js +0 -69
  103. package/lib/browserServerImpl.js +0 -92
  104. package/lib/cli/driver.js +0 -95
  105. package/lib/cli/program.js +0 -607
  106. package/lib/cli/programWithTestStub.js +0 -67
  107. package/lib/client/accessibility.js +0 -50
  108. package/lib/client/android.js +0 -473
  109. package/lib/client/api.js +0 -285
  110. package/lib/client/artifact.js +0 -79
  111. package/lib/client/browser.js +0 -145
  112. package/lib/client/browserContext.js +0 -559
  113. package/lib/client/browserType.js +0 -241
  114. package/lib/client/cdpSession.js +0 -53
  115. package/lib/client/channelOwner.js +0 -235
  116. package/lib/client/clientHelper.js +0 -57
  117. package/lib/client/clientInstrumentation.js +0 -50
  118. package/lib/client/clock.js +0 -68
  119. package/lib/client/connection.js +0 -333
  120. package/lib/client/consoleMessage.js +0 -55
  121. package/lib/client/coverage.js +0 -41
  122. package/lib/client/dialog.js +0 -57
  123. package/lib/client/download.js +0 -62
  124. package/lib/client/electron.js +0 -135
  125. package/lib/client/elementHandle.js +0 -321
  126. package/lib/client/errors.js +0 -77
  127. package/lib/client/eventEmitter.js +0 -314
  128. package/lib/client/events.js +0 -94
  129. package/lib/client/fetch.js +0 -391
  130. package/lib/client/fileChooser.js +0 -45
  131. package/lib/client/frame.js +0 -504
  132. package/lib/client/harRouter.js +0 -99
  133. package/lib/client/input.js +0 -111
  134. package/lib/client/jsHandle.js +0 -121
  135. package/lib/client/jsonPipe.js +0 -35
  136. package/lib/client/localUtils.js +0 -36
  137. package/lib/client/locator.js +0 -448
  138. package/lib/client/network.js +0 -767
  139. package/lib/client/page.js +0 -748
  140. package/lib/client/playwright.js +0 -80
  141. package/lib/client/selectors.js +0 -67
  142. package/lib/client/stream.js +0 -54
  143. package/lib/client/tracing.js +0 -147
  144. package/lib/client/types.js +0 -24
  145. package/lib/client/video.js +0 -51
  146. package/lib/client/waiter.js +0 -162
  147. package/lib/client/webError.js +0 -37
  148. package/lib/client/worker.js +0 -71
  149. package/lib/client/writableStream.js +0 -54
  150. package/lib/common/socksProxy.js +0 -569
  151. package/lib/common/timeoutSettings.js +0 -73
  152. package/lib/common/types.js +0 -5
  153. package/lib/generated/clockSource.js +0 -7
  154. package/lib/generated/consoleApiSource.js +0 -7
  155. package/lib/generated/injectedScriptSource.js +0 -7
  156. package/lib/generated/pollingRecorderSource.js +0 -7
  157. package/lib/generated/utilityScriptSource.js +0 -7
  158. package/lib/generated/webSocketMockSource.js +0 -7
  159. package/lib/image_tools/colorUtils.js +0 -98
  160. package/lib/image_tools/compare.js +0 -108
  161. package/lib/image_tools/imageChannel.js +0 -70
  162. package/lib/image_tools/stats.js +0 -102
  163. package/lib/inProcessFactory.js +0 -54
  164. package/lib/inprocess.js +0 -20
  165. package/lib/outofprocess.js +0 -67
  166. package/lib/protocol/debug.js +0 -27
  167. package/lib/protocol/serializers.js +0 -173
  168. package/lib/protocol/transport.js +0 -82
  169. package/lib/protocol/validator.js +0 -2780
  170. package/lib/protocol/validatorPrimitives.js +0 -139
  171. package/lib/remote/playwrightConnection.js +0 -274
  172. package/lib/remote/playwrightServer.js +0 -110
  173. package/lib/server/accessibility.js +0 -62
  174. package/lib/server/android/android.js +0 -441
  175. package/lib/server/android/backendAdb.js +0 -172
  176. package/lib/server/ariaSnapshot.js +0 -33
  177. package/lib/server/artifact.js +0 -104
  178. package/lib/server/bidi/bidiBrowser.js +0 -311
  179. package/lib/server/bidi/bidiChromium.js +0 -124
  180. package/lib/server/bidi/bidiConnection.js +0 -204
  181. package/lib/server/bidi/bidiExecutionContext.js +0 -156
  182. package/lib/server/bidi/bidiFirefox.js +0 -104
  183. package/lib/server/bidi/bidiInput.js +0 -158
  184. package/lib/server/bidi/bidiNetworkManager.js +0 -338
  185. package/lib/server/bidi/bidiOverCdp.js +0 -103
  186. package/lib/server/bidi/bidiPage.js +0 -529
  187. package/lib/server/bidi/bidiPdf.js +0 -140
  188. package/lib/server/bidi/third_party/bidiDeserializer.js +0 -93
  189. package/lib/server/bidi/third_party/bidiKeyboard.js +0 -238
  190. package/lib/server/bidi/third_party/bidiProtocol.js +0 -139
  191. package/lib/server/bidi/third_party/bidiSerializer.js +0 -144
  192. package/lib/server/bidi/third_party/firefoxPrefs.js +0 -221
  193. package/lib/server/browser.js +0 -148
  194. package/lib/server/browserContext.js +0 -667
  195. package/lib/server/browserType.js +0 -338
  196. package/lib/server/chromium/chromium.js +0 -354
  197. package/lib/server/chromium/chromiumSwitches.js +0 -46
  198. package/lib/server/chromium/crAccessibility.js +0 -237
  199. package/lib/server/chromium/crBrowser.js +0 -516
  200. package/lib/server/chromium/crConnection.js +0 -381
  201. package/lib/server/chromium/crCoverage.js +0 -246
  202. package/lib/server/chromium/crDevTools.js +0 -108
  203. package/lib/server/chromium/crDragDrop.js +0 -143
  204. package/lib/server/chromium/crExecutionContext.js +0 -136
  205. package/lib/server/chromium/crInput.js +0 -171
  206. package/lib/server/chromium/crNetworkManager.js +0 -767
  207. package/lib/server/chromium/crPage.js +0 -1143
  208. package/lib/server/chromium/crPdf.js +0 -153
  209. package/lib/server/chromium/crProtocolHelper.js +0 -133
  210. package/lib/server/chromium/crServiceWorker.js +0 -114
  211. package/lib/server/chromium/defaultFontFamilies.js +0 -145
  212. package/lib/server/chromium/videoRecorder.js +0 -155
  213. package/lib/server/clock.js +0 -125
  214. package/lib/server/codegen/csharp.js +0 -294
  215. package/lib/server/codegen/java.js +0 -232
  216. package/lib/server/codegen/javascript.js +0 -245
  217. package/lib/server/codegen/jsonl.js +0 -47
  218. package/lib/server/codegen/language.js +0 -88
  219. package/lib/server/codegen/languages.js +0 -30
  220. package/lib/server/codegen/python.js +0 -261
  221. package/lib/server/codegen/types.js +0 -5
  222. package/lib/server/console.js +0 -57
  223. package/lib/server/cookieStore.js +0 -185
  224. package/lib/server/debugController.js +0 -237
  225. package/lib/server/debugger.js +0 -132
  226. package/lib/server/deviceDescriptors.js +0 -26
  227. package/lib/server/deviceDescriptorsSource.json +0 -1669
  228. package/lib/server/dialog.js +0 -71
  229. package/lib/server/dispatchers/androidDispatcher.js +0 -204
  230. package/lib/server/dispatchers/artifactDispatcher.js +0 -118
  231. package/lib/server/dispatchers/browserContextDispatcher.js +0 -368
  232. package/lib/server/dispatchers/browserDispatcher.js +0 -170
  233. package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
  234. package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -48
  235. package/lib/server/dispatchers/debugControllerDispatcher.js +0 -103
  236. package/lib/server/dispatchers/dialogDispatcher.js +0 -44
  237. package/lib/server/dispatchers/dispatcher.js +0 -395
  238. package/lib/server/dispatchers/electronDispatcher.js +0 -93
  239. package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -228
  240. package/lib/server/dispatchers/frameDispatcher.js +0 -293
  241. package/lib/server/dispatchers/jsHandleDispatcher.js +0 -97
  242. package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -59
  243. package/lib/server/dispatchers/localUtilsDispatcher.js +0 -413
  244. package/lib/server/dispatchers/networkDispatchers.js +0 -221
  245. package/lib/server/dispatchers/pageDispatcher.js +0 -367
  246. package/lib/server/dispatchers/playwrightDispatcher.js +0 -107
  247. package/lib/server/dispatchers/selectorsDispatcher.js +0 -36
  248. package/lib/server/dispatchers/streamDispatcher.js +0 -62
  249. package/lib/server/dispatchers/tracingDispatcher.js +0 -64
  250. package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -189
  251. package/lib/server/dispatchers/writableStreamDispatcher.js +0 -58
  252. package/lib/server/dom.js +0 -888
  253. package/lib/server/download.js +0 -60
  254. package/lib/server/electron/electron.js +0 -296
  255. package/lib/server/errors.js +0 -68
  256. package/lib/server/fetch.js +0 -669
  257. package/lib/server/fileChooser.js +0 -42
  258. package/lib/server/fileUploadUtils.js +0 -75
  259. package/lib/server/firefox/ffAccessibility.js +0 -216
  260. package/lib/server/firefox/ffBrowser.js +0 -460
  261. package/lib/server/firefox/ffConnection.js +0 -168
  262. package/lib/server/firefox/ffExecutionContext.js +0 -123
  263. package/lib/server/firefox/ffInput.js +0 -150
  264. package/lib/server/firefox/ffNetworkManager.js +0 -233
  265. package/lib/server/firefox/ffPage.js +0 -559
  266. package/lib/server/firefox/firefox.js +0 -99
  267. package/lib/server/formData.js +0 -75
  268. package/lib/server/frameSelectors.js +0 -171
  269. package/lib/server/frames.js +0 -1691
  270. package/lib/server/har/harRecorder.js +0 -139
  271. package/lib/server/har/harTracer.js +0 -542
  272. package/lib/server/helper.js +0 -103
  273. package/lib/server/index.js +0 -108
  274. package/lib/server/input.js +0 -310
  275. package/lib/server/instrumentation.js +0 -70
  276. package/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
  277. package/lib/server/javascript.js +0 -293
  278. package/lib/server/launchApp.js +0 -91
  279. package/lib/server/macEditingCommands.js +0 -139
  280. package/lib/server/network.js +0 -617
  281. package/lib/server/page.js +0 -873
  282. package/lib/server/pipeTransport.js +0 -85
  283. package/lib/server/playwright.js +0 -88
  284. package/lib/server/progress.js +0 -99
  285. package/lib/server/protocolError.js +0 -49
  286. package/lib/server/recorder/contextRecorder.js +0 -299
  287. package/lib/server/recorder/recorderApp.js +0 -187
  288. package/lib/server/recorder/recorderCollection.js +0 -116
  289. package/lib/server/recorder/recorderFrontend.js +0 -5
  290. package/lib/server/recorder/recorderInTraceViewer.js +0 -144
  291. package/lib/server/recorder/recorderRunner.js +0 -155
  292. package/lib/server/recorder/recorderUtils.js +0 -113
  293. package/lib/server/recorder/throttledFile.js +0 -46
  294. package/lib/server/recorder.js +0 -364
  295. package/lib/server/registry/browserFetcher.js +0 -168
  296. package/lib/server/registry/dependencies.js +0 -322
  297. package/lib/server/registry/index.js +0 -1052
  298. package/lib/server/registry/nativeDeps.js +0 -493
  299. package/lib/server/registry/oopDownloadBrowserMain.js +0 -138
  300. package/lib/server/screenshotter.js +0 -348
  301. package/lib/server/selectors.js +0 -73
  302. package/lib/server/socksClientCertificatesInterceptor.js +0 -340
  303. package/lib/server/socksInterceptor.js +0 -100
  304. package/lib/server/trace/recorder/snapshotter.js +0 -161
  305. package/lib/server/trace/recorder/snapshotterInjected.js +0 -511
  306. package/lib/server/trace/recorder/tracing.js +0 -596
  307. package/lib/server/trace/test/inMemorySnapshotter.js +0 -93
  308. package/lib/server/trace/viewer/traceViewer.js +0 -214
  309. package/lib/server/transport.js +0 -191
  310. package/lib/server/types.js +0 -24
  311. package/lib/server/usKeyboardLayout.js +0 -555
  312. package/lib/server/webkit/webkit.js +0 -87
  313. package/lib/server/webkit/wkAccessibility.js +0 -194
  314. package/lib/server/webkit/wkBrowser.js +0 -329
  315. package/lib/server/webkit/wkConnection.js +0 -173
  316. package/lib/server/webkit/wkExecutionContext.js +0 -130
  317. package/lib/server/webkit/wkInput.js +0 -169
  318. package/lib/server/webkit/wkInterceptableRequest.js +0 -162
  319. package/lib/server/webkit/wkPage.js +0 -1225
  320. package/lib/server/webkit/wkProvisionalPage.js +0 -94
  321. package/lib/server/webkit/wkWorkers.js +0 -104
  322. package/lib/third_party/pixelmatch.js +0 -255
  323. package/lib/utils/ascii.js +0 -31
  324. package/lib/utils/comparators.js +0 -153
  325. package/lib/utils/crypto.js +0 -171
  326. package/lib/utils/debug.js +0 -46
  327. package/lib/utils/debugLogger.js +0 -91
  328. package/lib/utils/env.js +0 -49
  329. package/lib/utils/eventsHelper.js +0 -38
  330. package/lib/utils/expectUtils.js +0 -33
  331. package/lib/utils/fileUtils.js +0 -205
  332. package/lib/utils/happy-eyeballs.js +0 -194
  333. package/lib/utils/headers.js +0 -52
  334. package/lib/utils/hostPlatform.js +0 -139
  335. package/lib/utils/httpServer.js +0 -237
  336. package/lib/utils/index.js +0 -368
  337. package/lib/utils/isomorphic/ariaSnapshot.js +0 -267
  338. package/lib/utils/isomorphic/cssParser.js +0 -250
  339. package/lib/utils/isomorphic/cssTokenizer.js +0 -979
  340. package/lib/utils/isomorphic/locatorGenerators.js +0 -660
  341. package/lib/utils/isomorphic/locatorParser.js +0 -179
  342. package/lib/utils/isomorphic/locatorUtils.js +0 -62
  343. package/lib/utils/isomorphic/mimeType.js +0 -29
  344. package/lib/utils/isomorphic/recorderUtils.js +0 -227
  345. package/lib/utils/isomorphic/selectorParser.js +0 -397
  346. package/lib/utils/isomorphic/stringUtils.js +0 -169
  347. package/lib/utils/isomorphic/traceUtils.js +0 -39
  348. package/lib/utils/isomorphic/urlMatch.js +0 -124
  349. package/lib/utils/linuxUtils.js +0 -78
  350. package/lib/utils/manualPromise.js +0 -109
  351. package/lib/utils/multimap.js +0 -75
  352. package/lib/utils/network.js +0 -160
  353. package/lib/utils/processLauncher.js +0 -248
  354. package/lib/utils/profiler.js +0 -53
  355. package/lib/utils/rtti.js +0 -44
  356. package/lib/utils/semaphore.js +0 -51
  357. package/lib/utils/sequence.js +0 -64
  358. package/lib/utils/spawnAsync.js +0 -45
  359. package/lib/utils/stackTrace.js +0 -134
  360. package/lib/utils/task.js +0 -58
  361. package/lib/utils/time.js +0 -37
  362. package/lib/utils/timeoutRunner.js +0 -66
  363. package/lib/utils/traceUtils.js +0 -44
  364. package/lib/utils/userAgent.js +0 -105
  365. package/lib/utils/wsServer.js +0 -127
  366. package/lib/utils/zipFile.js +0 -75
  367. package/lib/utils/zones.js +0 -71
  368. package/lib/utilsBundleImpl/index.js +0 -210
  369. package/lib/vite/recorder/assets/codeMirrorModule-C5j27SYZ.js +0 -24
  370. package/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +0 -1
  371. package/lib/vite/recorder/assets/index-iA1aAGZg.css +0 -1
  372. package/lib/vite/recorder/assets/index-m0XdVJHe.js +0 -184
  373. package/lib/vite/traceViewer/assets/codeMirrorModule-BBCX0spr.js +0 -24
  374. package/lib/vite/traceViewer/assets/inspectorTab-B4Iw34Ow.js +0 -68
  375. package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
  376. package/lib/vite/traceViewer/assets/workbench-DFlGYqou.js +0 -9
  377. package/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +0 -9
  378. package/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +0 -1
  379. package/lib/vite/traceViewer/embedded.CmarehFk.js +0 -2
  380. package/lib/vite/traceViewer/embedded.html +0 -18
  381. package/lib/vite/traceViewer/embedded.w7WN2u1R.css +0 -1
  382. package/lib/vite/traceViewer/index.CrbWWHbf.css +0 -1
  383. package/lib/vite/traceViewer/index.FBucu_gE.js +0 -2
  384. package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +0 -1
  385. package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
  386. package/lib/vite/traceViewer/recorder.CW_rzcEp.js +0 -2
  387. package/lib/vite/traceViewer/recorder.html +0 -17
  388. package/lib/vite/traceViewer/uiMode.CDUVjusr.js +0 -5
  389. package/lib/vite/traceViewer/uiMode.voC1ZiOQ.css +0 -1
  390. package/lib/vite/traceViewer/workbench.C-zR9ysA.css +0 -1
  391. package/lib/vite/traceViewer/xtermModule.DSXBckUd.css +0 -32
  392. package/lib/zipBundle.js +0 -25
  393. package/lib/zipBundleImpl.js +0 -5
@@ -1,748 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Page = exports.BindingCall = void 0;
7
- var _fs = _interopRequireDefault(require("fs"));
8
- var _path = _interopRequireDefault(require("path"));
9
- var _errors = require("./errors");
10
- var _timeoutSettings = require("../common/timeoutSettings");
11
- var _utils = require("../utils");
12
- var _accessibility = require("./accessibility");
13
- var _artifact = require("./artifact");
14
- var _channelOwner = require("./channelOwner");
15
- var _clientHelper = require("./clientHelper");
16
- var _coverage = require("./coverage");
17
- var _download = require("./download");
18
- var _elementHandle = require("./elementHandle");
19
- var _events = require("./events");
20
- var _fileChooser = require("./fileChooser");
21
- var _frame = require("./frame");
22
- var _input = require("./input");
23
- var _jsHandle = require("./jsHandle");
24
- var _network = require("./network");
25
- var _video = require("./video");
26
- var _waiter = require("./waiter");
27
- var _worker = require("./worker");
28
- var _harRouter = require("./harRouter");
29
- let _Symbol$asyncDispose;
30
- /**
31
- * Copyright 2017 Google Inc. All rights reserved.
32
- * Modifications copyright (c) Microsoft Corporation.
33
- *
34
- * Licensed under the Apache License, Version 2.0 (the "License");
35
- * you may not use this file except in compliance with the License.
36
- * You may obtain a copy of the License at
37
- *
38
- * http://www.apache.org/licenses/LICENSE-2.0
39
- *
40
- * Unless required by applicable law or agreed to in writing, software
41
- * distributed under the License is distributed on an "AS IS" BASIS,
42
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43
- * See the License for the specific language governing permissions and
44
- * limitations under the License.
45
- */
46
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
- _Symbol$asyncDispose = Symbol.asyncDispose;
48
- class Page extends _channelOwner.ChannelOwner {
49
- static from(page) {
50
- return page._object;
51
- }
52
- static fromNullable(page) {
53
- return page ? Page.from(page) : null;
54
- }
55
- constructor(parent, type, guid, initializer) {
56
- super(parent, type, guid, initializer);
57
- this._browserContext = void 0;
58
- this._ownedContext = void 0;
59
- this._mainFrame = void 0;
60
- this._frames = new Set();
61
- this._workers = new Set();
62
- this._closed = false;
63
- this._closedOrCrashedScope = new _utils.LongStandingScope();
64
- this._viewportSize = void 0;
65
- this._routes = [];
66
- this._webSocketRoutes = [];
67
- this.accessibility = void 0;
68
- this.coverage = void 0;
69
- this.keyboard = void 0;
70
- this.mouse = void 0;
71
- this.request = void 0;
72
- this.touchscreen = void 0;
73
- this.clock = void 0;
74
- this._bindings = new Map();
75
- this._timeoutSettings = void 0;
76
- this._video = null;
77
- this._opener = void 0;
78
- this._closeReason = void 0;
79
- this._closeWasCalled = false;
80
- this._harRouters = [];
81
- this._locatorHandlers = new Map();
82
- this._browserContext = parent;
83
- this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._browserContext._timeoutSettings);
84
- this.accessibility = new _accessibility.Accessibility(this._channel);
85
- this.keyboard = new _input.Keyboard(this);
86
- this.mouse = new _input.Mouse(this);
87
- this.request = this._browserContext.request;
88
- this.touchscreen = new _input.Touchscreen(this);
89
- this.clock = this._browserContext.clock;
90
- this._mainFrame = _frame.Frame.from(initializer.mainFrame);
91
- this._mainFrame._page = this;
92
- this._frames.add(this._mainFrame);
93
- this._viewportSize = initializer.viewportSize || null;
94
- this._closed = initializer.isClosed;
95
- this._opener = Page.fromNullable(initializer.opener);
96
- this._channel.on('bindingCall', ({
97
- binding
98
- }) => this._onBinding(BindingCall.from(binding)));
99
- this._channel.on('close', () => this._onClose());
100
- this._channel.on('crash', () => this._onCrash());
101
- this._channel.on('download', ({
102
- url,
103
- suggestedFilename,
104
- artifact
105
- }) => {
106
- const artifactObject = _artifact.Artifact.from(artifact);
107
- this.emit(_events.Events.Page.Download, new _download.Download(this, url, suggestedFilename, artifactObject));
108
- });
109
- this._channel.on('fileChooser', ({
110
- element,
111
- isMultiple
112
- }) => this.emit(_events.Events.Page.FileChooser, new _fileChooser.FileChooser(this, _elementHandle.ElementHandle.from(element), isMultiple)));
113
- this._channel.on('frameAttached', ({
114
- frame
115
- }) => this._onFrameAttached(_frame.Frame.from(frame)));
116
- this._channel.on('frameDetached', ({
117
- frame
118
- }) => this._onFrameDetached(_frame.Frame.from(frame)));
119
- this._channel.on('locatorHandlerTriggered', ({
120
- uid
121
- }) => this._onLocatorHandlerTriggered(uid));
122
- this._channel.on('route', ({
123
- route
124
- }) => this._onRoute(_network.Route.from(route)));
125
- this._channel.on('webSocketRoute', ({
126
- webSocketRoute
127
- }) => this._onWebSocketRoute(_network.WebSocketRoute.from(webSocketRoute)));
128
- this._channel.on('video', ({
129
- artifact
130
- }) => {
131
- const artifactObject = _artifact.Artifact.from(artifact);
132
- this._forceVideo()._artifactReady(artifactObject);
133
- });
134
- this._channel.on('webSocket', ({
135
- webSocket
136
- }) => this.emit(_events.Events.Page.WebSocket, _network.WebSocket.from(webSocket)));
137
- this._channel.on('worker', ({
138
- worker
139
- }) => this._onWorker(_worker.Worker.from(worker)));
140
- this.coverage = new _coverage.Coverage(this._channel);
141
- this.once(_events.Events.Page.Close, () => this._closedOrCrashedScope.close(this._closeErrorWithReason()));
142
- this.once(_events.Events.Page.Crash, () => this._closedOrCrashedScope.close(new _errors.TargetClosedError()));
143
- this._setEventToSubscriptionMapping(new Map([[_events.Events.Page.Console, 'console'], [_events.Events.Page.Dialog, 'dialog'], [_events.Events.Page.Request, 'request'], [_events.Events.Page.Response, 'response'], [_events.Events.Page.RequestFinished, 'requestFinished'], [_events.Events.Page.RequestFailed, 'requestFailed'], [_events.Events.Page.FileChooser, 'fileChooser']]));
144
- }
145
- _onFrameAttached(frame) {
146
- frame._page = this;
147
- this._frames.add(frame);
148
- if (frame._parentFrame) frame._parentFrame._childFrames.add(frame);
149
- this.emit(_events.Events.Page.FrameAttached, frame);
150
- }
151
- _onFrameDetached(frame) {
152
- this._frames.delete(frame);
153
- frame._detached = true;
154
- if (frame._parentFrame) frame._parentFrame._childFrames.delete(frame);
155
- this.emit(_events.Events.Page.FrameDetached, frame);
156
- }
157
- async _onRoute(route) {
158
- route._context = this.context();
159
- const routeHandlers = this._routes.slice();
160
- for (const routeHandler of routeHandlers) {
161
- // If the page was closed we stall all requests right away.
162
- if (this._closeWasCalled || this._browserContext._closeWasCalled) return;
163
- if (!routeHandler.matches(route.request().url())) continue;
164
- const index = this._routes.indexOf(routeHandler);
165
- if (index === -1) continue;
166
- if (routeHandler.willExpire()) this._routes.splice(index, 1);
167
- const handled = await routeHandler.handle(route);
168
- if (!this._routes.length) this._wrapApiCall(() => this._updateInterceptionPatterns(), true).catch(() => {});
169
- if (handled) return;
170
- }
171
- await this._browserContext._onRoute(route);
172
- }
173
- async _onWebSocketRoute(webSocketRoute) {
174
- const routeHandler = this._webSocketRoutes.find(route => route.matches(webSocketRoute.url()));
175
- if (routeHandler) await routeHandler.handle(webSocketRoute);else await this._browserContext._onWebSocketRoute(webSocketRoute);
176
- }
177
- async _onBinding(bindingCall) {
178
- const func = this._bindings.get(bindingCall._initializer.name);
179
- if (func) {
180
- await bindingCall.call(func);
181
- return;
182
- }
183
- await this._browserContext._onBinding(bindingCall);
184
- }
185
- _onWorker(worker) {
186
- this._workers.add(worker);
187
- worker._page = this;
188
- this.emit(_events.Events.Page.Worker, worker);
189
- }
190
- _onClose() {
191
- this._closed = true;
192
- this._browserContext._pages.delete(this);
193
- this._browserContext._backgroundPages.delete(this);
194
- this._disposeHarRouters();
195
- this.emit(_events.Events.Page.Close, this);
196
- }
197
- _onCrash() {
198
- this.emit(_events.Events.Page.Crash, this);
199
- }
200
- context() {
201
- return this._browserContext;
202
- }
203
- async opener() {
204
- if (!this._opener || this._opener.isClosed()) return null;
205
- return this._opener;
206
- }
207
- mainFrame() {
208
- return this._mainFrame;
209
- }
210
- frame(frameSelector) {
211
- const name = (0, _utils.isString)(frameSelector) ? frameSelector : frameSelector.name;
212
- const url = (0, _utils.isObject)(frameSelector) ? frameSelector.url : undefined;
213
- (0, _utils.assert)(name || url, 'Either name or url matcher should be specified');
214
- return this.frames().find(f => {
215
- if (name) return f.name() === name;
216
- return (0, _utils.urlMatches)(this._browserContext._options.baseURL, f.url(), url);
217
- }) || null;
218
- }
219
- frames() {
220
- return [...this._frames];
221
- }
222
- setDefaultNavigationTimeout(timeout) {
223
- this._timeoutSettings.setDefaultNavigationTimeout(timeout);
224
- this._wrapApiCall(async () => {
225
- this._channel.setDefaultNavigationTimeoutNoReply({
226
- timeout
227
- }).catch(() => {});
228
- }, true);
229
- }
230
- setDefaultTimeout(timeout) {
231
- this._timeoutSettings.setDefaultTimeout(timeout);
232
- this._wrapApiCall(async () => {
233
- this._channel.setDefaultTimeoutNoReply({
234
- timeout
235
- }).catch(() => {});
236
- }, true);
237
- }
238
- _forceVideo() {
239
- if (!this._video) this._video = new _video.Video(this, this._connection);
240
- return this._video;
241
- }
242
- video() {
243
- // Note: we are creating Video object lazily, because we do not know
244
- // BrowserContextOptions when constructing the page - it is assigned
245
- // too late during launchPersistentContext.
246
- if (!this._browserContext._options.recordVideo) return null;
247
- return this._forceVideo();
248
- }
249
- async $(selector, options) {
250
- return await this._mainFrame.$(selector, options);
251
- }
252
- async waitForSelector(selector, options) {
253
- return await this._mainFrame.waitForSelector(selector, options);
254
- }
255
- async dispatchEvent(selector, type, eventInit, options) {
256
- return await this._mainFrame.dispatchEvent(selector, type, eventInit, options);
257
- }
258
- async evaluateHandle(pageFunction, arg) {
259
- (0, _jsHandle.assertMaxArguments)(arguments.length, 2);
260
- return await this._mainFrame.evaluateHandle(pageFunction, arg);
261
- }
262
- async $eval(selector, pageFunction, arg) {
263
- (0, _jsHandle.assertMaxArguments)(arguments.length, 3);
264
- return await this._mainFrame.$eval(selector, pageFunction, arg);
265
- }
266
- async $$eval(selector, pageFunction, arg) {
267
- (0, _jsHandle.assertMaxArguments)(arguments.length, 3);
268
- return await this._mainFrame.$$eval(selector, pageFunction, arg);
269
- }
270
- async $$(selector) {
271
- return await this._mainFrame.$$(selector);
272
- }
273
- async addScriptTag(options = {}) {
274
- return await this._mainFrame.addScriptTag(options);
275
- }
276
- async addStyleTag(options = {}) {
277
- return await this._mainFrame.addStyleTag(options);
278
- }
279
- async exposeFunction(name, callback) {
280
- await this._channel.exposeBinding({
281
- name
282
- });
283
- const binding = (source, ...args) => callback(...args);
284
- this._bindings.set(name, binding);
285
- }
286
- async exposeBinding(name, callback, options = {}) {
287
- await this._channel.exposeBinding({
288
- name,
289
- needsHandle: options.handle
290
- });
291
- this._bindings.set(name, callback);
292
- }
293
- async setExtraHTTPHeaders(headers) {
294
- (0, _network.validateHeaders)(headers);
295
- await this._channel.setExtraHTTPHeaders({
296
- headers: (0, _utils.headersObjectToArray)(headers)
297
- });
298
- }
299
- url() {
300
- return this._mainFrame.url();
301
- }
302
- async content() {
303
- return await this._mainFrame.content();
304
- }
305
- async setContent(html, options) {
306
- return await this._mainFrame.setContent(html, options);
307
- }
308
- async goto(url, options) {
309
- return await this._mainFrame.goto(url, options);
310
- }
311
- async reload(options = {}) {
312
- const waitUntil = (0, _frame.verifyLoadState)('waitUntil', options.waitUntil === undefined ? 'load' : options.waitUntil);
313
- return _network.Response.fromNullable((await this._channel.reload({
314
- ...options,
315
- waitUntil
316
- })).response);
317
- }
318
- async addLocatorHandler(locator, handler, options = {}) {
319
- if (locator._frame !== this._mainFrame) throw new Error(`Locator must belong to the main frame of this page`);
320
- if (options.times === 0) return;
321
- const {
322
- uid
323
- } = await this._channel.registerLocatorHandler({
324
- selector: locator._selector,
325
- noWaitAfter: options.noWaitAfter
326
- });
327
- this._locatorHandlers.set(uid, {
328
- locator,
329
- handler,
330
- times: options.times
331
- });
332
- }
333
- async _onLocatorHandlerTriggered(uid) {
334
- let remove = false;
335
- try {
336
- const handler = this._locatorHandlers.get(uid);
337
- if (handler && handler.times !== 0) {
338
- if (handler.times !== undefined) handler.times--;
339
- await handler.handler(handler.locator);
340
- }
341
- remove = (handler === null || handler === void 0 ? void 0 : handler.times) === 0;
342
- } finally {
343
- if (remove) this._locatorHandlers.delete(uid);
344
- this._wrapApiCall(() => this._channel.resolveLocatorHandlerNoReply({
345
- uid,
346
- remove
347
- }), true).catch(() => {});
348
- }
349
- }
350
- async removeLocatorHandler(locator) {
351
- for (const [uid, data] of this._locatorHandlers) {
352
- if (data.locator._equals(locator)) {
353
- this._locatorHandlers.delete(uid);
354
- await this._channel.unregisterLocatorHandler({
355
- uid
356
- }).catch(() => {});
357
- }
358
- }
359
- }
360
- async waitForLoadState(state, options) {
361
- return await this._mainFrame.waitForLoadState(state, options);
362
- }
363
- async waitForNavigation(options) {
364
- return await this._mainFrame.waitForNavigation(options);
365
- }
366
- async waitForURL(url, options) {
367
- return await this._mainFrame.waitForURL(url, options);
368
- }
369
- async waitForRequest(urlOrPredicate, options = {}) {
370
- const predicate = async request => {
371
- if ((0, _utils.isString)(urlOrPredicate) || (0, _utils.isRegExp)(urlOrPredicate)) return (0, _utils.urlMatches)(this._browserContext._options.baseURL, request.url(), urlOrPredicate);
372
- return await urlOrPredicate(request);
373
- };
374
- const trimmedUrl = trimUrl(urlOrPredicate);
375
- const logLine = trimmedUrl ? `waiting for request ${trimmedUrl}` : undefined;
376
- return await this._waitForEvent(_events.Events.Page.Request, {
377
- predicate,
378
- timeout: options.timeout
379
- }, logLine);
380
- }
381
- async waitForResponse(urlOrPredicate, options = {}) {
382
- const predicate = async response => {
383
- if ((0, _utils.isString)(urlOrPredicate) || (0, _utils.isRegExp)(urlOrPredicate)) return (0, _utils.urlMatches)(this._browserContext._options.baseURL, response.url(), urlOrPredicate);
384
- return await urlOrPredicate(response);
385
- };
386
- const trimmedUrl = trimUrl(urlOrPredicate);
387
- const logLine = trimmedUrl ? `waiting for response ${trimmedUrl}` : undefined;
388
- return await this._waitForEvent(_events.Events.Page.Response, {
389
- predicate,
390
- timeout: options.timeout
391
- }, logLine);
392
- }
393
- async waitForEvent(event, optionsOrPredicate = {}) {
394
- return await this._waitForEvent(event, optionsOrPredicate, `waiting for event "${event}"`);
395
- }
396
- _closeErrorWithReason() {
397
- return new _errors.TargetClosedError(this._closeReason || this._browserContext._effectiveCloseReason());
398
- }
399
- async _waitForEvent(event, optionsOrPredicate, logLine) {
400
- return await this._wrapApiCall(async () => {
401
- const timeout = this._timeoutSettings.timeout(typeof optionsOrPredicate === 'function' ? {} : optionsOrPredicate);
402
- const predicate = typeof optionsOrPredicate === 'function' ? optionsOrPredicate : optionsOrPredicate.predicate;
403
- const waiter = _waiter.Waiter.createForEvent(this, event);
404
- if (logLine) waiter.log(logLine);
405
- waiter.rejectOnTimeout(timeout, `Timeout ${timeout}ms exceeded while waiting for event "${event}"`);
406
- if (event !== _events.Events.Page.Crash) waiter.rejectOnEvent(this, _events.Events.Page.Crash, new Error('Page crashed'));
407
- if (event !== _events.Events.Page.Close) waiter.rejectOnEvent(this, _events.Events.Page.Close, () => this._closeErrorWithReason());
408
- const result = await waiter.waitForEvent(this, event, predicate);
409
- waiter.dispose();
410
- return result;
411
- });
412
- }
413
- async goBack(options = {}) {
414
- const waitUntil = (0, _frame.verifyLoadState)('waitUntil', options.waitUntil === undefined ? 'load' : options.waitUntil);
415
- return _network.Response.fromNullable((await this._channel.goBack({
416
- ...options,
417
- waitUntil
418
- })).response);
419
- }
420
- async goForward(options = {}) {
421
- const waitUntil = (0, _frame.verifyLoadState)('waitUntil', options.waitUntil === undefined ? 'load' : options.waitUntil);
422
- return _network.Response.fromNullable((await this._channel.goForward({
423
- ...options,
424
- waitUntil
425
- })).response);
426
- }
427
- async requestGC() {
428
- await this._channel.requestGC();
429
- }
430
- async emulateMedia(options = {}) {
431
- await this._channel.emulateMedia({
432
- media: options.media === null ? 'no-override' : options.media,
433
- colorScheme: options.colorScheme === null ? 'no-override' : options.colorScheme,
434
- reducedMotion: options.reducedMotion === null ? 'no-override' : options.reducedMotion,
435
- forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors
436
- });
437
- }
438
- async setViewportSize(viewportSize) {
439
- this._viewportSize = viewportSize;
440
- await this._channel.setViewportSize({
441
- viewportSize
442
- });
443
- }
444
- viewportSize() {
445
- return this._viewportSize;
446
- }
447
- async evaluate(pageFunction, arg) {
448
- (0, _jsHandle.assertMaxArguments)(arguments.length, 2);
449
- return await this._mainFrame.evaluate(pageFunction, arg);
450
- }
451
- async addInitScript(script, arg) {
452
- const source = await (0, _clientHelper.evaluationScript)(script, arg);
453
- await this._channel.addInitScript({
454
- source
455
- });
456
- }
457
- async route(url, handler, options = {}) {
458
- this._routes.unshift(new _network.RouteHandler(this._browserContext._options.baseURL, url, handler, options.times));
459
- await this._updateInterceptionPatterns();
460
- }
461
- async routeFromHAR(har, options = {}) {
462
- if (options.update) {
463
- await this._browserContext._recordIntoHAR(har, this, options);
464
- return;
465
- }
466
- const harRouter = await _harRouter.HarRouter.create(this._connection.localUtils(), har, options.notFound || 'abort', {
467
- urlMatch: options.url
468
- });
469
- this._harRouters.push(harRouter);
470
- await harRouter.addPageRoute(this);
471
- }
472
- async routeWebSocket(url, handler) {
473
- this._webSocketRoutes.unshift(new _network.WebSocketRouteHandler(this._browserContext._options.baseURL, url, handler));
474
- await this._updateWebSocketInterceptionPatterns();
475
- }
476
- _disposeHarRouters() {
477
- this._harRouters.forEach(router => router.dispose());
478
- this._harRouters = [];
479
- }
480
- async unrouteAll(options) {
481
- await this._unrouteInternal(this._routes, [], options === null || options === void 0 ? void 0 : options.behavior);
482
- this._disposeHarRouters();
483
- }
484
- async unroute(url, handler) {
485
- const removed = [];
486
- const remaining = [];
487
- for (const route of this._routes) {
488
- if ((0, _utils.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
489
- }
490
- await this._unrouteInternal(removed, remaining, 'default');
491
- }
492
- async _unrouteInternal(removed, remaining, behavior) {
493
- this._routes = remaining;
494
- await this._updateInterceptionPatterns();
495
- if (!behavior || behavior === 'default') return;
496
- const promises = removed.map(routeHandler => routeHandler.stop(behavior));
497
- await Promise.all(promises);
498
- }
499
- async _updateInterceptionPatterns() {
500
- const patterns = _network.RouteHandler.prepareInterceptionPatterns(this._routes);
501
- await this._channel.setNetworkInterceptionPatterns({
502
- patterns
503
- });
504
- }
505
- async _updateWebSocketInterceptionPatterns() {
506
- const patterns = _network.WebSocketRouteHandler.prepareInterceptionPatterns(this._webSocketRoutes);
507
- await this._channel.setWebSocketInterceptionPatterns({
508
- patterns
509
- });
510
- }
511
- async screenshot(options = {}) {
512
- const copy = {
513
- ...options,
514
- mask: undefined
515
- };
516
- if (!copy.type) copy.type = (0, _elementHandle.determineScreenshotType)(options);
517
- if (options.mask) {
518
- copy.mask = options.mask.map(locator => ({
519
- frame: locator._frame._channel,
520
- selector: locator._selector
521
- }));
522
- }
523
- const result = await this._channel.screenshot(copy);
524
- if (options.path) {
525
- await (0, _utils.mkdirIfNeeded)(options.path);
526
- await _fs.default.promises.writeFile(options.path, result.binary);
527
- }
528
- return result.binary;
529
- }
530
- async _expectScreenshot(options) {
531
- const mask = options !== null && options !== void 0 && options.mask ? options === null || options === void 0 ? void 0 : options.mask.map(locator => ({
532
- frame: locator._frame._channel,
533
- selector: locator._selector
534
- })) : undefined;
535
- const locator = options.locator ? {
536
- frame: options.locator._frame._channel,
537
- selector: options.locator._selector
538
- } : undefined;
539
- return await this._channel.expectScreenshot({
540
- ...options,
541
- isNot: !!options.isNot,
542
- locator,
543
- mask
544
- });
545
- }
546
- async title() {
547
- return await this._mainFrame.title();
548
- }
549
- async bringToFront() {
550
- await this._channel.bringToFront();
551
- }
552
- async [_Symbol$asyncDispose]() {
553
- await this.close();
554
- }
555
- async close(options = {}) {
556
- this._closeReason = options.reason;
557
- this._closeWasCalled = true;
558
- try {
559
- if (this._ownedContext) await this._ownedContext.close();else await this._channel.close(options);
560
- } catch (e) {
561
- if ((0, _errors.isTargetClosedError)(e) && !options.runBeforeUnload) return;
562
- throw e;
563
- }
564
- }
565
- isClosed() {
566
- return this._closed;
567
- }
568
- async click(selector, options) {
569
- return await this._mainFrame.click(selector, options);
570
- }
571
- async dragAndDrop(source, target, options) {
572
- return await this._mainFrame.dragAndDrop(source, target, options);
573
- }
574
- async dblclick(selector, options) {
575
- return await this._mainFrame.dblclick(selector, options);
576
- }
577
- async tap(selector, options) {
578
- return await this._mainFrame.tap(selector, options);
579
- }
580
- async fill(selector, value, options) {
581
- return await this._mainFrame.fill(selector, value, options);
582
- }
583
- locator(selector, options) {
584
- return this.mainFrame().locator(selector, options);
585
- }
586
- getByTestId(testId) {
587
- return this.mainFrame().getByTestId(testId);
588
- }
589
- getByAltText(text, options) {
590
- return this.mainFrame().getByAltText(text, options);
591
- }
592
- getByLabel(text, options) {
593
- return this.mainFrame().getByLabel(text, options);
594
- }
595
- getByPlaceholder(text, options) {
596
- return this.mainFrame().getByPlaceholder(text, options);
597
- }
598
- getByText(text, options) {
599
- return this.mainFrame().getByText(text, options);
600
- }
601
- getByTitle(text, options) {
602
- return this.mainFrame().getByTitle(text, options);
603
- }
604
- getByRole(role, options = {}) {
605
- return this.mainFrame().getByRole(role, options);
606
- }
607
- frameLocator(selector) {
608
- return this.mainFrame().frameLocator(selector);
609
- }
610
- async focus(selector, options) {
611
- return await this._mainFrame.focus(selector, options);
612
- }
613
- async textContent(selector, options) {
614
- return await this._mainFrame.textContent(selector, options);
615
- }
616
- async innerText(selector, options) {
617
- return await this._mainFrame.innerText(selector, options);
618
- }
619
- async innerHTML(selector, options) {
620
- return await this._mainFrame.innerHTML(selector, options);
621
- }
622
- async getAttribute(selector, name, options) {
623
- return await this._mainFrame.getAttribute(selector, name, options);
624
- }
625
- async inputValue(selector, options) {
626
- return await this._mainFrame.inputValue(selector, options);
627
- }
628
- async isChecked(selector, options) {
629
- return await this._mainFrame.isChecked(selector, options);
630
- }
631
- async isDisabled(selector, options) {
632
- return await this._mainFrame.isDisabled(selector, options);
633
- }
634
- async isEditable(selector, options) {
635
- return await this._mainFrame.isEditable(selector, options);
636
- }
637
- async isEnabled(selector, options) {
638
- return await this._mainFrame.isEnabled(selector, options);
639
- }
640
- async isHidden(selector, options) {
641
- return await this._mainFrame.isHidden(selector, options);
642
- }
643
- async isVisible(selector, options) {
644
- return await this._mainFrame.isVisible(selector, options);
645
- }
646
- async hover(selector, options) {
647
- return await this._mainFrame.hover(selector, options);
648
- }
649
- async selectOption(selector, values, options) {
650
- return await this._mainFrame.selectOption(selector, values, options);
651
- }
652
- async setInputFiles(selector, files, options) {
653
- return await this._mainFrame.setInputFiles(selector, files, options);
654
- }
655
- async type(selector, text, options) {
656
- return await this._mainFrame.type(selector, text, options);
657
- }
658
- async press(selector, key, options) {
659
- return await this._mainFrame.press(selector, key, options);
660
- }
661
- async check(selector, options) {
662
- return await this._mainFrame.check(selector, options);
663
- }
664
- async uncheck(selector, options) {
665
- return await this._mainFrame.uncheck(selector, options);
666
- }
667
- async setChecked(selector, checked, options) {
668
- return await this._mainFrame.setChecked(selector, checked, options);
669
- }
670
- async waitForTimeout(timeout) {
671
- return await this._mainFrame.waitForTimeout(timeout);
672
- }
673
- async waitForFunction(pageFunction, arg, options) {
674
- return await this._mainFrame.waitForFunction(pageFunction, arg, options);
675
- }
676
- workers() {
677
- return [...this._workers];
678
- }
679
- async pause(_options) {
680
- var _this$_instrumentatio;
681
- if (require('inspector').url()) return;
682
- const defaultNavigationTimeout = this._browserContext._timeoutSettings.defaultNavigationTimeout();
683
- const defaultTimeout = this._browserContext._timeoutSettings.defaultTimeout();
684
- this._browserContext.setDefaultNavigationTimeout(0);
685
- this._browserContext.setDefaultTimeout(0);
686
- (_this$_instrumentatio = this._instrumentation) === null || _this$_instrumentatio === void 0 || _this$_instrumentatio.onWillPause({
687
- keepTestTimeout: !!(_options !== null && _options !== void 0 && _options.__testHookKeepTestTimeout)
688
- });
689
- await this._closedOrCrashedScope.safeRace(this.context()._channel.pause());
690
- this._browserContext.setDefaultNavigationTimeout(defaultNavigationTimeout);
691
- this._browserContext.setDefaultTimeout(defaultTimeout);
692
- }
693
- async pdf(options = {}) {
694
- const transportOptions = {
695
- ...options
696
- };
697
- if (transportOptions.margin) transportOptions.margin = {
698
- ...transportOptions.margin
699
- };
700
- if (typeof options.width === 'number') transportOptions.width = options.width + 'px';
701
- if (typeof options.height === 'number') transportOptions.height = options.height + 'px';
702
- for (const margin of ['top', 'right', 'bottom', 'left']) {
703
- const index = margin;
704
- if (options.margin && typeof options.margin[index] === 'number') transportOptions.margin[index] = transportOptions.margin[index] + 'px';
705
- }
706
- const result = await this._channel.pdf(transportOptions);
707
- if (options.path) {
708
- await _fs.default.promises.mkdir(_path.default.dirname(options.path), {
709
- recursive: true
710
- });
711
- await _fs.default.promises.writeFile(options.path, result.pdf);
712
- }
713
- return result.pdf;
714
- }
715
- }
716
- exports.Page = Page;
717
- class BindingCall extends _channelOwner.ChannelOwner {
718
- static from(channel) {
719
- return channel._object;
720
- }
721
- constructor(parent, type, guid, initializer) {
722
- super(parent, type, guid, initializer);
723
- }
724
- async call(func) {
725
- try {
726
- const frame = _frame.Frame.from(this._initializer.frame);
727
- const source = {
728
- context: frame._page.context(),
729
- page: frame._page,
730
- frame
731
- };
732
- let result;
733
- if (this._initializer.handle) result = await func(source, _jsHandle.JSHandle.from(this._initializer.handle));else result = await func(source, ...this._initializer.args.map(_jsHandle.parseResult));
734
- this._channel.resolve({
735
- result: (0, _jsHandle.serializeArgument)(result)
736
- }).catch(() => {});
737
- } catch (e) {
738
- this._channel.reject({
739
- error: (0, _errors.serializeError)(e)
740
- }).catch(() => {});
741
- }
742
- }
743
- }
744
- exports.BindingCall = BindingCall;
745
- function trimUrl(param) {
746
- if ((0, _utils.isRegExp)(param)) return `/${(0, _utils.trimStringWithEllipsis)(param.source, 50)}/${param.flags}`;
747
- if ((0, _utils.isString)(param)) return `"${(0, _utils.trimStringWithEllipsis)(param, 50)}"`;
748
- }