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,232 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.JavaLanguageGenerator = void 0;
7
- var _language = require("./language");
8
- var _deviceDescriptors = require("../deviceDescriptors");
9
- var _javascript = require("./javascript");
10
- var _utils = require("../../utils");
11
- /**
12
- * Copyright (c) Microsoft Corporation.
13
- *
14
- * Licensed under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License.
16
- * You may obtain a copy of the License at
17
- *
18
- * http://www.apache.org/licenses/LICENSE-2.0
19
- *
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS,
22
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- * See the License for the specific language governing permissions and
24
- * limitations under the License.
25
- */
26
-
27
- class JavaLanguageGenerator {
28
- constructor(mode) {
29
- this.id = void 0;
30
- this.groupName = 'Java';
31
- this.name = void 0;
32
- this.highlighter = 'java';
33
- this._mode = void 0;
34
- if (mode === 'library') {
35
- this.name = 'Library';
36
- this.id = 'java';
37
- } else if (mode === 'junit') {
38
- this.name = 'JUnit';
39
- this.id = 'java-junit';
40
- } else {
41
- throw new Error(`Unknown Java language mode: ${mode}`);
42
- }
43
- this._mode = mode;
44
- }
45
- generateAction(actionInContext) {
46
- const action = actionInContext.action;
47
- const pageAlias = actionInContext.frame.pageAlias;
48
- const offset = this._mode === 'junit' ? 4 : 6;
49
- const formatter = new _javascript.JavaScriptFormatter(offset);
50
- if (this._mode !== 'library' && (action.name === 'openPage' || action.name === 'closePage')) return '';
51
- if (action.name === 'openPage') {
52
- formatter.add(`Page ${pageAlias} = context.newPage();`);
53
- if (action.url && action.url !== 'about:blank' && action.url !== 'chrome://newtab/') formatter.add(`${pageAlias}.navigate(${quote(action.url)});`);
54
- return formatter.format();
55
- }
56
- const locators = actionInContext.frame.framePath.map(selector => `.${this._asLocator(selector, false)}.contentFrame()`);
57
- const subject = `${pageAlias}${locators.join('')}`;
58
- const signals = (0, _language.toSignalMap)(action);
59
- if (signals.dialog) {
60
- formatter.add(` ${pageAlias}.onceDialog(dialog -> {
61
- System.out.println(String.format("Dialog message: %s", dialog.message()));
62
- dialog.dismiss();
63
- });`);
64
- }
65
- let code = this._generateActionCall(subject, actionInContext, !!actionInContext.frame.framePath.length);
66
- if (signals.popup) {
67
- code = `Page ${signals.popup.popupAlias} = ${pageAlias}.waitForPopup(() -> {
68
- ${code}
69
- });`;
70
- }
71
- if (signals.download) {
72
- code = `Download download${signals.download.downloadAlias} = ${pageAlias}.waitForDownload(() -> {
73
- ${code}
74
- });`;
75
- }
76
- formatter.add(code);
77
- return formatter.format();
78
- }
79
- _generateActionCall(subject, actionInContext, inFrameLocator) {
80
- const action = actionInContext.action;
81
- switch (action.name) {
82
- case 'openPage':
83
- throw Error('Not reached');
84
- case 'closePage':
85
- return `${subject}.close();`;
86
- case 'click':
87
- {
88
- let method = 'click';
89
- if (action.clickCount === 2) method = 'dblclick';
90
- const options = (0, _language.toClickOptionsForSourceCode)(action);
91
- const optionsText = formatClickOptions(options);
92
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.${method}(${optionsText});`;
93
- }
94
- case 'check':
95
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.check();`;
96
- case 'uncheck':
97
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.uncheck();`;
98
- case 'fill':
99
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.fill(${quote(action.text)});`;
100
- case 'setInputFiles':
101
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.setInputFiles(${formatPath(action.files.length === 1 ? action.files[0] : action.files)});`;
102
- case 'press':
103
- {
104
- const modifiers = (0, _language.toKeyboardModifiers)(action.modifiers);
105
- const shortcut = [...modifiers, action.key].join('+');
106
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.press(${quote(shortcut)});`;
107
- }
108
- case 'navigate':
109
- return `${subject}.navigate(${quote(action.url)});`;
110
- case 'select':
111
- return `${subject}.${this._asLocator(action.selector, inFrameLocator)}.selectOption(${formatSelectOption(action.options.length === 1 ? action.options[0] : action.options)});`;
112
- case 'assertText':
113
- return `assertThat(${subject}.${this._asLocator(action.selector, inFrameLocator)}).${action.substring ? 'containsText' : 'hasText'}(${quote(action.text)});`;
114
- case 'assertChecked':
115
- return `assertThat(${subject}.${this._asLocator(action.selector, inFrameLocator)})${action.checked ? '' : '.not()'}.isChecked();`;
116
- case 'assertVisible':
117
- return `assertThat(${subject}.${this._asLocator(action.selector, inFrameLocator)}).isVisible();`;
118
- case 'assertValue':
119
- {
120
- const assertion = action.value ? `hasValue(${quote(action.value)})` : `isEmpty()`;
121
- return `assertThat(${subject}.${this._asLocator(action.selector, inFrameLocator)}).${assertion};`;
122
- }
123
- case 'assertSnapshot':
124
- return `assertThat(${subject}.${this._asLocator(action.selector, inFrameLocator)}).matchesAriaSnapshot(${quote(action.snapshot)});`;
125
- }
126
- }
127
- _asLocator(selector, inFrameLocator) {
128
- return (0, _utils.asLocator)('java', selector, inFrameLocator);
129
- }
130
- generateHeader(options) {
131
- const formatter = new _javascript.JavaScriptFormatter();
132
- if (this._mode === 'junit') {
133
- formatter.add(`
134
- import com.microsoft.playwright.junit.UsePlaywright;
135
- import com.microsoft.playwright.Page;
136
- import com.microsoft.playwright.options.*;
137
-
138
- import org.junit.jupiter.api.*;
139
- import static com.microsoft.playwright.assertions.PlaywrightAssertions.*;
140
-
141
- @UsePlaywright
142
- public class TestExample {
143
- @Test
144
- void test(Page page) {`);
145
- return formatter.format();
146
- }
147
- formatter.add(`
148
- import com.microsoft.playwright.*;
149
- import com.microsoft.playwright.options.*;
150
- import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
151
- import java.util.*;
152
-
153
- public class Example {
154
- public static void main(String[] args) {
155
- try (Playwright playwright = Playwright.create()) {
156
- Browser browser = playwright.${options.browserName}().launch(${formatLaunchOptions(options.launchOptions)});
157
- BrowserContext context = browser.newContext(${formatContextOptions(options.contextOptions, options.deviceName)});`);
158
- if (options.contextOptions.recordHar) formatter.add(` context.routeFromHAR(${quote(options.contextOptions.recordHar.path)});`);
159
- return formatter.format();
160
- }
161
- generateFooter(saveStorage) {
162
- const storageStateLine = saveStorage ? `\n context.storageState(new BrowserContext.StorageStateOptions().setPath(${quote(saveStorage)}));\n` : '';
163
- if (this._mode === 'junit') {
164
- return `${storageStateLine} }
165
- }`;
166
- }
167
- return `${storageStateLine} }
168
- }
169
- }`;
170
- }
171
- }
172
- exports.JavaLanguageGenerator = JavaLanguageGenerator;
173
- function formatPath(files) {
174
- if (Array.isArray(files)) {
175
- if (files.length === 0) return 'new Path[0]';
176
- return `new Path[] {${files.map(s => 'Paths.get(' + quote(s) + ')').join(', ')}}`;
177
- }
178
- return `Paths.get(${quote(files)})`;
179
- }
180
- function formatSelectOption(options) {
181
- if (Array.isArray(options)) {
182
- if (options.length === 0) return 'new String[0]';
183
- return `new String[] {${options.map(s => quote(s)).join(', ')}}`;
184
- }
185
- return quote(options);
186
- }
187
- function formatLaunchOptions(options) {
188
- const lines = [];
189
- if (!Object.keys(options).filter(key => options[key] !== undefined).length) return '';
190
- lines.push('new BrowserType.LaunchOptions()');
191
- if (options.channel) lines.push(` .setChannel(${quote(options.channel)})`);
192
- if (typeof options.headless === 'boolean') lines.push(` .setHeadless(false)`);
193
- return lines.join('\n');
194
- }
195
- function formatContextOptions(contextOptions, deviceName) {
196
- const lines = [];
197
- if (!Object.keys(contextOptions).length && !deviceName) return '';
198
- const device = deviceName ? _deviceDescriptors.deviceDescriptors[deviceName] : {};
199
- const options = {
200
- ...device,
201
- ...contextOptions
202
- };
203
- lines.push('new Browser.NewContextOptions()');
204
- if (options.acceptDownloads) lines.push(` .setAcceptDownloads(true)`);
205
- if (options.bypassCSP) lines.push(` .setBypassCSP(true)`);
206
- if (options.colorScheme) lines.push(` .setColorScheme(ColorScheme.${options.colorScheme.toUpperCase()})`);
207
- if (options.deviceScaleFactor) lines.push(` .setDeviceScaleFactor(${options.deviceScaleFactor})`);
208
- if (options.geolocation) lines.push(` .setGeolocation(${options.geolocation.latitude}, ${options.geolocation.longitude})`);
209
- if (options.hasTouch) lines.push(` .setHasTouch(${options.hasTouch})`);
210
- if (options.isMobile) lines.push(` .setIsMobile(${options.isMobile})`);
211
- if (options.locale) lines.push(` .setLocale(${quote(options.locale)})`);
212
- if (options.proxy) lines.push(` .setProxy(new Proxy(${quote(options.proxy.server)}))`);
213
- if (options.serviceWorkers) lines.push(` .setServiceWorkers(ServiceWorkerPolicy.${options.serviceWorkers.toUpperCase()})`);
214
- if (options.storageState) lines.push(` .setStorageStatePath(Paths.get(${quote(options.storageState)}))`);
215
- if (options.timezoneId) lines.push(` .setTimezoneId(${quote(options.timezoneId)})`);
216
- if (options.userAgent) lines.push(` .setUserAgent(${quote(options.userAgent)})`);
217
- if (options.viewport) lines.push(` .setViewportSize(${options.viewport.width}, ${options.viewport.height})`);
218
- return lines.join('\n');
219
- }
220
- function formatClickOptions(options) {
221
- const lines = [];
222
- if (options.button) lines.push(` .setButton(MouseButton.${options.button.toUpperCase()})`);
223
- if (options.modifiers) lines.push(` .setModifiers(Arrays.asList(${options.modifiers.map(m => `KeyboardModifier.${m.toUpperCase()}`).join(', ')}))`);
224
- if (options.clickCount) lines.push(` .setClickCount(${options.clickCount})`);
225
- if (options.position) lines.push(` .setPosition(${options.position.x}, ${options.position.y})`);
226
- if (!lines.length) return '';
227
- lines.unshift(`new Locator.ClickOptions()`);
228
- return lines.join('\n');
229
- }
230
- function quote(text) {
231
- return (0, _utils.escapeWithQuotes)(text, '\"');
232
- }
@@ -1,245 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.JavaScriptLanguageGenerator = exports.JavaScriptFormatter = void 0;
7
- exports.quoteMultiline = quoteMultiline;
8
- var _language = require("./language");
9
- var _deviceDescriptors = require("../deviceDescriptors");
10
- var _utils = require("../../utils");
11
- /**
12
- * Copyright (c) Microsoft Corporation.
13
- *
14
- * Licensed under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License.
16
- * You may obtain a copy of the License at
17
- *
18
- * http://www.apache.org/licenses/LICENSE-2.0
19
- *
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS,
22
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- * See the License for the specific language governing permissions and
24
- * limitations under the License.
25
- */
26
-
27
- class JavaScriptLanguageGenerator {
28
- constructor(isTest) {
29
- this.id = void 0;
30
- this.groupName = 'Node.js';
31
- this.name = void 0;
32
- this.highlighter = 'javascript';
33
- this._isTest = void 0;
34
- this.id = isTest ? 'playwright-test' : 'javascript';
35
- this.name = isTest ? 'Test Runner' : 'Library';
36
- this._isTest = isTest;
37
- }
38
- generateAction(actionInContext) {
39
- const action = actionInContext.action;
40
- if (this._isTest && (action.name === 'openPage' || action.name === 'closePage')) return '';
41
- const pageAlias = actionInContext.frame.pageAlias;
42
- const formatter = new JavaScriptFormatter(2);
43
- if (action.name === 'openPage') {
44
- formatter.add(`const ${pageAlias} = await context.newPage();`);
45
- if (action.url && action.url !== 'about:blank' && action.url !== 'chrome://newtab/') formatter.add(`await ${pageAlias}.goto(${quote(action.url)});`);
46
- return formatter.format();
47
- }
48
- const locators = actionInContext.frame.framePath.map(selector => `.${this._asLocator(selector)}.contentFrame()`);
49
- const subject = `${pageAlias}${locators.join('')}`;
50
- const signals = (0, _language.toSignalMap)(action);
51
- if (signals.dialog) {
52
- formatter.add(` ${pageAlias}.once('dialog', dialog => {
53
- console.log(\`Dialog message: $\{dialog.message()}\`);
54
- dialog.dismiss().catch(() => {});
55
- });`);
56
- }
57
- if (signals.popup) formatter.add(`const ${signals.popup.popupAlias}Promise = ${pageAlias}.waitForEvent('popup');`);
58
- if (signals.download) formatter.add(`const download${signals.download.downloadAlias}Promise = ${pageAlias}.waitForEvent('download');`);
59
- formatter.add(wrapWithStep(actionInContext.description, this._generateActionCall(subject, actionInContext)));
60
- if (signals.popup) formatter.add(`const ${signals.popup.popupAlias} = await ${signals.popup.popupAlias}Promise;`);
61
- if (signals.download) formatter.add(`const download${signals.download.downloadAlias} = await download${signals.download.downloadAlias}Promise;`);
62
- return formatter.format();
63
- }
64
- _generateActionCall(subject, actionInContext) {
65
- const action = actionInContext.action;
66
- switch (action.name) {
67
- case 'openPage':
68
- throw Error('Not reached');
69
- case 'closePage':
70
- return `await ${subject}.close();`;
71
- case 'click':
72
- {
73
- let method = 'click';
74
- if (action.clickCount === 2) method = 'dblclick';
75
- const options = (0, _language.toClickOptionsForSourceCode)(action);
76
- const optionsString = formatOptions(options, false);
77
- return `await ${subject}.${this._asLocator(action.selector)}.${method}(${optionsString});`;
78
- }
79
- case 'check':
80
- return `await ${subject}.${this._asLocator(action.selector)}.check();`;
81
- case 'uncheck':
82
- return `await ${subject}.${this._asLocator(action.selector)}.uncheck();`;
83
- case 'fill':
84
- return `await ${subject}.${this._asLocator(action.selector)}.fill(${quote(action.text)});`;
85
- case 'setInputFiles':
86
- return `await ${subject}.${this._asLocator(action.selector)}.setInputFiles(${formatObject(action.files.length === 1 ? action.files[0] : action.files)});`;
87
- case 'press':
88
- {
89
- const modifiers = (0, _language.toKeyboardModifiers)(action.modifiers);
90
- const shortcut = [...modifiers, action.key].join('+');
91
- return `await ${subject}.${this._asLocator(action.selector)}.press(${quote(shortcut)});`;
92
- }
93
- case 'navigate':
94
- return `await ${subject}.goto(${quote(action.url)});`;
95
- case 'select':
96
- return `await ${subject}.${this._asLocator(action.selector)}.selectOption(${formatObject(action.options.length === 1 ? action.options[0] : action.options)});`;
97
- case 'assertText':
98
- return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).${action.substring ? 'toContainText' : 'toHaveText'}(${quote(action.text)});`;
99
- case 'assertChecked':
100
- return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)})${action.checked ? '' : '.not'}.toBeChecked();`;
101
- case 'assertVisible':
102
- return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).toBeVisible();`;
103
- case 'assertValue':
104
- {
105
- const assertion = action.value ? `toHaveValue(${quote(action.value)})` : `toBeEmpty()`;
106
- return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).${assertion};`;
107
- }
108
- case 'assertSnapshot':
109
- return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).toMatchAriaSnapshot(${quoteMultiline(action.snapshot)});`;
110
- }
111
- }
112
- _asLocator(selector) {
113
- return (0, _utils.asLocator)('javascript', selector);
114
- }
115
- generateHeader(options) {
116
- if (this._isTest) return this.generateTestHeader(options);
117
- return this.generateStandaloneHeader(options);
118
- }
119
- generateFooter(saveStorage) {
120
- if (this._isTest) return this.generateTestFooter(saveStorage);
121
- return this.generateStandaloneFooter(saveStorage);
122
- }
123
- generateTestHeader(options) {
124
- const formatter = new JavaScriptFormatter();
125
- const useText = formatContextOptions(options.contextOptions, options.deviceName, this._isTest);
126
- formatter.add(`
127
- import { test, expect${options.deviceName ? ', devices' : ''} } from '@playwright/test';
128
- ${useText ? '\ntest.use(' + useText + ');\n' : ''}
129
- test('test', async ({ page }) => {`);
130
- if (options.contextOptions.recordHar) formatter.add(` await page.routeFromHAR(${quote(options.contextOptions.recordHar.path)});`);
131
- return formatter.format();
132
- }
133
- generateTestFooter(saveStorage) {
134
- return `});`;
135
- }
136
- generateStandaloneHeader(options) {
137
- const formatter = new JavaScriptFormatter();
138
- formatter.add(`
139
- const { ${options.browserName}${options.deviceName ? ', devices' : ''} } = require('playwright');
140
-
141
- (async () => {
142
- const browser = await ${options.browserName}.launch(${formatObjectOrVoid(options.launchOptions)});
143
- const context = await browser.newContext(${formatContextOptions(options.contextOptions, options.deviceName, false)});`);
144
- if (options.contextOptions.recordHar) formatter.add(` await context.routeFromHAR(${quote(options.contextOptions.recordHar.path)});`);
145
- return formatter.format();
146
- }
147
- generateStandaloneFooter(saveStorage) {
148
- const storageStateLine = saveStorage ? `\n await context.storageState({ path: ${quote(saveStorage)} });` : '';
149
- return `\n // ---------------------${storageStateLine}
150
- await context.close();
151
- await browser.close();
152
- })();`;
153
- }
154
- }
155
- exports.JavaScriptLanguageGenerator = JavaScriptLanguageGenerator;
156
- function formatOptions(value, hasArguments) {
157
- const keys = Object.keys(value);
158
- if (!keys.length) return '';
159
- return (hasArguments ? ', ' : '') + formatObject(value);
160
- }
161
- function formatObject(value, indent = ' ') {
162
- if (typeof value === 'string') return quote(value);
163
- if (Array.isArray(value)) return `[${value.map(o => formatObject(o)).join(', ')}]`;
164
- if (typeof value === 'object') {
165
- const keys = Object.keys(value).filter(key => value[key] !== undefined).sort();
166
- if (!keys.length) return '{}';
167
- const tokens = [];
168
- for (const key of keys) tokens.push(`${key}: ${formatObject(value[key])}`);
169
- return `{\n${indent}${tokens.join(`,\n${indent}`)}\n}`;
170
- }
171
- return String(value);
172
- }
173
- function formatObjectOrVoid(value, indent = ' ') {
174
- const result = formatObject(value, indent);
175
- return result === '{}' ? '' : result;
176
- }
177
- function formatContextOptions(options, deviceName, isTest) {
178
- const device = deviceName && _deviceDescriptors.deviceDescriptors[deviceName];
179
- // recordHAR is replaced with routeFromHAR in the generated code.
180
- options = {
181
- ...options,
182
- recordHar: undefined
183
- };
184
- if (!device) return formatObjectOrVoid(options);
185
- // Filter out all the properties from the device descriptor.
186
- let serializedObject = formatObjectOrVoid((0, _language.sanitizeDeviceOptions)(device, options));
187
- // When there are no additional context options, we still want to spread the device inside.
188
- if (!serializedObject) serializedObject = '{\n}';
189
- const lines = serializedObject.split('\n');
190
- lines.splice(1, 0, `...devices[${quote(deviceName)}],`);
191
- return lines.join('\n');
192
- }
193
- class JavaScriptFormatter {
194
- constructor(offset = 0) {
195
- this._baseIndent = void 0;
196
- this._baseOffset = void 0;
197
- this._lines = [];
198
- this._baseIndent = ' '.repeat(2);
199
- this._baseOffset = ' '.repeat(offset);
200
- }
201
- prepend(text) {
202
- const trim = isMultilineString(text) ? line => line : line => line.trim();
203
- this._lines = text.trim().split('\n').map(trim).concat(this._lines);
204
- }
205
- add(text) {
206
- const trim = isMultilineString(text) ? line => line : line => line.trim();
207
- this._lines.push(...text.trim().split('\n').map(trim));
208
- }
209
- newLine() {
210
- this._lines.push('');
211
- }
212
- format() {
213
- let spaces = '';
214
- let previousLine = '';
215
- return this._lines.map(line => {
216
- if (line === '') return line;
217
- if (line.startsWith('}') || line.startsWith(']')) spaces = spaces.substring(this._baseIndent.length);
218
- const extraSpaces = /^(for|while|if|try).*\(.*\)$/.test(previousLine) ? this._baseIndent : '';
219
- previousLine = line;
220
- const callCarryOver = line.startsWith('.set');
221
- line = spaces + extraSpaces + (callCarryOver ? this._baseIndent : '') + line;
222
- if (line.endsWith('{') || line.endsWith('[')) spaces += this._baseIndent;
223
- return this._baseOffset + line;
224
- }).join('\n');
225
- }
226
- }
227
- exports.JavaScriptFormatter = JavaScriptFormatter;
228
- function quote(text) {
229
- return (0, _utils.escapeWithQuotes)(text, '\'');
230
- }
231
- function wrapWithStep(description, body) {
232
- return description ? `await test.step(\`${description}\`, async () => {
233
- ${body}
234
- });` : body;
235
- }
236
- function quoteMultiline(text, indent = ' ') {
237
- const escape = text => text.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
238
- const lines = text.split('\n');
239
- if (lines.length === 1) return '`' + escape(text) + '`';
240
- return '`\n' + lines.map(line => indent + escape(line).replace(/\${/g, '\\${')).join('\n') + `\n${indent}\``;
241
- }
242
- function isMultilineString(text) {
243
- var _text$match;
244
- return (_text$match = text.match(/`[\S\s]*`/)) === null || _text$match === void 0 ? void 0 : _text$match[0].includes('\n');
245
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.JsonlLanguageGenerator = void 0;
7
- var _utils = require("../../utils");
8
- /**
9
- * Copyright (c) Microsoft Corporation.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
-
24
- class JsonlLanguageGenerator {
25
- constructor() {
26
- this.id = 'jsonl';
27
- this.groupName = '';
28
- this.name = 'JSONL';
29
- this.highlighter = 'javascript';
30
- }
31
- generateAction(actionInContext) {
32
- const locator = actionInContext.action.selector ? JSON.parse((0, _utils.asLocator)('jsonl', actionInContext.action.selector)) : undefined;
33
- const entry = {
34
- ...actionInContext.action,
35
- pageAlias: actionInContext.frame.pageAlias,
36
- locator
37
- };
38
- return JSON.stringify(entry);
39
- }
40
- generateHeader(options) {
41
- return JSON.stringify(options);
42
- }
43
- generateFooter(saveStorage) {
44
- return '';
45
- }
46
- }
47
- exports.JsonlLanguageGenerator = JsonlLanguageGenerator;
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fromKeyboardModifiers = fromKeyboardModifiers;
7
- exports.generateCode = generateCode;
8
- exports.sanitizeDeviceOptions = sanitizeDeviceOptions;
9
- exports.toClickOptionsForSourceCode = toClickOptionsForSourceCode;
10
- exports.toKeyboardModifiers = toKeyboardModifiers;
11
- exports.toSignalMap = toSignalMap;
12
- /**
13
- * Copyright (c) Microsoft Corporation.
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- */
27
-
28
- function generateCode(actions, languageGenerator, options) {
29
- const header = languageGenerator.generateHeader(options);
30
- const footer = languageGenerator.generateFooter(options.saveStorage);
31
- const actionTexts = actions.map(a => languageGenerator.generateAction(a)).filter(Boolean);
32
- const text = [header, ...actionTexts, footer].join('\n');
33
- return {
34
- header,
35
- footer,
36
- actionTexts,
37
- text
38
- };
39
- }
40
- function sanitizeDeviceOptions(device, options) {
41
- // Filter out all the properties from the device descriptor.
42
- const cleanedOptions = {};
43
- for (const property in options) {
44
- if (JSON.stringify(device[property]) !== JSON.stringify(options[property])) cleanedOptions[property] = options[property];
45
- }
46
- return cleanedOptions;
47
- }
48
- function toSignalMap(action) {
49
- let popup;
50
- let download;
51
- let dialog;
52
- for (const signal of action.signals) {
53
- if (signal.name === 'popup') popup = signal;else if (signal.name === 'download') download = signal;else if (signal.name === 'dialog') dialog = signal;
54
- }
55
- return {
56
- popup,
57
- download,
58
- dialog
59
- };
60
- }
61
- function toKeyboardModifiers(modifiers) {
62
- const result = [];
63
- if (modifiers & 1) result.push('Alt');
64
- if (modifiers & 2) result.push('ControlOrMeta');
65
- if (modifiers & 4) result.push('ControlOrMeta');
66
- if (modifiers & 8) result.push('Shift');
67
- return result;
68
- }
69
- function fromKeyboardModifiers(modifiers) {
70
- let result = 0;
71
- if (!modifiers) return result;
72
- if (modifiers.includes('Alt')) result |= 1;
73
- if (modifiers.includes('Control')) result |= 2;
74
- if (modifiers.includes('ControlOrMeta')) result |= 2;
75
- if (modifiers.includes('Meta')) result |= 4;
76
- if (modifiers.includes('Shift')) result |= 8;
77
- return result;
78
- }
79
- function toClickOptionsForSourceCode(action) {
80
- const modifiers = toKeyboardModifiers(action.modifiers);
81
- const options = {};
82
- if (action.button !== 'left') options.button = action.button;
83
- if (modifiers.length) options.modifiers = modifiers;
84
- // Do not render clickCount === 2 for dblclick.
85
- if (action.clickCount > 2) options.clickCount = action.clickCount;
86
- if (action.position) options.position = action.position;
87
- return options;
88
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.languageSet = languageSet;
7
- var _java = require("./java");
8
- var _javascript = require("./javascript");
9
- var _jsonl = require("./jsonl");
10
- var _csharp = require("./csharp");
11
- var _python = require("./python");
12
- /**
13
- * Copyright (c) Microsoft Corporation.
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- */
27
-
28
- function languageSet() {
29
- return new Set([new _java.JavaLanguageGenerator('junit'), new _java.JavaLanguageGenerator('library'), new _javascript.JavaScriptLanguageGenerator( /* isPlaywrightTest */false), new _javascript.JavaScriptLanguageGenerator( /* isPlaywrightTest */true), new _python.PythonLanguageGenerator( /* isAsync */false, /* isPytest */true), new _python.PythonLanguageGenerator( /* isAsync */false, /* isPytest */false), new _python.PythonLanguageGenerator( /* isAsync */true, /* isPytest */false), new _csharp.CSharpLanguageGenerator('mstest'), new _csharp.CSharpLanguageGenerator('nunit'), new _csharp.CSharpLanguageGenerator('library'), new _jsonl.JsonlLanguageGenerator()]);
30
- }