rebrowser-playwright-core 1.52.0 → 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.
- package/ThirdPartyNotices.txt +7 -1554
- package/bin/install_webkit_wsl.ps1 +33 -0
- package/bin/reinstall_chrome_beta_linux.sh +1 -1
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_linux.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_linux.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_linux.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_linux.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +16 -44
- package/cli.js +5 -1
- package/index.js +2 -17
- package/lib/bootstrap.js +149 -0
- package/lib/coreBundle.js +78218 -0
- package/lib/entry/cliDaemon.js +5 -0
- package/lib/entry/dashboardApp.js +3 -0
- package/lib/entry/mcp.js +10 -0
- package/lib/entry/oopBrowserDownload.js +3 -0
- package/lib/{server/deviceDescriptors.js → package.js} +18 -7
- package/lib/server/electron/loader.js +108 -14
- package/lib/serverRegistry.js +1939 -0
- package/lib/serverRegistry.js.LICENSE +65 -0
- package/lib/tools/cli-client/channelSessions.js +141 -0
- package/lib/tools/cli-client/cli.js +7 -0
- package/lib/tools/cli-client/help.json +808 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/output.js +352 -0
- package/lib/tools/cli-client/program.js +422 -0
- package/lib/tools/cli-client/registry.js +180 -0
- package/lib/tools/cli-client/session.js +261 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/skills/playwright-cli/SKILL.md +493 -0
- package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
- package/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
- package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
- package/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
- package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
- package/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
- package/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
- package/lib/tools/skills/playwright-trace/SKILL.md +174 -0
- package/lib/tools/utils/extension.js +112 -0
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utilsBundle.js +86038 -66
- package/lib/utilsBundle.js.LICENSE +1890 -0
- package/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/lib/vite/dashboard/index.html +29 -0
- package/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/lib/vite/htmlReport/index.html +2 -61
- package/lib/vite/htmlReport/report.css +2 -0
- package/lib/vite/htmlReport/report.js +32 -0
- package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/lib/vite/traceViewer/index.html +9 -8
- package/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/lib/vite/traceViewer/snapshot.html +4 -15
- package/lib/vite/traceViewer/sw.bundle.js +4 -3
- package/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/lib/vite/traceViewer/uiMode.html +6 -5
- package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/lib/webp_codec.LICENSE +173 -0
- package/lib/webp_codec.wasm +0 -0
- package/lib/{utilsBundleImpl/xdg-open → xdg-open} +338 -137
- package/package.json +6 -16
- package/types/protocol.d.ts +10495 -8030
- package/types/structs.d.ts +8 -1
- package/types/types.d.ts +9256 -4825
- package/lib/androidServerImpl.js +0 -63
- package/lib/browserServerImpl.js +0 -88
- package/lib/cli/driver.js +0 -97
- package/lib/cli/program.js +0 -567
- package/lib/cli/programWithTestStub.js +0 -74
- package/lib/client/accessibility.js +0 -49
- package/lib/client/android.js +0 -365
- package/lib/client/api.js +0 -137
- package/lib/client/artifact.js +0 -79
- package/lib/client/browser.js +0 -136
- package/lib/client/browserContext.js +0 -539
- package/lib/client/browserType.js +0 -193
- package/lib/client/cdpSession.js +0 -51
- package/lib/client/channelOwner.js +0 -205
- package/lib/client/clientHelper.js +0 -64
- package/lib/client/clientInstrumentation.js +0 -55
- package/lib/client/clientStackTrace.js +0 -69
- package/lib/client/clock.js +0 -68
- package/lib/client/connection.js +0 -318
- package/lib/client/consoleMessage.js +0 -55
- package/lib/client/coverage.js +0 -44
- package/lib/client/dialog.js +0 -56
- package/lib/client/download.js +0 -62
- package/lib/client/electron.js +0 -133
- package/lib/client/elementHandle.js +0 -284
- package/lib/client/errors.js +0 -77
- package/lib/client/eventEmitter.js +0 -314
- package/lib/client/events.js +0 -98
- package/lib/client/fetch.js +0 -367
- package/lib/client/fileChooser.js +0 -46
- package/lib/client/fileUtils.js +0 -34
- package/lib/client/frame.js +0 -386
- package/lib/client/harRouter.js +0 -87
- package/lib/client/input.js +0 -82
- package/lib/client/jsHandle.js +0 -105
- package/lib/client/jsonPipe.js +0 -39
- package/lib/client/localUtils.js +0 -61
- package/lib/client/locator.js +0 -362
- package/lib/client/network.js +0 -751
- package/lib/client/page.js +0 -709
- package/lib/client/platform.js +0 -74
- package/lib/client/playwright.js +0 -85
- package/lib/client/selectors.js +0 -75
- package/lib/client/stream.js +0 -39
- package/lib/client/timeoutSettings.js +0 -75
- package/lib/client/tracing.js +0 -114
- package/lib/client/types.js +0 -28
- package/lib/client/video.js +0 -59
- package/lib/client/waiter.js +0 -142
- package/lib/client/webError.js +0 -39
- package/lib/client/webSocket.js +0 -111
- package/lib/client/worker.js +0 -63
- package/lib/client/writableStream.js +0 -39
- package/lib/generated/clockSource.js +0 -28
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/generated/injectedScriptSource.js +0 -28
- package/lib/generated/pollingRecorderSource.js +0 -28
- package/lib/generated/utilityScriptSource.js +0 -28
- package/lib/generated/webSocketMockSource.js +0 -378
- package/lib/inProcessFactory.js +0 -59
- package/lib/inprocess.js +0 -3
- package/lib/outofprocess.js +0 -78
- package/lib/protocol/debug.js +0 -211
- package/lib/protocol/serializers.js +0 -192
- package/lib/protocol/validator.js +0 -2825
- package/lib/protocol/validatorPrimitives.js +0 -179
- package/lib/remote/playwrightConnection.js +0 -266
- package/lib/remote/playwrightServer.js +0 -139
- package/lib/server/accessibility.js +0 -69
- package/lib/server/android/android.js +0 -451
- package/lib/server/android/backendAdb.js +0 -179
- package/lib/server/artifact.js +0 -127
- package/lib/server/bidi/bidiBrowser.js +0 -380
- package/lib/server/bidi/bidiChromium.js +0 -152
- package/lib/server/bidi/bidiConnection.js +0 -187
- package/lib/server/bidi/bidiExecutionContext.js +0 -220
- package/lib/server/bidi/bidiFirefox.js +0 -112
- package/lib/server/bidi/bidiInput.js +0 -146
- package/lib/server/bidi/bidiNetworkManager.js +0 -320
- package/lib/server/bidi/bidiOverCdp.js +0 -102
- package/lib/server/bidi/bidiPage.js +0 -530
- package/lib/server/bidi/bidiPdf.js +0 -106
- package/lib/server/bidi/third_party/bidiCommands.d.js +0 -22
- package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
- package/lib/server/bidi/third_party/bidiKeyboard.js +0 -256
- package/lib/server/bidi/third_party/bidiProtocol.js +0 -152
- package/lib/server/bidi/third_party/bidiSerializer.js +0 -148
- package/lib/server/bidi/third_party/firefoxPrefs.js +0 -259
- package/lib/server/browser.js +0 -140
- package/lib/server/browserContext.js +0 -650
- package/lib/server/browserType.js +0 -326
- package/lib/server/callLog.js +0 -82
- package/lib/server/chromium/chromium.js +0 -376
- package/lib/server/chromium/chromiumSwitches.js +0 -101
- package/lib/server/chromium/crAccessibility.js +0 -263
- package/lib/server/chromium/crBrowser.js +0 -498
- package/lib/server/chromium/crConnection.js +0 -324
- package/lib/server/chromium/crCoverage.js +0 -232
- package/lib/server/chromium/crDevTools.js +0 -117
- package/lib/server/chromium/crDragDrop.js +0 -126
- package/lib/server/chromium/crExecutionContext.js +0 -145
- package/lib/server/chromium/crInput.js +0 -184
- package/lib/server/chromium/crNetworkManager.js +0 -666
- package/lib/server/chromium/crPage.js +0 -1055
- package/lib/server/chromium/crPdf.js +0 -121
- package/lib/server/chromium/crProtocolHelper.js +0 -145
- package/lib/server/chromium/crServiceWorker.js +0 -130
- package/lib/server/chromium/defaultFontFamilies.js +0 -162
- package/lib/server/chromium/protocol.d.js +0 -16
- package/lib/server/chromium/videoRecorder.js +0 -121
- package/lib/server/clock.js +0 -137
- package/lib/server/codegen/csharp.js +0 -329
- package/lib/server/codegen/java.js +0 -270
- package/lib/server/codegen/javascript.js +0 -268
- package/lib/server/codegen/jsonl.js +0 -51
- package/lib/server/codegen/language.js +0 -111
- package/lib/server/codegen/languages.js +0 -68
- package/lib/server/codegen/python.js +0 -277
- package/lib/server/codegen/types.js +0 -16
- package/lib/server/console.js +0 -53
- package/lib/server/cookieStore.js +0 -204
- package/lib/server/debugController.js +0 -185
- package/lib/server/debugger.js +0 -136
- package/lib/server/deviceDescriptorsSource.json +0 -1669
- package/lib/server/dialog.js +0 -72
- package/lib/server/dispatchers/androidDispatcher.js +0 -293
- package/lib/server/dispatchers/artifactDispatcher.js +0 -118
- package/lib/server/dispatchers/browserContextDispatcher.js +0 -328
- package/lib/server/dispatchers/browserDispatcher.js +0 -151
- package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
- package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -44
- package/lib/server/dispatchers/debugControllerDispatcher.js +0 -87
- package/lib/server/dispatchers/dialogDispatcher.js +0 -47
- package/lib/server/dispatchers/dispatcher.js +0 -346
- package/lib/server/dispatchers/electronDispatcher.js +0 -90
- package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -191
- package/lib/server/dispatchers/frameDispatcher.js +0 -224
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -80
- package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -58
- package/lib/server/dispatchers/localUtilsDispatcher.js +0 -155
- package/lib/server/dispatchers/networkDispatchers.js +0 -204
- package/lib/server/dispatchers/pageDispatcher.js +0 -328
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -100
- package/lib/server/dispatchers/selectorsDispatcher.js +0 -40
- package/lib/server/dispatchers/streamDispatcher.js +0 -60
- package/lib/server/dispatchers/tracingDispatcher.js +0 -59
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -154
- package/lib/server/dispatchers/writableStreamDispatcher.js +0 -73
- package/lib/server/dom.js +0 -869
- package/lib/server/download.js +0 -70
- package/lib/server/electron/electron.js +0 -277
- package/lib/server/errors.js +0 -69
- package/lib/server/fetch.js +0 -640
- package/lib/server/fileChooser.js +0 -43
- package/lib/server/fileUploadUtils.js +0 -84
- package/lib/server/firefox/ffAccessibility.js +0 -238
- package/lib/server/firefox/ffBrowser.js +0 -404
- package/lib/server/firefox/ffConnection.js +0 -147
- package/lib/server/firefox/ffExecutionContext.js +0 -149
- package/lib/server/firefox/ffInput.js +0 -159
- package/lib/server/firefox/ffNetworkManager.js +0 -254
- package/lib/server/firefox/ffPage.js +0 -501
- package/lib/server/firefox/firefox.js +0 -106
- package/lib/server/firefox/protocol.d.js +0 -16
- package/lib/server/formData.js +0 -147
- package/lib/server/frameSelectors.js +0 -137
- package/lib/server/frames.js +0 -1555
- package/lib/server/har/harRecorder.js +0 -147
- package/lib/server/har/harTracer.js +0 -606
- package/lib/server/harBackend.js +0 -157
- package/lib/server/helper.js +0 -100
- package/lib/server/index.js +0 -61
- package/lib/server/input.js +0 -280
- package/lib/server/instrumentation.js +0 -75
- package/lib/server/javascript.js +0 -299
- package/lib/server/launchApp.js +0 -110
- package/lib/server/localUtils.js +0 -211
- package/lib/server/macEditingCommands.js +0 -143
- package/lib/server/network.js +0 -583
- package/lib/server/page.js +0 -790
- package/lib/server/pageBinding.js +0 -88
- package/lib/server/pipeTransport.js +0 -89
- package/lib/server/playwright.js +0 -81
- package/lib/server/progress.js +0 -104
- package/lib/server/protocolError.js +0 -52
- package/lib/server/recorder/chat.js +0 -161
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderApp.js +0 -184
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/recorder/recorderRunner.js +0 -135
- package/lib/server/recorder/recorderUtils.js +0 -100
- package/lib/server/recorder/throttledFile.js +0 -57
- package/lib/server/recorder.js +0 -360
- package/lib/server/registry/browserFetcher.js +0 -175
- package/lib/server/registry/dependencies.js +0 -371
- package/lib/server/registry/index.js +0 -1271
- package/lib/server/registry/nativeDeps.js +0 -1105
- package/lib/server/registry/oopDownloadBrowserMain.js +0 -120
- package/lib/server/screenshotter.js +0 -332
- package/lib/server/selectors.js +0 -112
- package/lib/server/socksClientCertificatesInterceptor.js +0 -321
- package/lib/server/socksInterceptor.js +0 -95
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/server/trace/recorder/snapshotter.js +0 -143
- package/lib/server/trace/recorder/snapshotterInjected.js +0 -539
- package/lib/server/trace/recorder/tracing.js +0 -593
- package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
- package/lib/server/trace/viewer/traceViewer.js +0 -249
- package/lib/server/transport.js +0 -183
- package/lib/server/types.js +0 -28
- package/lib/server/usKeyboardLayout.js +0 -145
- package/lib/server/utils/ascii.js +0 -44
- package/lib/server/utils/comparators.js +0 -161
- package/lib/server/utils/crypto.js +0 -216
- package/lib/server/utils/debug.js +0 -47
- package/lib/server/utils/debugLogger.js +0 -114
- package/lib/server/utils/env.js +0 -68
- package/lib/server/utils/eventsHelper.js +0 -39
- package/lib/server/utils/expectUtils.js +0 -38
- package/lib/server/utils/fileUtils.js +0 -191
- package/lib/server/utils/happyEyeballs.js +0 -207
- package/lib/server/utils/hostPlatform.js +0 -109
- package/lib/server/utils/httpServer.js +0 -218
- package/lib/server/utils/image_tools/colorUtils.js +0 -89
- package/lib/server/utils/image_tools/compare.js +0 -109
- package/lib/server/utils/image_tools/imageChannel.js +0 -78
- package/lib/server/utils/image_tools/stats.js +0 -102
- package/lib/server/utils/linuxUtils.js +0 -71
- package/lib/server/utils/network.js +0 -217
- package/lib/server/utils/nodePlatform.js +0 -148
- package/lib/server/utils/pipeTransport.js +0 -84
- package/lib/server/utils/processLauncher.js +0 -238
- package/lib/server/utils/profiler.js +0 -65
- package/lib/server/utils/socksProxy.js +0 -511
- package/lib/server/utils/spawnAsync.js +0 -41
- package/lib/server/utils/task.js +0 -51
- package/lib/server/utils/userAgent.js +0 -98
- package/lib/server/utils/wsServer.js +0 -132
- package/lib/server/utils/zipFile.js +0 -74
- package/lib/server/utils/zones.js +0 -57
- package/lib/server/webkit/protocol.d.js +0 -16
- package/lib/server/webkit/webkit.js +0 -100
- package/lib/server/webkit/wkAccessibility.js +0 -237
- package/lib/server/webkit/wkBrowser.js +0 -312
- package/lib/server/webkit/wkConnection.js +0 -149
- package/lib/server/webkit/wkExecutionContext.js +0 -153
- package/lib/server/webkit/wkInput.js +0 -181
- package/lib/server/webkit/wkInterceptableRequest.js +0 -169
- package/lib/server/webkit/wkPage.js +0 -1114
- package/lib/server/webkit/wkProvisionalPage.js +0 -83
- package/lib/server/webkit/wkWorkers.js +0 -104
- package/lib/third_party/pixelmatch.js +0 -255
- package/lib/utils/isomorphic/ariaSnapshot.js +0 -384
- package/lib/utils/isomorphic/assert.js +0 -31
- package/lib/utils/isomorphic/builtins.js +0 -90
- package/lib/utils/isomorphic/colors.js +0 -72
- package/lib/utils/isomorphic/cssParser.js +0 -246
- package/lib/utils/isomorphic/cssTokenizer.js +0 -1051
- package/lib/utils/isomorphic/headers.js +0 -53
- package/lib/utils/isomorphic/locatorGenerators.js +0 -655
- package/lib/utils/isomorphic/locatorParser.js +0 -176
- package/lib/utils/isomorphic/locatorUtils.js +0 -81
- package/lib/utils/isomorphic/manualPromise.js +0 -115
- package/lib/utils/isomorphic/mimeType.js +0 -460
- package/lib/utils/isomorphic/multimap.js +0 -81
- package/lib/utils/isomorphic/rtti.js +0 -43
- package/lib/utils/isomorphic/selectorParser.js +0 -387
- package/lib/utils/isomorphic/semaphore.js +0 -54
- package/lib/utils/isomorphic/stackTrace.js +0 -158
- package/lib/utils/isomorphic/stringUtils.js +0 -176
- package/lib/utils/isomorphic/time.js +0 -44
- package/lib/utils/isomorphic/timeoutRunner.js +0 -67
- package/lib/utils/isomorphic/traceUtils.js +0 -59
- package/lib/utils/isomorphic/types.js +0 -16
- package/lib/utils/isomorphic/urlMatch.js +0 -167
- package/lib/utils/isomorphic/utilityScriptSerializers.js +0 -248
- package/lib/utils.js +0 -101
- package/lib/utilsBundleImpl/index.js +0 -208
- package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
- package/lib/vite/recorder/assets/codeMirrorModule-DVQi6prl.js +0 -24
- package/lib/vite/recorder/assets/index-97EUAAbk.js +0 -184
- package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-DwAiTpyC.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-DkkRvn5X.js +0 -265
- package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
- package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.DvtSwn6E.js +0 -2
- package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
- package/lib/vite/traceViewer/uiMode.Sdytl9wc.js +0 -5
- package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
- package/lib/zipBundle.js +0 -34
- package/lib/zipBundleImpl.js +0 -5
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var recorderRunner_exports = {};
|
|
20
|
-
__export(recorderRunner_exports, {
|
|
21
|
-
performAction: () => performAction,
|
|
22
|
-
toClickOptions: () => toClickOptions
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(recorderRunner_exports);
|
|
25
|
-
var import_utils = require("../../utils");
|
|
26
|
-
var import_language = require("../codegen/language");
|
|
27
|
-
var import_instrumentation = require("../instrumentation");
|
|
28
|
-
var import_recorderUtils = require("./recorderUtils");
|
|
29
|
-
async function performAction(pageAliases, actionInContext) {
|
|
30
|
-
const callMetadata = (0, import_instrumentation.serverSideCallMetadata)();
|
|
31
|
-
const mainFrame = (0, import_recorderUtils.mainFrameForAction)(pageAliases, actionInContext);
|
|
32
|
-
const { action } = actionInContext;
|
|
33
|
-
const kActionTimeout = 5e3;
|
|
34
|
-
if (action.name === "navigate") {
|
|
35
|
-
await mainFrame.goto(callMetadata, action.url, { timeout: kActionTimeout });
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (action.name === "openPage")
|
|
39
|
-
throw Error("Not reached");
|
|
40
|
-
if (action.name === "closePage") {
|
|
41
|
-
await mainFrame._page.close(callMetadata);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const selector = (0, import_recorderUtils.buildFullSelector)(actionInContext.frame.framePath, action.selector);
|
|
45
|
-
if (action.name === "click") {
|
|
46
|
-
const options = toClickOptions(action);
|
|
47
|
-
await mainFrame.click(callMetadata, selector, { ...options, timeout: kActionTimeout, strict: true });
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (action.name === "press") {
|
|
51
|
-
const modifiers = (0, import_language.toKeyboardModifiers)(action.modifiers);
|
|
52
|
-
const shortcut = [...modifiers, action.key].join("+");
|
|
53
|
-
await mainFrame.press(callMetadata, selector, shortcut, { timeout: kActionTimeout, strict: true });
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (action.name === "fill") {
|
|
57
|
-
await mainFrame.fill(callMetadata, selector, action.text, { timeout: kActionTimeout, strict: true });
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (action.name === "setInputFiles") {
|
|
61
|
-
await mainFrame.setInputFiles(callMetadata, selector, { selector, payloads: [], timeout: kActionTimeout, strict: true });
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (action.name === "check") {
|
|
65
|
-
await mainFrame.check(callMetadata, selector, { timeout: kActionTimeout, strict: true });
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (action.name === "uncheck") {
|
|
69
|
-
await mainFrame.uncheck(callMetadata, selector, { timeout: kActionTimeout, strict: true });
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (action.name === "select") {
|
|
73
|
-
const values = action.options.map((value) => ({ value }));
|
|
74
|
-
await mainFrame.selectOption(callMetadata, selector, [], values, { timeout: kActionTimeout, strict: true });
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (action.name === "assertChecked") {
|
|
78
|
-
await mainFrame.expect(callMetadata, selector, {
|
|
79
|
-
selector,
|
|
80
|
-
expression: "to.be.checked",
|
|
81
|
-
expectedValue: { checked: action.checked },
|
|
82
|
-
isNot: !action.checked,
|
|
83
|
-
timeout: kActionTimeout
|
|
84
|
-
});
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (action.name === "assertText") {
|
|
88
|
-
await mainFrame.expect(callMetadata, selector, {
|
|
89
|
-
selector,
|
|
90
|
-
expression: "to.have.text",
|
|
91
|
-
expectedText: (0, import_utils.serializeExpectedTextValues)([action.text], { matchSubstring: true, normalizeWhiteSpace: true }),
|
|
92
|
-
isNot: false,
|
|
93
|
-
timeout: kActionTimeout
|
|
94
|
-
});
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (action.name === "assertValue") {
|
|
98
|
-
await mainFrame.expect(callMetadata, selector, {
|
|
99
|
-
selector,
|
|
100
|
-
expression: "to.have.value",
|
|
101
|
-
expectedValue: action.value,
|
|
102
|
-
isNot: false,
|
|
103
|
-
timeout: kActionTimeout
|
|
104
|
-
});
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (action.name === "assertVisible") {
|
|
108
|
-
await mainFrame.expect(callMetadata, selector, {
|
|
109
|
-
selector,
|
|
110
|
-
expression: "to.be.visible",
|
|
111
|
-
isNot: false,
|
|
112
|
-
timeout: kActionTimeout
|
|
113
|
-
});
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
throw new Error("Internal error: unexpected action " + action.name);
|
|
117
|
-
}
|
|
118
|
-
function toClickOptions(action) {
|
|
119
|
-
const modifiers = (0, import_language.toKeyboardModifiers)(action.modifiers);
|
|
120
|
-
const options = {};
|
|
121
|
-
if (action.button !== "left")
|
|
122
|
-
options.button = action.button;
|
|
123
|
-
if (modifiers.length)
|
|
124
|
-
options.modifiers = modifiers;
|
|
125
|
-
if (action.clickCount > 1)
|
|
126
|
-
options.clickCount = action.clickCount;
|
|
127
|
-
if (action.position)
|
|
128
|
-
options.position = action.position;
|
|
129
|
-
return options;
|
|
130
|
-
}
|
|
131
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
-
0 && (module.exports = {
|
|
133
|
-
performAction,
|
|
134
|
-
toClickOptions
|
|
135
|
-
});
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var recorderUtils_exports = {};
|
|
20
|
-
__export(recorderUtils_exports, {
|
|
21
|
-
buildFullSelector: () => buildFullSelector,
|
|
22
|
-
collapseActions: () => collapseActions,
|
|
23
|
-
frameForAction: () => frameForAction,
|
|
24
|
-
mainFrameForAction: () => mainFrameForAction,
|
|
25
|
-
metadataToCallLog: () => metadataToCallLog
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(recorderUtils_exports);
|
|
28
|
-
function buildFullSelector(framePath, selector) {
|
|
29
|
-
return [...framePath, selector].join(" >> internal:control=enter-frame >> ");
|
|
30
|
-
}
|
|
31
|
-
function metadataToCallLog(metadata, status) {
|
|
32
|
-
let title = metadata.apiName || metadata.method;
|
|
33
|
-
if (metadata.method === "waitForEventInfo")
|
|
34
|
-
title += `(${metadata.params.info.event})`;
|
|
35
|
-
title = title.replace("object.expect", "expect");
|
|
36
|
-
if (metadata.error)
|
|
37
|
-
status = "error";
|
|
38
|
-
const params = {
|
|
39
|
-
url: metadata.params?.url,
|
|
40
|
-
selector: metadata.params?.selector
|
|
41
|
-
};
|
|
42
|
-
let duration = metadata.endTime ? metadata.endTime - metadata.startTime : void 0;
|
|
43
|
-
if (typeof duration === "number" && metadata.pauseStartTime && metadata.pauseEndTime) {
|
|
44
|
-
duration -= metadata.pauseEndTime - metadata.pauseStartTime;
|
|
45
|
-
duration = Math.max(duration, 0);
|
|
46
|
-
}
|
|
47
|
-
const callLog = {
|
|
48
|
-
id: metadata.id,
|
|
49
|
-
messages: metadata.log,
|
|
50
|
-
title,
|
|
51
|
-
status,
|
|
52
|
-
error: metadata.error?.error?.message,
|
|
53
|
-
params,
|
|
54
|
-
duration
|
|
55
|
-
};
|
|
56
|
-
return callLog;
|
|
57
|
-
}
|
|
58
|
-
function mainFrameForAction(pageAliases, actionInContext) {
|
|
59
|
-
const pageAlias = actionInContext.frame.pageAlias;
|
|
60
|
-
const page = [...pageAliases.entries()].find(([, alias]) => pageAlias === alias)?.[0];
|
|
61
|
-
if (!page)
|
|
62
|
-
throw new Error(`Internal error: page ${pageAlias} not found in [${[...pageAliases.values()]}]`);
|
|
63
|
-
return page.mainFrame();
|
|
64
|
-
}
|
|
65
|
-
async function frameForAction(pageAliases, actionInContext, action) {
|
|
66
|
-
const pageAlias = actionInContext.frame.pageAlias;
|
|
67
|
-
const page = [...pageAliases.entries()].find(([, alias]) => pageAlias === alias)?.[0];
|
|
68
|
-
if (!page)
|
|
69
|
-
throw new Error("Internal error: page not found");
|
|
70
|
-
const fullSelector = buildFullSelector(actionInContext.frame.framePath, action.selector);
|
|
71
|
-
const result = await page.mainFrame().selectors.resolveFrameForSelector(fullSelector);
|
|
72
|
-
if (!result)
|
|
73
|
-
throw new Error("Internal error: frame not found");
|
|
74
|
-
return result.frame;
|
|
75
|
-
}
|
|
76
|
-
function collapseActions(actions) {
|
|
77
|
-
const result = [];
|
|
78
|
-
for (const action of actions) {
|
|
79
|
-
const lastAction = result[result.length - 1];
|
|
80
|
-
const isSameAction = lastAction && lastAction.action.name === action.action.name && lastAction.frame.pageAlias === action.frame.pageAlias && lastAction.frame.framePath.join("|") === action.frame.framePath.join("|");
|
|
81
|
-
const isSameSelector = lastAction && "selector" in lastAction.action && "selector" in action.action && action.action.selector === lastAction.action.selector;
|
|
82
|
-
const shouldMerge = isSameAction && (action.action.name === "navigate" || action.action.name === "fill" && isSameSelector);
|
|
83
|
-
if (!shouldMerge) {
|
|
84
|
-
result.push(action);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const startTime = result[result.length - 1].startTime;
|
|
88
|
-
result[result.length - 1] = action;
|
|
89
|
-
result[result.length - 1].startTime = startTime;
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
-
0 && (module.exports = {
|
|
95
|
-
buildFullSelector,
|
|
96
|
-
collapseActions,
|
|
97
|
-
frameForAction,
|
|
98
|
-
mainFrameForAction,
|
|
99
|
-
metadataToCallLog
|
|
100
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var throttledFile_exports = {};
|
|
30
|
-
__export(throttledFile_exports, {
|
|
31
|
-
ThrottledFile: () => ThrottledFile
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(throttledFile_exports);
|
|
34
|
-
var import_fs = __toESM(require("fs"));
|
|
35
|
-
class ThrottledFile {
|
|
36
|
-
constructor(file) {
|
|
37
|
-
this._file = file;
|
|
38
|
-
}
|
|
39
|
-
setContent(text) {
|
|
40
|
-
this._text = text;
|
|
41
|
-
if (!this._timer)
|
|
42
|
-
this._timer = setTimeout(() => this.flush(), 250);
|
|
43
|
-
}
|
|
44
|
-
flush() {
|
|
45
|
-
if (this._timer) {
|
|
46
|
-
clearTimeout(this._timer);
|
|
47
|
-
this._timer = void 0;
|
|
48
|
-
}
|
|
49
|
-
if (this._text)
|
|
50
|
-
import_fs.default.writeFileSync(this._file, this._text);
|
|
51
|
-
this._text = void 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
ThrottledFile
|
|
57
|
-
});
|
package/lib/server/recorder.js
DELETED
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var recorder_exports = {};
|
|
30
|
-
__export(recorder_exports, {
|
|
31
|
-
Recorder: () => Recorder
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(recorder_exports);
|
|
34
|
-
var import_fs = __toESM(require("fs"));
|
|
35
|
-
var consoleApiSource = __toESM(require("../generated/consoleApiSource"));
|
|
36
|
-
var import_utils = require("../utils");
|
|
37
|
-
var import_browserContext = require("./browserContext");
|
|
38
|
-
var import_debugger = require("./debugger");
|
|
39
|
-
var import_contextRecorder = require("./recorder/contextRecorder");
|
|
40
|
-
var import_recorderUtils = require("./recorder/recorderUtils");
|
|
41
|
-
var import_locatorParser = require("../utils/isomorphic/locatorParser");
|
|
42
|
-
var import_selectorParser = require("../utils/isomorphic/selectorParser");
|
|
43
|
-
const recorderSymbol = Symbol("recorderSymbol");
|
|
44
|
-
class Recorder {
|
|
45
|
-
constructor(context, params) {
|
|
46
|
-
this._highlightedElement = {};
|
|
47
|
-
this._overlayState = { offsetX: 0 };
|
|
48
|
-
this._recorderApp = null;
|
|
49
|
-
this._currentCallsMetadata = /* @__PURE__ */ new Map();
|
|
50
|
-
this._recorderSources = [];
|
|
51
|
-
this._userSources = /* @__PURE__ */ new Map();
|
|
52
|
-
this._omitCallTracking = false;
|
|
53
|
-
this._mode = params.mode || "none";
|
|
54
|
-
this.handleSIGINT = params.handleSIGINT;
|
|
55
|
-
this._contextRecorder = new import_contextRecorder.ContextRecorder(context, params, {});
|
|
56
|
-
this._context = context;
|
|
57
|
-
this._omitCallTracking = !!params.omitCallTracking;
|
|
58
|
-
this._debugger = context.debugger();
|
|
59
|
-
context.instrumentation.addListener(this, context);
|
|
60
|
-
this._currentLanguage = this._contextRecorder.languageName();
|
|
61
|
-
if ((0, import_utils.isUnderTest)()) {
|
|
62
|
-
this._overlayState.offsetX = 200;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
static async showInspector(context, params, recorderAppFactory) {
|
|
66
|
-
if ((0, import_utils.isUnderTest)())
|
|
67
|
-
params.language = process.env.TEST_INSPECTOR_LANGUAGE;
|
|
68
|
-
return await Recorder.show(context, recorderAppFactory, params);
|
|
69
|
-
}
|
|
70
|
-
static showInspectorNoReply(context, recorderAppFactory) {
|
|
71
|
-
Recorder.showInspector(context, {}, recorderAppFactory).catch(() => {
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
static show(context, recorderAppFactory, params) {
|
|
75
|
-
let recorderPromise = context[recorderSymbol];
|
|
76
|
-
if (!recorderPromise) {
|
|
77
|
-
recorderPromise = Recorder._create(context, recorderAppFactory, params);
|
|
78
|
-
context[recorderSymbol] = recorderPromise;
|
|
79
|
-
}
|
|
80
|
-
return recorderPromise;
|
|
81
|
-
}
|
|
82
|
-
static async _create(context, recorderAppFactory, params = {}) {
|
|
83
|
-
const recorder = new Recorder(context, params);
|
|
84
|
-
const recorderApp = await recorderAppFactory(recorder);
|
|
85
|
-
await recorder._install(recorderApp);
|
|
86
|
-
return recorder;
|
|
87
|
-
}
|
|
88
|
-
async _install(recorderApp) {
|
|
89
|
-
this._recorderApp = recorderApp;
|
|
90
|
-
recorderApp.once("close", () => {
|
|
91
|
-
this._debugger.resume(false);
|
|
92
|
-
this._recorderApp = null;
|
|
93
|
-
});
|
|
94
|
-
recorderApp.on("event", (data) => {
|
|
95
|
-
if (data.event === "setMode") {
|
|
96
|
-
this.setMode(data.params.mode);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (data.event === "highlightRequested") {
|
|
100
|
-
if (data.params.selector)
|
|
101
|
-
this.setHighlightedSelector(this._currentLanguage, data.params.selector);
|
|
102
|
-
if (data.params.ariaTemplate)
|
|
103
|
-
this.setHighlightedAriaTemplate(data.params.ariaTemplate);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (data.event === "step") {
|
|
107
|
-
this._debugger.resume(true);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (data.event === "fileChanged") {
|
|
111
|
-
this._currentLanguage = this._contextRecorder.languageName(data.params.file);
|
|
112
|
-
this._refreshOverlay();
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (data.event === "resume") {
|
|
116
|
-
this._debugger.resume(false);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (data.event === "pause") {
|
|
120
|
-
this._debugger.pauseOnNextStatement();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (data.event === "clear") {
|
|
124
|
-
this._contextRecorder.clearScript();
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (data.event === "runTask") {
|
|
128
|
-
this._contextRecorder.runTask(data.params.task);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
await Promise.all([
|
|
133
|
-
recorderApp.setMode(this._mode),
|
|
134
|
-
recorderApp.setPaused(this._debugger.isPaused()),
|
|
135
|
-
this._pushAllSources()
|
|
136
|
-
]);
|
|
137
|
-
this._context.once(import_browserContext.BrowserContext.Events.Close, () => {
|
|
138
|
-
this._contextRecorder.dispose();
|
|
139
|
-
this._context.instrumentation.removeListener(this);
|
|
140
|
-
this._recorderApp?.close().catch(() => {
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
this._contextRecorder.on(import_contextRecorder.ContextRecorder.Events.Change, (data) => {
|
|
144
|
-
this._recorderSources = data.sources;
|
|
145
|
-
recorderApp.setActions(data.actions, data.sources);
|
|
146
|
-
recorderApp.setRunningFile(void 0);
|
|
147
|
-
this._pushAllSources();
|
|
148
|
-
});
|
|
149
|
-
await this._context.exposeBinding("__pw_recorderState", false, async (source) => {
|
|
150
|
-
let actionSelector;
|
|
151
|
-
let actionPoint;
|
|
152
|
-
const hasActiveScreenshotCommand = [...this._currentCallsMetadata.keys()].some(isScreenshotCommand);
|
|
153
|
-
if (!hasActiveScreenshotCommand) {
|
|
154
|
-
actionSelector = await this._scopeHighlightedSelectorToFrame(source.frame);
|
|
155
|
-
for (const [metadata, sdkObject] of this._currentCallsMetadata) {
|
|
156
|
-
if (source.page === sdkObject.attribution.page) {
|
|
157
|
-
actionPoint = metadata.point || actionPoint;
|
|
158
|
-
actionSelector = actionSelector || metadata.params.selector;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
const uiState = {
|
|
163
|
-
mode: this._mode,
|
|
164
|
-
actionPoint,
|
|
165
|
-
actionSelector,
|
|
166
|
-
ariaTemplate: this._highlightedElement.ariaTemplate,
|
|
167
|
-
language: this._currentLanguage,
|
|
168
|
-
testIdAttributeName: this._contextRecorder.testIdAttributeName(),
|
|
169
|
-
overlay: this._overlayState
|
|
170
|
-
};
|
|
171
|
-
return uiState;
|
|
172
|
-
});
|
|
173
|
-
await this._context.exposeBinding("__pw_recorderElementPicked", false, async ({ frame }, elementInfo) => {
|
|
174
|
-
const selectorChain = await (0, import_contextRecorder.generateFrameSelector)(frame);
|
|
175
|
-
await this._recorderApp?.elementPicked({ selector: (0, import_recorderUtils.buildFullSelector)(selectorChain, elementInfo.selector), ariaSnapshot: elementInfo.ariaSnapshot }, true);
|
|
176
|
-
});
|
|
177
|
-
await this._context.exposeBinding("__pw_recorderSetMode", false, async ({ frame }, mode) => {
|
|
178
|
-
if (frame.parentFrame())
|
|
179
|
-
return;
|
|
180
|
-
this.setMode(mode);
|
|
181
|
-
});
|
|
182
|
-
await this._context.exposeBinding("__pw_recorderSetOverlayState", false, async ({ frame }, state) => {
|
|
183
|
-
if (frame.parentFrame())
|
|
184
|
-
return;
|
|
185
|
-
this._overlayState = state;
|
|
186
|
-
});
|
|
187
|
-
await this._context.exposeBinding("__pw_resume", false, () => {
|
|
188
|
-
this._debugger.resume(false);
|
|
189
|
-
});
|
|
190
|
-
await this._context.extendInjectedScript(consoleApiSource.source);
|
|
191
|
-
await this._contextRecorder.install();
|
|
192
|
-
if (this._debugger.isPaused())
|
|
193
|
-
this._pausedStateChanged();
|
|
194
|
-
this._debugger.on(import_debugger.Debugger.Events.PausedStateChanged, () => this._pausedStateChanged());
|
|
195
|
-
this._context.recorderAppForTest = this._recorderApp;
|
|
196
|
-
}
|
|
197
|
-
_pausedStateChanged() {
|
|
198
|
-
for (const { metadata, sdkObject } of this._debugger.pausedDetails()) {
|
|
199
|
-
if (!this._currentCallsMetadata.has(metadata))
|
|
200
|
-
this.onBeforeCall(sdkObject, metadata);
|
|
201
|
-
}
|
|
202
|
-
this._recorderApp?.setPaused(this._debugger.isPaused());
|
|
203
|
-
this._updateUserSources();
|
|
204
|
-
this.updateCallLog([...this._currentCallsMetadata.keys()]);
|
|
205
|
-
}
|
|
206
|
-
setMode(mode) {
|
|
207
|
-
if (this._mode === mode)
|
|
208
|
-
return;
|
|
209
|
-
this._highlightedElement = {};
|
|
210
|
-
this._mode = mode;
|
|
211
|
-
this._recorderApp?.setMode(this._mode);
|
|
212
|
-
this._contextRecorder.setEnabled(this._isRecording());
|
|
213
|
-
this._debugger.setMuted(this._isRecording());
|
|
214
|
-
if (this._mode !== "none" && this._mode !== "standby" && this._context.pages().length === 1)
|
|
215
|
-
this._context.pages()[0].bringToFront().catch(() => {
|
|
216
|
-
});
|
|
217
|
-
this._refreshOverlay();
|
|
218
|
-
}
|
|
219
|
-
resume() {
|
|
220
|
-
this._debugger.resume(false);
|
|
221
|
-
}
|
|
222
|
-
mode() {
|
|
223
|
-
return this._mode;
|
|
224
|
-
}
|
|
225
|
-
setHighlightedSelector(language, selector) {
|
|
226
|
-
this._highlightedElement = { selector: (0, import_locatorParser.locatorOrSelectorAsSelector)(language, selector, this._context.selectors().testIdAttributeName()) };
|
|
227
|
-
this._refreshOverlay();
|
|
228
|
-
}
|
|
229
|
-
setHighlightedAriaTemplate(ariaTemplate) {
|
|
230
|
-
this._highlightedElement = { ariaTemplate };
|
|
231
|
-
this._refreshOverlay();
|
|
232
|
-
}
|
|
233
|
-
hideHighlightedSelector() {
|
|
234
|
-
this._highlightedElement = {};
|
|
235
|
-
this._refreshOverlay();
|
|
236
|
-
}
|
|
237
|
-
async _scopeHighlightedSelectorToFrame(frame) {
|
|
238
|
-
if (!this._highlightedElement.selector)
|
|
239
|
-
return;
|
|
240
|
-
try {
|
|
241
|
-
const mainFrame = frame._page.mainFrame();
|
|
242
|
-
const resolved = await mainFrame.selectors.resolveFrameForSelector(this._highlightedElement.selector);
|
|
243
|
-
if (!resolved)
|
|
244
|
-
return "";
|
|
245
|
-
if (resolved?.frame === mainFrame)
|
|
246
|
-
return (0, import_selectorParser.stringifySelector)(resolved.info.parsed);
|
|
247
|
-
if (resolved?.frame === frame)
|
|
248
|
-
return (0, import_selectorParser.stringifySelector)(resolved.info.parsed);
|
|
249
|
-
return "";
|
|
250
|
-
} catch {
|
|
251
|
-
return "";
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
setOutput(codegenId, outputFile) {
|
|
255
|
-
this._contextRecorder.setOutput(codegenId, outputFile);
|
|
256
|
-
}
|
|
257
|
-
_refreshOverlay() {
|
|
258
|
-
for (const page of this._context.pages()) {
|
|
259
|
-
for (const frame of page.frames())
|
|
260
|
-
frame.evaluateExpression("window.__pw_refreshOverlay()").catch(() => {
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
async onBeforeCall(sdkObject, metadata) {
|
|
265
|
-
if (this._omitCallTracking || this._isRecording())
|
|
266
|
-
return;
|
|
267
|
-
this._currentCallsMetadata.set(metadata, sdkObject);
|
|
268
|
-
this._updateUserSources();
|
|
269
|
-
this.updateCallLog([metadata]);
|
|
270
|
-
if (isScreenshotCommand(metadata))
|
|
271
|
-
this.hideHighlightedSelector();
|
|
272
|
-
else if (metadata.params && metadata.params.selector)
|
|
273
|
-
this._highlightedElement = { selector: metadata.params.selector };
|
|
274
|
-
}
|
|
275
|
-
async onAfterCall(sdkObject, metadata) {
|
|
276
|
-
if (this._omitCallTracking || this._isRecording())
|
|
277
|
-
return;
|
|
278
|
-
if (!metadata.error)
|
|
279
|
-
this._currentCallsMetadata.delete(metadata);
|
|
280
|
-
this._updateUserSources();
|
|
281
|
-
this.updateCallLog([metadata]);
|
|
282
|
-
}
|
|
283
|
-
_updateUserSources() {
|
|
284
|
-
for (const source of this._userSources.values()) {
|
|
285
|
-
source.highlight = [];
|
|
286
|
-
source.revealLine = void 0;
|
|
287
|
-
}
|
|
288
|
-
let fileToSelect = void 0;
|
|
289
|
-
for (const metadata of this._currentCallsMetadata.keys()) {
|
|
290
|
-
if (!metadata.location)
|
|
291
|
-
continue;
|
|
292
|
-
const { file, line } = metadata.location;
|
|
293
|
-
let source = this._userSources.get(file);
|
|
294
|
-
if (!source) {
|
|
295
|
-
source = { isRecorded: false, label: file, id: file, text: this._readSource(file), highlight: [], language: languageForFile(file) };
|
|
296
|
-
this._userSources.set(file, source);
|
|
297
|
-
}
|
|
298
|
-
if (line) {
|
|
299
|
-
const paused = this._debugger.isPaused(metadata);
|
|
300
|
-
source.highlight.push({ line, type: metadata.error ? "error" : paused ? "paused" : "running" });
|
|
301
|
-
source.revealLine = line;
|
|
302
|
-
fileToSelect = source.id;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
this._pushAllSources();
|
|
306
|
-
if (fileToSelect)
|
|
307
|
-
this._recorderApp?.setRunningFile(fileToSelect);
|
|
308
|
-
}
|
|
309
|
-
_pushAllSources() {
|
|
310
|
-
const primaryPage = this._context.pages()[0];
|
|
311
|
-
this._recorderApp?.setSources([...this._recorderSources, ...this._userSources.values()], primaryPage?.mainFrame().url());
|
|
312
|
-
}
|
|
313
|
-
async onBeforeInputAction(sdkObject, metadata) {
|
|
314
|
-
}
|
|
315
|
-
async onCallLog(sdkObject, metadata, logName, message) {
|
|
316
|
-
this.updateCallLog([metadata]);
|
|
317
|
-
}
|
|
318
|
-
updateCallLog(metadatas) {
|
|
319
|
-
if (this._isRecording())
|
|
320
|
-
return;
|
|
321
|
-
const logs = [];
|
|
322
|
-
for (const metadata of metadatas) {
|
|
323
|
-
if (!metadata.method || metadata.internal)
|
|
324
|
-
continue;
|
|
325
|
-
let status = "done";
|
|
326
|
-
if (this._currentCallsMetadata.has(metadata))
|
|
327
|
-
status = "in-progress";
|
|
328
|
-
if (this._debugger.isPaused(metadata))
|
|
329
|
-
status = "paused";
|
|
330
|
-
logs.push((0, import_recorderUtils.metadataToCallLog)(metadata, status));
|
|
331
|
-
}
|
|
332
|
-
this._recorderApp?.updateCallLogs(logs);
|
|
333
|
-
}
|
|
334
|
-
_isRecording() {
|
|
335
|
-
return ["recording", "assertingText", "assertingVisibility", "assertingValue", "assertingSnapshot"].includes(this._mode);
|
|
336
|
-
}
|
|
337
|
-
_readSource(fileName) {
|
|
338
|
-
try {
|
|
339
|
-
return import_fs.default.readFileSync(fileName, "utf-8");
|
|
340
|
-
} catch (e) {
|
|
341
|
-
return "// No source available";
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
function isScreenshotCommand(metadata) {
|
|
346
|
-
return metadata.method.toLowerCase().includes("screenshot");
|
|
347
|
-
}
|
|
348
|
-
function languageForFile(file) {
|
|
349
|
-
if (file.endsWith(".py"))
|
|
350
|
-
return "python";
|
|
351
|
-
if (file.endsWith(".java"))
|
|
352
|
-
return "java";
|
|
353
|
-
if (file.endsWith(".cs"))
|
|
354
|
-
return "csharp";
|
|
355
|
-
return "javascript";
|
|
356
|
-
}
|
|
357
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
358
|
-
0 && (module.exports = {
|
|
359
|
-
Recorder
|
|
360
|
-
});
|