playwright-codegen-pro-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +3 -0
- package/ThirdPartyNotices.txt +3552 -0
- package/bin/install_media_pack.ps1 +5 -0
- package/bin/install_webkit_wsl.ps1 +33 -0
- package/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/browsers.json +81 -0
- package/bundles/mcp/package-lock.json +1135 -0
- package/bundles/mcp/package.json +10 -0
- package/bundles/mcp/raw-body.ts +43 -0
- package/bundles/utils/package-lock.json +466 -0
- package/bundles/utils/package.json +40 -0
- package/bundles/zip/package-lock.json +257 -0
- package/bundles/zip/package.json +16 -0
- package/cli.js +18 -0
- package/index.d.ts +17 -0
- package/index.js +32 -0
- package/index.mjs +28 -0
- package/lib/androidServerImpl.js +65 -0
- package/lib/browserServerImpl.js +120 -0
- package/lib/cli/driver.js +98 -0
- package/lib/cli/program.js +599 -0
- package/lib/cli/programWithTestStub.js +74 -0
- package/lib/client/android.js +361 -0
- package/lib/client/api.js +137 -0
- package/lib/client/artifact.js +79 -0
- package/lib/client/browser.js +169 -0
- package/lib/client/browserContext.js +563 -0
- package/lib/client/browserType.js +153 -0
- package/lib/client/cdpSession.js +55 -0
- package/lib/client/channelOwner.js +194 -0
- package/lib/client/clientHelper.js +64 -0
- package/lib/client/clientInstrumentation.js +55 -0
- package/lib/client/clientStackTrace.js +69 -0
- package/lib/client/clock.js +68 -0
- package/lib/client/connect.js +143 -0
- package/lib/client/connection.js +322 -0
- package/lib/client/consoleMessage.js +61 -0
- package/lib/client/coverage.js +44 -0
- package/lib/client/debugger.js +57 -0
- package/lib/client/dialog.js +56 -0
- package/lib/client/disposable.js +76 -0
- package/lib/client/download.js +62 -0
- package/lib/client/electron.js +138 -0
- package/lib/client/elementHandle.js +281 -0
- package/lib/client/errors.js +77 -0
- package/lib/client/eventEmitter.js +314 -0
- package/lib/client/events.js +103 -0
- package/lib/client/fetch.js +367 -0
- package/lib/client/fileChooser.js +46 -0
- package/lib/client/fileUtils.js +34 -0
- package/lib/client/frame.js +404 -0
- package/lib/client/harRouter.js +99 -0
- package/lib/client/input.js +84 -0
- package/lib/client/jsHandle.js +105 -0
- package/lib/client/jsonPipe.js +39 -0
- package/lib/client/localUtils.js +60 -0
- package/lib/client/locator.js +367 -0
- package/lib/client/network.js +750 -0
- package/lib/client/page.js +729 -0
- package/lib/client/platform.js +77 -0
- package/lib/client/playwright.js +71 -0
- package/lib/client/screencast.js +48 -0
- package/lib/client/selectors.js +57 -0
- package/lib/client/stream.js +39 -0
- package/lib/client/timeoutSettings.js +79 -0
- package/lib/client/tracing.js +126 -0
- package/lib/client/types.js +28 -0
- package/lib/client/video.js +68 -0
- package/lib/client/waiter.js +142 -0
- package/lib/client/webError.js +39 -0
- package/lib/client/worker.js +85 -0
- package/lib/client/writableStream.js +39 -0
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +28 -0
- package/lib/generated/injectedScriptSource.js +28 -0
- package/lib/generated/pollingRecorderSource.js +28 -0
- package/lib/generated/storageScriptSource.js +28 -0
- package/lib/generated/utilityScriptSource.js +28 -0
- package/lib/generated/webSocketMockSource.js +336 -0
- package/lib/inProcessFactory.js +60 -0
- package/lib/inprocess.js +3 -0
- package/lib/mcpBundle.js +81 -0
- package/lib/mcpBundleImpl/index.js +91 -0
- package/lib/outofprocess.js +76 -0
- package/lib/protocol/serializers.js +197 -0
- package/lib/protocol/validator.js +3035 -0
- package/lib/protocol/validatorPrimitives.js +193 -0
- package/lib/remote/playwrightConnection.js +131 -0
- package/lib/remote/playwrightPipeServer.js +100 -0
- package/lib/remote/playwrightServer.js +339 -0
- package/lib/remote/playwrightWebSocketServer.js +73 -0
- package/lib/remote/serverTransport.js +96 -0
- package/lib/server/android/android.js +465 -0
- package/lib/server/android/backendAdb.js +177 -0
- package/lib/server/artifact.js +127 -0
- package/lib/server/bidi/bidiBrowser.js +571 -0
- package/lib/server/bidi/bidiChromium.js +162 -0
- package/lib/server/bidi/bidiConnection.js +213 -0
- package/lib/server/bidi/bidiDeserializer.js +116 -0
- package/lib/server/bidi/bidiExecutionContext.js +267 -0
- package/lib/server/bidi/bidiFirefox.js +128 -0
- package/lib/server/bidi/bidiInput.js +146 -0
- package/lib/server/bidi/bidiNetworkManager.js +411 -0
- package/lib/server/bidi/bidiOverCdp.js +102 -0
- package/lib/server/bidi/bidiPage.js +599 -0
- package/lib/server/bidi/bidiPdf.js +106 -0
- package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/lib/server/bidi/third_party/bidiProtocolCore.js +180 -0
- package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +261 -0
- package/lib/server/browser.js +223 -0
- package/lib/server/browserContext.js +703 -0
- package/lib/server/browserType.js +338 -0
- package/lib/server/callLog.js +82 -0
- package/lib/server/chromium/appIcon.png +0 -0
- package/lib/server/chromium/chromium.js +399 -0
- package/lib/server/chromium/chromiumSwitches.js +104 -0
- package/lib/server/chromium/crBrowser.js +532 -0
- package/lib/server/chromium/crConnection.js +197 -0
- package/lib/server/chromium/crCoverage.js +235 -0
- package/lib/server/chromium/crDevTools.js +111 -0
- package/lib/server/chromium/crDragDrop.js +131 -0
- package/lib/server/chromium/crExecutionContext.js +146 -0
- package/lib/server/chromium/crInput.js +187 -0
- package/lib/server/chromium/crNetworkManager.js +711 -0
- package/lib/server/chromium/crPage.js +1004 -0
- package/lib/server/chromium/crPdf.js +121 -0
- package/lib/server/chromium/crProtocolHelper.js +145 -0
- package/lib/server/chromium/crServiceWorker.js +137 -0
- package/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/lib/server/chromium/protocol.d.js +16 -0
- package/lib/server/clock.js +149 -0
- package/lib/server/codegen/csharp.js +327 -0
- package/lib/server/codegen/java.js +274 -0
- package/lib/server/codegen/javascript.js +247 -0
- package/lib/server/codegen/jsonl.js +52 -0
- package/lib/server/codegen/language.js +132 -0
- package/lib/server/codegen/languages.js +68 -0
- package/lib/server/codegen/python.js +279 -0
- package/lib/server/codegen/types.js +16 -0
- package/lib/server/console.js +61 -0
- package/lib/server/cookieStore.js +206 -0
- package/lib/server/debugController.js +197 -0
- package/lib/server/debugger.js +117 -0
- package/lib/server/deviceDescriptors.js +39 -0
- package/lib/server/deviceDescriptorsSource.json +1779 -0
- package/lib/server/dialog.js +116 -0
- package/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/lib/server/dispatchers/browserContextDispatcher.js +381 -0
- package/lib/server/dispatchers/browserDispatcher.js +124 -0
- package/lib/server/dispatchers/browserTypeDispatcher.js +71 -0
- package/lib/server/dispatchers/cdpSessionDispatcher.js +47 -0
- package/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/lib/server/dispatchers/debuggerDispatcher.js +80 -0
- package/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/lib/server/dispatchers/dispatcher.js +364 -0
- package/lib/server/dispatchers/disposableDispatcher.js +39 -0
- package/lib/server/dispatchers/electronDispatcher.js +90 -0
- package/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/lib/server/dispatchers/localUtilsDispatcher.js +185 -0
- package/lib/server/dispatchers/networkDispatchers.js +214 -0
- package/lib/server/dispatchers/pageDispatcher.js +430 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +164 -0
- package/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/lib/server/disposable.js +41 -0
- package/lib/server/dom.js +833 -0
- package/lib/server/download.js +71 -0
- package/lib/server/electron/electron.js +272 -0
- package/lib/server/electron/loader.js +29 -0
- package/lib/server/errors.js +69 -0
- package/lib/server/fetch.js +621 -0
- package/lib/server/fileChooser.js +43 -0
- package/lib/server/fileUploadUtils.js +84 -0
- package/lib/server/firefox/ffBrowser.js +415 -0
- package/lib/server/firefox/ffConnection.js +142 -0
- package/lib/server/firefox/ffExecutionContext.js +150 -0
- package/lib/server/firefox/ffInput.js +175 -0
- package/lib/server/firefox/ffNetworkManager.js +256 -0
- package/lib/server/firefox/ffPage.js +495 -0
- package/lib/server/firefox/firefox.js +114 -0
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/formData.js +147 -0
- package/lib/server/frameSelectors.js +160 -0
- package/lib/server/frames.js +1495 -0
- package/lib/server/har/harRecorder.js +147 -0
- package/lib/server/har/harTracer.js +608 -0
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +96 -0
- package/lib/server/index.js +58 -0
- package/lib/server/input.js +322 -0
- package/lib/server/instrumentation.js +72 -0
- package/lib/server/javascript.js +291 -0
- package/lib/server/launchApp.js +127 -0
- package/lib/server/localUtils.js +214 -0
- package/lib/server/macEditingCommands.js +143 -0
- package/lib/server/network.js +668 -0
- package/lib/server/page.js +884 -0
- package/lib/server/pipeTransport.js +89 -0
- package/lib/server/playwright.js +69 -0
- package/lib/server/progress.js +136 -0
- package/lib/server/protocolError.js +52 -0
- package/lib/server/recorder/chat.js +161 -0
- package/lib/server/recorder/networkCapture.js +282 -0
- package/lib/server/recorder/recorderApp.js +581 -0
- package/lib/server/recorder/recorderRunner.js +138 -0
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +157 -0
- package/lib/server/recorder/sessionExporter.js +40 -0
- package/lib/server/recorder/sessionPromptBuilder.js +128 -0
- package/lib/server/recorder/sessionRedactor.js +74 -0
- package/lib/server/recorder/throttledFile.js +57 -0
- package/lib/server/recorder.js +538 -0
- package/lib/server/registry/browserFetcher.js +177 -0
- package/lib/server/registry/dependencies.js +371 -0
- package/lib/server/registry/index.js +1395 -0
- package/lib/server/registry/nativeDeps.js +1281 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +127 -0
- package/lib/server/screencast.js +238 -0
- package/lib/server/screenshotter.js +333 -0
- package/lib/server/selectors.js +112 -0
- package/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/lib/server/socksInterceptor.js +95 -0
- package/lib/server/trace/recorder/snapshotter.js +147 -0
- package/lib/server/trace/recorder/snapshotterInjected.js +561 -0
- package/lib/server/trace/recorder/tracing.js +615 -0
- package/lib/server/trace/viewer/traceViewer.js +244 -0
- package/lib/server/transport.js +181 -0
- package/lib/server/types.js +28 -0
- package/lib/server/usKeyboardLayout.js +152 -0
- package/lib/server/utils/ascii.js +44 -0
- package/lib/server/utils/comparators.js +139 -0
- package/lib/server/utils/crypto.js +216 -0
- package/lib/server/utils/debug.js +42 -0
- package/lib/server/utils/debugLogger.js +122 -0
- package/lib/server/utils/disposable.js +32 -0
- package/lib/server/utils/env.js +73 -0
- package/lib/server/utils/eventsHelper.js +41 -0
- package/lib/server/utils/expectUtils.js +123 -0
- package/lib/server/utils/fileUtils.js +191 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +123 -0
- package/lib/server/utils/httpServer.js +205 -0
- package/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/lib/server/utils/image_tools/compare.js +109 -0
- package/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/lib/server/utils/image_tools/stats.js +102 -0
- package/lib/server/utils/linuxUtils.js +71 -0
- package/lib/server/utils/network.js +243 -0
- package/lib/server/utils/nodePlatform.js +154 -0
- package/lib/server/utils/pipeTransport.js +84 -0
- package/lib/server/utils/processLauncher.js +243 -0
- package/lib/server/utils/profiler.js +65 -0
- package/lib/server/utils/socksProxy.js +511 -0
- package/lib/server/utils/spawnAsync.js +41 -0
- package/lib/server/utils/task.js +51 -0
- package/lib/server/utils/userAgent.js +98 -0
- package/lib/server/utils/wsServer.js +121 -0
- package/lib/server/utils/zipFile.js +74 -0
- package/lib/server/utils/zones.js +57 -0
- package/lib/server/videoRecorder.js +133 -0
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/server/webkit/webkit.js +108 -0
- package/lib/server/webkit/wkBrowser.js +331 -0
- package/lib/server/webkit/wkConnection.js +144 -0
- package/lib/server/webkit/wkExecutionContext.js +154 -0
- package/lib/server/webkit/wkInput.js +181 -0
- package/lib/server/webkit/wkInterceptableRequest.js +197 -0
- package/lib/server/webkit/wkPage.js +1164 -0
- package/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/lib/server/webkit/wkWorkers.js +106 -0
- package/lib/serverRegistry.js +147 -0
- package/lib/third_party/pixelmatch.js +255 -0
- package/lib/tools/backend/browserBackend.js +79 -0
- package/lib/tools/backend/common.js +63 -0
- package/lib/tools/backend/config.js +41 -0
- package/lib/tools/backend/console.js +66 -0
- package/lib/tools/backend/context.js +290 -0
- package/lib/tools/backend/cookies.js +152 -0
- package/lib/tools/backend/devtools.js +69 -0
- package/lib/tools/backend/dialogs.js +59 -0
- package/lib/tools/backend/evaluate.js +64 -0
- package/lib/tools/backend/files.js +60 -0
- package/lib/tools/backend/form.js +64 -0
- package/lib/tools/backend/keyboard.js +155 -0
- package/lib/tools/backend/logFile.js +95 -0
- package/lib/tools/backend/mouse.js +168 -0
- package/lib/tools/backend/navigate.js +106 -0
- package/lib/tools/backend/network.js +135 -0
- package/lib/tools/backend/pdf.js +48 -0
- package/lib/tools/backend/recorder.js +74 -0
- package/lib/tools/backend/response.js +302 -0
- package/lib/tools/backend/route.js +140 -0
- package/lib/tools/backend/runCode.js +76 -0
- package/lib/tools/backend/screenshot.js +88 -0
- package/lib/tools/backend/sessionLog.js +74 -0
- package/lib/tools/backend/snapshot.js +208 -0
- package/lib/tools/backend/storage.js +67 -0
- package/lib/tools/backend/tab.js +445 -0
- package/lib/tools/backend/tabs.js +67 -0
- package/lib/tools/backend/tool.js +47 -0
- package/lib/tools/backend/tools.js +104 -0
- package/lib/tools/backend/tracing.js +75 -0
- package/lib/tools/backend/utils.js +83 -0
- package/lib/tools/backend/verify.js +151 -0
- package/lib/tools/backend/video.js +89 -0
- package/lib/tools/backend/wait.js +63 -0
- package/lib/tools/backend/webstorage.js +223 -0
- package/lib/tools/cli-client/cli.js +6 -0
- package/lib/tools/cli-client/help.json +101 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/program.js +382 -0
- package/lib/tools/cli-client/registry.js +176 -0
- package/lib/tools/cli-client/session.js +289 -0
- package/lib/tools/cli-client/skill/SKILL.md +326 -0
- package/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
- package/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
- package/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
- package/lib/tools/cli-client/skill/references/running-code.md +231 -0
- package/lib/tools/cli-client/skill/references/session-management.md +169 -0
- package/lib/tools/cli-client/skill/references/storage-state.md +275 -0
- package/lib/tools/cli-client/skill/references/test-generation.md +88 -0
- package/lib/tools/cli-client/skill/references/tracing.md +139 -0
- package/lib/tools/cli-client/skill/references/video-recording.md +46 -0
- package/lib/tools/cli-daemon/command.js +73 -0
- package/lib/tools/cli-daemon/commands.js +933 -0
- package/lib/tools/cli-daemon/daemon.js +178 -0
- package/lib/tools/cli-daemon/helpGenerator.js +173 -0
- package/lib/tools/cli-daemon/program.js +118 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/dashboard/dashboardApp.js +286 -0
- package/lib/tools/dashboard/dashboardController.js +296 -0
- package/lib/tools/exports.js +60 -0
- package/lib/tools/mcp/browserFactory.js +233 -0
- package/lib/tools/mcp/cdpRelay.js +353 -0
- package/lib/tools/mcp/cli-stub.js +7 -0
- package/lib/tools/mcp/config.d.js +16 -0
- package/lib/tools/mcp/config.js +401 -0
- package/lib/tools/mcp/configIni.js +189 -0
- package/lib/tools/mcp/extensionContextFactory.js +59 -0
- package/lib/tools/mcp/index.js +62 -0
- package/lib/tools/mcp/log.js +35 -0
- package/lib/tools/mcp/program.js +107 -0
- package/lib/tools/mcp/protocol.js +28 -0
- package/lib/tools/mcp/watchdog.js +44 -0
- package/lib/tools/trace/SKILL.md +163 -0
- package/lib/tools/trace/installSkill.js +48 -0
- package/lib/tools/trace/traceActions.js +142 -0
- package/lib/tools/trace/traceAttachments.js +69 -0
- package/lib/tools/trace/traceCli.js +80 -0
- package/lib/tools/trace/traceConsole.js +97 -0
- package/lib/tools/trace/traceErrors.js +55 -0
- package/lib/tools/trace/traceOpen.js +69 -0
- package/lib/tools/trace/traceParser.js +96 -0
- package/lib/tools/trace/traceRequests.js +158 -0
- package/lib/tools/trace/traceScreenshot.js +68 -0
- package/lib/tools/trace/traceSnapshot.js +149 -0
- package/lib/tools/trace/traceUtils.js +135 -0
- package/lib/tools/utils/connect.js +32 -0
- package/lib/tools/utils/mcp/http.js +152 -0
- package/lib/tools/utils/mcp/server.js +230 -0
- package/lib/tools/utils/mcp/tool.js +47 -0
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +455 -0
- package/lib/utils/isomorphic/assert.js +31 -0
- package/lib/utils/isomorphic/colors.js +72 -0
- package/lib/utils/isomorphic/cssParser.js +245 -0
- package/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/lib/utils/isomorphic/formatUtils.js +64 -0
- package/lib/utils/isomorphic/headers.js +53 -0
- package/lib/utils/isomorphic/imageUtils.js +141 -0
- package/lib/utils/isomorphic/locatorGenerators.js +689 -0
- package/lib/utils/isomorphic/locatorParser.js +176 -0
- package/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/lib/utils/isomorphic/lruCache.js +51 -0
- package/lib/utils/isomorphic/manualPromise.js +114 -0
- package/lib/utils/isomorphic/mimeType.js +464 -0
- package/lib/utils/isomorphic/multimap.js +80 -0
- package/lib/utils/isomorphic/protocolFormatter.js +81 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +347 -0
- package/lib/utils/isomorphic/rtti.js +43 -0
- package/lib/utils/isomorphic/selectorParser.js +386 -0
- package/lib/utils/isomorphic/semaphore.js +54 -0
- package/lib/utils/isomorphic/stackTrace.js +158 -0
- package/lib/utils/isomorphic/stringUtils.js +204 -0
- package/lib/utils/isomorphic/time.js +49 -0
- package/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/lib/utils/isomorphic/trace/entries.js +16 -0
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +492 -0
- package/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/lib/utils/isomorphic/trace/traceLoader.js +131 -0
- package/lib/utils/isomorphic/trace/traceModel.js +366 -0
- package/lib/utils/isomorphic/trace/traceModernizer.js +401 -0
- package/lib/utils/isomorphic/trace/traceUtils.js +58 -0
- package/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/lib/utils/isomorphic/types.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +243 -0
- package/lib/utils/isomorphic/utilityScriptSerializers.js +262 -0
- package/lib/utils/isomorphic/yaml.js +84 -0
- package/lib/utils.js +113 -0
- package/lib/utilsBundle.js +91 -0
- package/lib/utilsBundleImpl/index.js +218 -0
- package/lib/utilsBundleImpl/xdg-open +1066 -0
- package/lib/vite/dashboard/assets/index-Bn2lDGZX.js +50 -0
- package/lib/vite/dashboard/assets/index-DDWrEWMc.css +1 -0
- package/lib/vite/dashboard/index.html +28 -0
- package/lib/vite/htmlReport/index.html +89 -0
- package/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-RoSmqW0t.js +32 -0
- package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/recorder/assets/index-CLrDthbi.js +193 -0
- package/lib/vite/recorder/assets/index-OFPIkgDs.css +1 -0
- package/lib/vite/recorder/index.html +29 -0
- package/lib/vite/recorder/playwright-logo.svg +9 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-Cigrr2OM.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-ConrJv9G.js +262 -0
- package/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +1 -0
- package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/lib/vite/traceViewer/defaultSettingsView.B4dS75f0.css +1 -0
- package/lib/vite/traceViewer/index.CzXZzn5A.css +1 -0
- package/lib/vite/traceViewer/index.EVGp-u_4.js +2 -0
- package/lib/vite/traceViewer/index.html +43 -0
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/lib/vite/traceViewer/snapshot.html +21 -0
- package/lib/vite/traceViewer/sw.bundle.js +5 -0
- package/lib/vite/traceViewer/uiMode.Bewj7-uD.js +6 -0
- package/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/lib/vite/traceViewer/uiMode.html +17 -0
- package/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/lib/zipBundle.js +34 -0
- package/lib/zipBundleImpl.js +5 -0
- package/package.json +46 -0
- package/types/protocol.d.ts +24365 -0
- package/types/structs.d.ts +45 -0
- package/types/types.d.ts +23498 -0
|
@@ -0,0 +1,401 @@
|
|
|
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 config_exports = {};
|
|
30
|
+
__export(config_exports, {
|
|
31
|
+
commaSeparatedList: () => commaSeparatedList,
|
|
32
|
+
configFromCLIOptions: () => configFromCLIOptions,
|
|
33
|
+
configFromEnv: () => configFromEnv,
|
|
34
|
+
defaultConfig: () => defaultConfig,
|
|
35
|
+
dotenvFileLoader: () => dotenvFileLoader,
|
|
36
|
+
enumParser: () => enumParser,
|
|
37
|
+
headerParser: () => headerParser,
|
|
38
|
+
loadConfig: () => loadConfig,
|
|
39
|
+
mergeConfig: () => mergeConfig,
|
|
40
|
+
numberParser: () => numberParser,
|
|
41
|
+
resolutionParser: () => resolutionParser,
|
|
42
|
+
resolveCLIConfig: () => resolveCLIConfig,
|
|
43
|
+
resolveConfig: () => resolveConfig,
|
|
44
|
+
semicolonSeparatedList: () => semicolonSeparatedList,
|
|
45
|
+
validateConfig: () => validateConfig
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(config_exports);
|
|
48
|
+
var import_fs = __toESM(require("fs"));
|
|
49
|
+
var import_os = __toESM(require("os"));
|
|
50
|
+
var import__ = require("../../..");
|
|
51
|
+
var import_utilsBundle = require("../../utilsBundle");
|
|
52
|
+
var import_configIni = require("./configIni");
|
|
53
|
+
async function fileExistsAsync(resolved) {
|
|
54
|
+
try {
|
|
55
|
+
return (await import_fs.default.promises.stat(resolved)).isFile();
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const defaultConfig = {
|
|
61
|
+
browser: {
|
|
62
|
+
browserName: "chromium",
|
|
63
|
+
launchOptions: {
|
|
64
|
+
channel: "chrome",
|
|
65
|
+
headless: import_os.default.platform() === "linux" && !process.env.DISPLAY
|
|
66
|
+
},
|
|
67
|
+
contextOptions: {
|
|
68
|
+
viewport: null
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
server: {},
|
|
72
|
+
timeouts: {
|
|
73
|
+
action: 5e3,
|
|
74
|
+
navigation: 6e4,
|
|
75
|
+
expect: 5e3
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
async function resolveConfig(config) {
|
|
79
|
+
return mergeConfig(defaultConfig, config);
|
|
80
|
+
}
|
|
81
|
+
async function resolveCLIConfig(cliOptions) {
|
|
82
|
+
const envOverrides = configFromEnv();
|
|
83
|
+
const cliOverrides = configFromCLIOptions(cliOptions);
|
|
84
|
+
const configFile = cliOverrides.configFile ?? envOverrides.configFile;
|
|
85
|
+
const configInFile = await loadConfig(configFile);
|
|
86
|
+
let result = defaultConfig;
|
|
87
|
+
result = mergeConfig(result, configInFile);
|
|
88
|
+
result = mergeConfig(result, envOverrides);
|
|
89
|
+
result = mergeConfig(result, cliOverrides);
|
|
90
|
+
result.configFile = configFile;
|
|
91
|
+
await validateConfig(result);
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
async function validateConfig(config) {
|
|
95
|
+
if (config.browser.browserName === "chromium" && config.browser.launchOptions.chromiumSandbox === void 0) {
|
|
96
|
+
if (process.platform === "linux")
|
|
97
|
+
config.browser.launchOptions.chromiumSandbox = config.browser.launchOptions.channel !== "chromium" && config.browser.launchOptions.channel !== "chrome-for-testing";
|
|
98
|
+
else
|
|
99
|
+
config.browser.launchOptions.chromiumSandbox = true;
|
|
100
|
+
}
|
|
101
|
+
if (config.browser.isolated && config.browser.userDataDir)
|
|
102
|
+
throw new Error("Browser userDataDir is not supported in isolated mode.");
|
|
103
|
+
if (config.browser.initScript) {
|
|
104
|
+
for (const script of config.browser.initScript) {
|
|
105
|
+
if (!await fileExistsAsync(script))
|
|
106
|
+
throw new Error(`Init script file does not exist: ${script}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (config.browser.initPage) {
|
|
110
|
+
for (const page of config.browser.initPage) {
|
|
111
|
+
if (!await fileExistsAsync(page))
|
|
112
|
+
throw new Error(`Init page file does not exist: ${page}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function configFromCLIOptions(cliOptions) {
|
|
117
|
+
let browserName;
|
|
118
|
+
let channel;
|
|
119
|
+
switch (cliOptions.browser) {
|
|
120
|
+
case "chrome":
|
|
121
|
+
case "chrome-beta":
|
|
122
|
+
case "chrome-canary":
|
|
123
|
+
case "chrome-dev":
|
|
124
|
+
case "msedge":
|
|
125
|
+
case "msedge-beta":
|
|
126
|
+
case "msedge-canary":
|
|
127
|
+
case "msedge-dev":
|
|
128
|
+
browserName = "chromium";
|
|
129
|
+
channel = cliOptions.browser;
|
|
130
|
+
break;
|
|
131
|
+
case "chromium":
|
|
132
|
+
browserName = "chromium";
|
|
133
|
+
channel = "chrome-for-testing";
|
|
134
|
+
break;
|
|
135
|
+
case "firefox":
|
|
136
|
+
browserName = "firefox";
|
|
137
|
+
break;
|
|
138
|
+
case "webkit":
|
|
139
|
+
browserName = "webkit";
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
const launchOptions = {
|
|
143
|
+
channel,
|
|
144
|
+
executablePath: cliOptions.executablePath,
|
|
145
|
+
headless: cliOptions.headless
|
|
146
|
+
};
|
|
147
|
+
if (cliOptions.sandbox !== void 0)
|
|
148
|
+
launchOptions.chromiumSandbox = cliOptions.sandbox;
|
|
149
|
+
if (cliOptions.proxyServer) {
|
|
150
|
+
launchOptions.proxy = {
|
|
151
|
+
server: cliOptions.proxyServer
|
|
152
|
+
};
|
|
153
|
+
if (cliOptions.proxyBypass)
|
|
154
|
+
launchOptions.proxy.bypass = cliOptions.proxyBypass;
|
|
155
|
+
}
|
|
156
|
+
if (cliOptions.device && cliOptions.cdpEndpoint)
|
|
157
|
+
throw new Error("Device emulation is not supported with cdpEndpoint.");
|
|
158
|
+
const contextOptions = cliOptions.device ? import__.devices[cliOptions.device] : {};
|
|
159
|
+
if (cliOptions.storageState)
|
|
160
|
+
contextOptions.storageState = cliOptions.storageState;
|
|
161
|
+
if (cliOptions.userAgent)
|
|
162
|
+
contextOptions.userAgent = cliOptions.userAgent;
|
|
163
|
+
if (cliOptions.viewportSize)
|
|
164
|
+
contextOptions.viewport = cliOptions.viewportSize;
|
|
165
|
+
if (cliOptions.ignoreHttpsErrors)
|
|
166
|
+
contextOptions.ignoreHTTPSErrors = true;
|
|
167
|
+
if (cliOptions.blockServiceWorkers)
|
|
168
|
+
contextOptions.serviceWorkers = "block";
|
|
169
|
+
if (cliOptions.grantPermissions)
|
|
170
|
+
contextOptions.permissions = cliOptions.grantPermissions;
|
|
171
|
+
const config = {
|
|
172
|
+
browser: {
|
|
173
|
+
browserName,
|
|
174
|
+
isolated: cliOptions.isolated,
|
|
175
|
+
userDataDir: cliOptions.userDataDir,
|
|
176
|
+
launchOptions,
|
|
177
|
+
contextOptions,
|
|
178
|
+
cdpEndpoint: cliOptions.cdpEndpoint,
|
|
179
|
+
cdpHeaders: cliOptions.cdpHeader,
|
|
180
|
+
cdpTimeout: cliOptions.cdpTimeout,
|
|
181
|
+
initPage: cliOptions.initPage,
|
|
182
|
+
initScript: cliOptions.initScript
|
|
183
|
+
},
|
|
184
|
+
extension: cliOptions.extension,
|
|
185
|
+
server: {
|
|
186
|
+
port: cliOptions.port,
|
|
187
|
+
host: cliOptions.host,
|
|
188
|
+
allowedHosts: cliOptions.allowedHosts
|
|
189
|
+
},
|
|
190
|
+
capabilities: cliOptions.caps,
|
|
191
|
+
console: {
|
|
192
|
+
level: cliOptions.consoleLevel
|
|
193
|
+
},
|
|
194
|
+
network: {
|
|
195
|
+
allowedOrigins: cliOptions.allowedOrigins,
|
|
196
|
+
blockedOrigins: cliOptions.blockedOrigins
|
|
197
|
+
},
|
|
198
|
+
allowUnrestrictedFileAccess: cliOptions.allowUnrestrictedFileAccess,
|
|
199
|
+
codegen: cliOptions.codegen,
|
|
200
|
+
saveSession: cliOptions.saveSession,
|
|
201
|
+
secrets: cliOptions.secrets,
|
|
202
|
+
sharedBrowserContext: cliOptions.sharedBrowserContext,
|
|
203
|
+
snapshot: cliOptions.snapshotMode ? { mode: cliOptions.snapshotMode } : void 0,
|
|
204
|
+
outputDir: cliOptions.outputDir,
|
|
205
|
+
imageResponses: cliOptions.imageResponses,
|
|
206
|
+
testIdAttribute: cliOptions.testIdAttribute,
|
|
207
|
+
timeouts: {
|
|
208
|
+
action: cliOptions.timeoutAction,
|
|
209
|
+
navigation: cliOptions.timeoutNavigation
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
return { ...config, configFile: cliOptions.config };
|
|
213
|
+
}
|
|
214
|
+
function configFromEnv() {
|
|
215
|
+
const options = {};
|
|
216
|
+
options.allowedHosts = commaSeparatedList(process.env.PLAYWRIGHT_MCP_ALLOWED_HOSTS);
|
|
217
|
+
options.allowedOrigins = semicolonSeparatedList(process.env.PLAYWRIGHT_MCP_ALLOWED_ORIGINS);
|
|
218
|
+
options.allowUnrestrictedFileAccess = envToBoolean(process.env.PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS);
|
|
219
|
+
options.blockedOrigins = semicolonSeparatedList(process.env.PLAYWRIGHT_MCP_BLOCKED_ORIGINS);
|
|
220
|
+
options.blockServiceWorkers = envToBoolean(process.env.PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS);
|
|
221
|
+
options.browser = envToString(process.env.PLAYWRIGHT_MCP_BROWSER);
|
|
222
|
+
options.caps = commaSeparatedList(process.env.PLAYWRIGHT_MCP_CAPS);
|
|
223
|
+
options.cdpEndpoint = envToString(process.env.PLAYWRIGHT_MCP_CDP_ENDPOINT);
|
|
224
|
+
options.cdpHeader = headerParser(process.env.PLAYWRIGHT_MCP_CDP_HEADERS, {});
|
|
225
|
+
options.cdpTimeout = numberParser(process.env.PLAYWRIGHT_MCP_CDP_TIMEOUT);
|
|
226
|
+
options.config = envToString(process.env.PLAYWRIGHT_MCP_CONFIG);
|
|
227
|
+
if (process.env.PLAYWRIGHT_MCP_CONSOLE_LEVEL)
|
|
228
|
+
options.consoleLevel = enumParser("--console-level", ["error", "warning", "info", "debug"], process.env.PLAYWRIGHT_MCP_CONSOLE_LEVEL);
|
|
229
|
+
options.device = envToString(process.env.PLAYWRIGHT_MCP_DEVICE);
|
|
230
|
+
options.executablePath = envToString(process.env.PLAYWRIGHT_MCP_EXECUTABLE_PATH);
|
|
231
|
+
options.extension = envToBoolean(process.env.PLAYWRIGHT_MCP_EXTENSION);
|
|
232
|
+
options.grantPermissions = commaSeparatedList(process.env.PLAYWRIGHT_MCP_GRANT_PERMISSIONS);
|
|
233
|
+
options.headless = envToBoolean(process.env.PLAYWRIGHT_MCP_HEADLESS);
|
|
234
|
+
options.host = envToString(process.env.PLAYWRIGHT_MCP_HOST);
|
|
235
|
+
options.ignoreHttpsErrors = envToBoolean(process.env.PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS);
|
|
236
|
+
const initPage = envToString(process.env.PLAYWRIGHT_MCP_INIT_PAGE);
|
|
237
|
+
if (initPage)
|
|
238
|
+
options.initPage = [initPage];
|
|
239
|
+
const initScript = envToString(process.env.PLAYWRIGHT_MCP_INIT_SCRIPT);
|
|
240
|
+
if (initScript)
|
|
241
|
+
options.initScript = [initScript];
|
|
242
|
+
options.isolated = envToBoolean(process.env.PLAYWRIGHT_MCP_ISOLATED);
|
|
243
|
+
if (process.env.PLAYWRIGHT_MCP_IMAGE_RESPONSES)
|
|
244
|
+
options.imageResponses = enumParser("--image-responses", ["allow", "omit"], process.env.PLAYWRIGHT_MCP_IMAGE_RESPONSES);
|
|
245
|
+
options.sandbox = envToBoolean(process.env.PLAYWRIGHT_MCP_SANDBOX);
|
|
246
|
+
options.outputDir = envToString(process.env.PLAYWRIGHT_MCP_OUTPUT_DIR);
|
|
247
|
+
options.port = numberParser(process.env.PLAYWRIGHT_MCP_PORT);
|
|
248
|
+
options.proxyBypass = envToString(process.env.PLAYWRIGHT_MCP_PROXY_BYPASS);
|
|
249
|
+
options.proxyServer = envToString(process.env.PLAYWRIGHT_MCP_PROXY_SERVER);
|
|
250
|
+
options.secrets = dotenvFileLoader(process.env.PLAYWRIGHT_MCP_SECRETS_FILE);
|
|
251
|
+
options.storageState = envToString(process.env.PLAYWRIGHT_MCP_STORAGE_STATE);
|
|
252
|
+
options.testIdAttribute = envToString(process.env.PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE);
|
|
253
|
+
options.timeoutAction = numberParser(process.env.PLAYWRIGHT_MCP_TIMEOUT_ACTION);
|
|
254
|
+
options.timeoutNavigation = numberParser(process.env.PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION);
|
|
255
|
+
options.userAgent = envToString(process.env.PLAYWRIGHT_MCP_USER_AGENT);
|
|
256
|
+
options.userDataDir = envToString(process.env.PLAYWRIGHT_MCP_USER_DATA_DIR);
|
|
257
|
+
options.viewportSize = resolutionParser("--viewport-size", process.env.PLAYWRIGHT_MCP_VIEWPORT_SIZE);
|
|
258
|
+
return configFromCLIOptions(options);
|
|
259
|
+
}
|
|
260
|
+
async function loadConfig(configFile) {
|
|
261
|
+
if (!configFile)
|
|
262
|
+
return {};
|
|
263
|
+
if (configFile.endsWith(".ini"))
|
|
264
|
+
return (0, import_configIni.configFromIniFile)(configFile);
|
|
265
|
+
try {
|
|
266
|
+
const data = await import_fs.default.promises.readFile(configFile, "utf8");
|
|
267
|
+
return JSON.parse(data.charCodeAt(0) === 65279 ? data.slice(1) : data);
|
|
268
|
+
} catch {
|
|
269
|
+
return (0, import_configIni.configFromIniFile)(configFile);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function pickDefined(obj) {
|
|
273
|
+
return Object.fromEntries(
|
|
274
|
+
Object.entries(obj ?? {}).filter(([_, v]) => v !== void 0)
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
function mergeConfig(base, overrides) {
|
|
278
|
+
const browser = {
|
|
279
|
+
...pickDefined(base.browser),
|
|
280
|
+
...pickDefined(overrides.browser),
|
|
281
|
+
browserName: overrides.browser?.browserName ?? base.browser?.browserName ?? "chromium",
|
|
282
|
+
isolated: overrides.browser?.isolated ?? base.browser?.isolated,
|
|
283
|
+
launchOptions: {
|
|
284
|
+
...pickDefined(base.browser?.launchOptions),
|
|
285
|
+
...pickDefined(overrides.browser?.launchOptions),
|
|
286
|
+
// Assistant mode is not a part of the public API.
|
|
287
|
+
...{ assistantMode: true }
|
|
288
|
+
},
|
|
289
|
+
contextOptions: {
|
|
290
|
+
...pickDefined(base.browser?.contextOptions),
|
|
291
|
+
...pickDefined(overrides.browser?.contextOptions)
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
if (browser.browserName !== "chromium" && browser.launchOptions)
|
|
295
|
+
delete browser.launchOptions.channel;
|
|
296
|
+
return {
|
|
297
|
+
...pickDefined(base),
|
|
298
|
+
...pickDefined(overrides),
|
|
299
|
+
browser,
|
|
300
|
+
console: {
|
|
301
|
+
...pickDefined(base.console),
|
|
302
|
+
...pickDefined(overrides.console)
|
|
303
|
+
},
|
|
304
|
+
network: {
|
|
305
|
+
...pickDefined(base.network),
|
|
306
|
+
...pickDefined(overrides.network)
|
|
307
|
+
},
|
|
308
|
+
server: {
|
|
309
|
+
...pickDefined(base.server),
|
|
310
|
+
...pickDefined(overrides.server)
|
|
311
|
+
},
|
|
312
|
+
snapshot: {
|
|
313
|
+
...pickDefined(base.snapshot),
|
|
314
|
+
...pickDefined(overrides.snapshot)
|
|
315
|
+
},
|
|
316
|
+
timeouts: {
|
|
317
|
+
...pickDefined(base.timeouts),
|
|
318
|
+
...pickDefined(overrides.timeouts)
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function semicolonSeparatedList(value) {
|
|
323
|
+
if (!value)
|
|
324
|
+
return void 0;
|
|
325
|
+
return value.split(";").map((v) => v.trim());
|
|
326
|
+
}
|
|
327
|
+
function commaSeparatedList(value) {
|
|
328
|
+
if (!value)
|
|
329
|
+
return void 0;
|
|
330
|
+
return value.split(",").map((v) => v.trim());
|
|
331
|
+
}
|
|
332
|
+
function dotenvFileLoader(value) {
|
|
333
|
+
if (!value)
|
|
334
|
+
return void 0;
|
|
335
|
+
return import_utilsBundle.dotenv.parse(import_fs.default.readFileSync(value, "utf8"));
|
|
336
|
+
}
|
|
337
|
+
function numberParser(value) {
|
|
338
|
+
if (!value)
|
|
339
|
+
return void 0;
|
|
340
|
+
return +value;
|
|
341
|
+
}
|
|
342
|
+
function resolutionParser(name, value) {
|
|
343
|
+
if (!value)
|
|
344
|
+
return void 0;
|
|
345
|
+
if (value.includes("x")) {
|
|
346
|
+
const [width, height] = value.split("x").map((v) => +v);
|
|
347
|
+
if (isNaN(width) || isNaN(height) || width <= 0 || height <= 0)
|
|
348
|
+
throw new Error(`Invalid resolution format: use ${name}="800x600"`);
|
|
349
|
+
return { width, height };
|
|
350
|
+
}
|
|
351
|
+
if (value.includes(",")) {
|
|
352
|
+
const [width, height] = value.split(",").map((v) => +v);
|
|
353
|
+
if (isNaN(width) || isNaN(height) || width <= 0 || height <= 0)
|
|
354
|
+
throw new Error(`Invalid resolution format: use ${name}="800x600"`);
|
|
355
|
+
return { width, height };
|
|
356
|
+
}
|
|
357
|
+
throw new Error(`Invalid resolution format: use ${name}="800x600"`);
|
|
358
|
+
}
|
|
359
|
+
function headerParser(arg, previous) {
|
|
360
|
+
if (!arg)
|
|
361
|
+
return previous || {};
|
|
362
|
+
const result = previous || {};
|
|
363
|
+
const colonIndex = arg.indexOf(":");
|
|
364
|
+
const name = colonIndex === -1 ? arg.trim() : arg.substring(0, colonIndex).trim();
|
|
365
|
+
const value = colonIndex === -1 ? "" : arg.substring(colonIndex + 1).trim();
|
|
366
|
+
result[name] = value;
|
|
367
|
+
return result;
|
|
368
|
+
}
|
|
369
|
+
function enumParser(name, options, value) {
|
|
370
|
+
if (!options.includes(value))
|
|
371
|
+
throw new Error(`Invalid ${name}: ${value}. Valid values are: ${options.join(", ")}`);
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
function envToBoolean(value) {
|
|
375
|
+
if (value === "true" || value === "1")
|
|
376
|
+
return true;
|
|
377
|
+
if (value === "false" || value === "0")
|
|
378
|
+
return false;
|
|
379
|
+
return void 0;
|
|
380
|
+
}
|
|
381
|
+
function envToString(value) {
|
|
382
|
+
return value ? value.trim() : void 0;
|
|
383
|
+
}
|
|
384
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
385
|
+
0 && (module.exports = {
|
|
386
|
+
commaSeparatedList,
|
|
387
|
+
configFromCLIOptions,
|
|
388
|
+
configFromEnv,
|
|
389
|
+
defaultConfig,
|
|
390
|
+
dotenvFileLoader,
|
|
391
|
+
enumParser,
|
|
392
|
+
headerParser,
|
|
393
|
+
loadConfig,
|
|
394
|
+
mergeConfig,
|
|
395
|
+
numberParser,
|
|
396
|
+
resolutionParser,
|
|
397
|
+
resolveCLIConfig,
|
|
398
|
+
resolveConfig,
|
|
399
|
+
semicolonSeparatedList,
|
|
400
|
+
validateConfig
|
|
401
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
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 configIni_exports = {};
|
|
30
|
+
__export(configIni_exports, {
|
|
31
|
+
configFromIniFile: () => configFromIniFile,
|
|
32
|
+
configsFromIniFile: () => configsFromIniFile
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(configIni_exports);
|
|
35
|
+
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_utilsBundle = require("../../utilsBundle");
|
|
37
|
+
function configFromIniFile(filePath) {
|
|
38
|
+
const content = import_fs.default.readFileSync(filePath, "utf8");
|
|
39
|
+
const parsed = import_utilsBundle.ini.parse(content);
|
|
40
|
+
return iniEntriesToConfig(parsed);
|
|
41
|
+
}
|
|
42
|
+
function configsFromIniFile(filePath) {
|
|
43
|
+
const content = import_fs.default.readFileSync(filePath, "utf8");
|
|
44
|
+
const parsed = import_utilsBundle.ini.parse(content);
|
|
45
|
+
const result = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const [sectionName, sectionData] of Object.entries(parsed)) {
|
|
47
|
+
if (typeof sectionData !== "object" || sectionData === null)
|
|
48
|
+
continue;
|
|
49
|
+
result.set(sectionName, iniEntriesToConfig(sectionData));
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
function iniEntriesToConfig(entries) {
|
|
54
|
+
const config = {};
|
|
55
|
+
for (const [targetPath, rawValue] of Object.entries(entries)) {
|
|
56
|
+
const type = longhandTypes[targetPath];
|
|
57
|
+
const value = type ? coerceToType(rawValue, type) : coerceIniValue(rawValue);
|
|
58
|
+
setNestedValue(config, targetPath, value);
|
|
59
|
+
}
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
function coerceToType(value, type) {
|
|
63
|
+
switch (type) {
|
|
64
|
+
case "string":
|
|
65
|
+
return String(value);
|
|
66
|
+
case "number":
|
|
67
|
+
return Number(value);
|
|
68
|
+
case "boolean":
|
|
69
|
+
if (typeof value === "boolean")
|
|
70
|
+
return value;
|
|
71
|
+
return value === "true" || value === "1";
|
|
72
|
+
case "string[]":
|
|
73
|
+
if (Array.isArray(value))
|
|
74
|
+
return value.map(String);
|
|
75
|
+
return [String(value)];
|
|
76
|
+
case "size": {
|
|
77
|
+
if (typeof value === "string" && value.includes("x")) {
|
|
78
|
+
const [w, h] = value.split("x").map(Number);
|
|
79
|
+
if (!isNaN(w) && !isNaN(h) && w > 0 && h > 0)
|
|
80
|
+
return { width: w, height: h };
|
|
81
|
+
}
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function coerceIniValue(value) {
|
|
87
|
+
if (typeof value !== "string")
|
|
88
|
+
return value;
|
|
89
|
+
const trimmed = value.trim();
|
|
90
|
+
if (trimmed === "")
|
|
91
|
+
return trimmed;
|
|
92
|
+
const num = Number(trimmed);
|
|
93
|
+
if (!isNaN(num))
|
|
94
|
+
return num;
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
function setNestedValue(obj, dotPath, value) {
|
|
98
|
+
const parts = dotPath.split(".");
|
|
99
|
+
let current = obj;
|
|
100
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
101
|
+
const part = parts[i];
|
|
102
|
+
if (!(part in current) || typeof current[part] !== "object" || current[part] === null)
|
|
103
|
+
current[part] = {};
|
|
104
|
+
current = current[part];
|
|
105
|
+
}
|
|
106
|
+
current[parts[parts.length - 1]] = value;
|
|
107
|
+
}
|
|
108
|
+
const longhandTypes = {
|
|
109
|
+
// browser direct
|
|
110
|
+
"browser.browserName": "string",
|
|
111
|
+
"browser.isolated": "boolean",
|
|
112
|
+
"browser.userDataDir": "string",
|
|
113
|
+
"browser.cdpEndpoint": "string",
|
|
114
|
+
"browser.cdpTimeout": "number",
|
|
115
|
+
"browser.remoteEndpoint": "string",
|
|
116
|
+
"browser.initPage": "string[]",
|
|
117
|
+
"browser.initScript": "string[]",
|
|
118
|
+
// browser.launchOptions
|
|
119
|
+
"browser.launchOptions.channel": "string",
|
|
120
|
+
"browser.launchOptions.headless": "boolean",
|
|
121
|
+
"browser.launchOptions.executablePath": "string",
|
|
122
|
+
"browser.launchOptions.chromiumSandbox": "boolean",
|
|
123
|
+
"browser.launchOptions.args": "string[]",
|
|
124
|
+
"browser.launchOptions.downloadsPath": "string",
|
|
125
|
+
"browser.launchOptions.handleSIGHUP": "boolean",
|
|
126
|
+
"browser.launchOptions.handleSIGINT": "boolean",
|
|
127
|
+
"browser.launchOptions.handleSIGTERM": "boolean",
|
|
128
|
+
"browser.launchOptions.slowMo": "number",
|
|
129
|
+
"browser.launchOptions.timeout": "number",
|
|
130
|
+
"browser.launchOptions.tracesDir": "string",
|
|
131
|
+
"browser.launchOptions.proxy.server": "string",
|
|
132
|
+
"browser.launchOptions.proxy.bypass": "string",
|
|
133
|
+
"browser.launchOptions.proxy.username": "string",
|
|
134
|
+
"browser.launchOptions.proxy.password": "string",
|
|
135
|
+
// browser.contextOptions
|
|
136
|
+
"browser.contextOptions.acceptDownloads": "boolean",
|
|
137
|
+
"browser.contextOptions.baseURL": "string",
|
|
138
|
+
"browser.contextOptions.bypassCSP": "boolean",
|
|
139
|
+
"browser.contextOptions.colorScheme": "string",
|
|
140
|
+
"browser.contextOptions.contrast": "string",
|
|
141
|
+
"browser.contextOptions.deviceScaleFactor": "number",
|
|
142
|
+
"browser.contextOptions.forcedColors": "string",
|
|
143
|
+
"browser.contextOptions.hasTouch": "boolean",
|
|
144
|
+
"browser.contextOptions.ignoreHTTPSErrors": "boolean",
|
|
145
|
+
"browser.contextOptions.isMobile": "boolean",
|
|
146
|
+
"browser.contextOptions.javaScriptEnabled": "boolean",
|
|
147
|
+
"browser.contextOptions.locale": "string",
|
|
148
|
+
"browser.contextOptions.offline": "boolean",
|
|
149
|
+
"browser.contextOptions.permissions": "string[]",
|
|
150
|
+
"browser.contextOptions.reducedMotion": "string",
|
|
151
|
+
"browser.contextOptions.screen": "size",
|
|
152
|
+
"browser.contextOptions.serviceWorkers": "string",
|
|
153
|
+
"browser.contextOptions.storageState": "string",
|
|
154
|
+
"browser.contextOptions.strictSelectors": "boolean",
|
|
155
|
+
"browser.contextOptions.timezoneId": "string",
|
|
156
|
+
"browser.contextOptions.userAgent": "string",
|
|
157
|
+
"browser.contextOptions.viewport": "size",
|
|
158
|
+
// top-level
|
|
159
|
+
"extension": "boolean",
|
|
160
|
+
"capabilities": "string[]",
|
|
161
|
+
"saveSession": "boolean",
|
|
162
|
+
"saveTrace": "boolean",
|
|
163
|
+
"saveVideo": "size",
|
|
164
|
+
"sharedBrowserContext": "boolean",
|
|
165
|
+
"outputDir": "string",
|
|
166
|
+
"imageResponses": "string",
|
|
167
|
+
"allowUnrestrictedFileAccess": "boolean",
|
|
168
|
+
"codegen": "string",
|
|
169
|
+
"testIdAttribute": "string",
|
|
170
|
+
// server
|
|
171
|
+
"server.port": "number",
|
|
172
|
+
"server.host": "string",
|
|
173
|
+
"server.allowedHosts": "string[]",
|
|
174
|
+
// console
|
|
175
|
+
"console.level": "string",
|
|
176
|
+
// network
|
|
177
|
+
"network.allowedOrigins": "string[]",
|
|
178
|
+
"network.blockedOrigins": "string[]",
|
|
179
|
+
// timeouts
|
|
180
|
+
"timeouts.action": "number",
|
|
181
|
+
"timeouts.navigation": "number",
|
|
182
|
+
// snapshot
|
|
183
|
+
"snapshot.mode": "string"
|
|
184
|
+
};
|
|
185
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
186
|
+
0 && (module.exports = {
|
|
187
|
+
configFromIniFile,
|
|
188
|
+
configsFromIniFile
|
|
189
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
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 extensionContextFactory_exports = {};
|
|
30
|
+
__export(extensionContextFactory_exports, {
|
|
31
|
+
createExtensionBrowser: () => createExtensionBrowser
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(extensionContextFactory_exports);
|
|
34
|
+
var playwright = __toESM(require("../../.."));
|
|
35
|
+
var import_utilsBundle = require("../../utilsBundle");
|
|
36
|
+
var import_network = require("../../server/utils/network");
|
|
37
|
+
var import_cdpRelay = require("./cdpRelay");
|
|
38
|
+
const debugLogger = (0, import_utilsBundle.debug)("pw:mcp:relay");
|
|
39
|
+
async function createExtensionBrowser(config, clientInfo) {
|
|
40
|
+
const httpServer = (0, import_network.createHttpServer)();
|
|
41
|
+
await (0, import_network.startHttpServer)(httpServer, {});
|
|
42
|
+
const relay = new import_cdpRelay.CDPRelayServer(
|
|
43
|
+
httpServer,
|
|
44
|
+
config.browser.launchOptions.channel || "chrome",
|
|
45
|
+
config.browser.userDataDir,
|
|
46
|
+
config.browser.launchOptions.executablePath
|
|
47
|
+
);
|
|
48
|
+
debugLogger(`CDP relay server started, extension endpoint: ${relay.extensionEndpoint()}.`);
|
|
49
|
+
await relay.ensureExtensionConnectionForMCPContext(
|
|
50
|
+
clientInfo,
|
|
51
|
+
/* forceNewTab */
|
|
52
|
+
false
|
|
53
|
+
);
|
|
54
|
+
return await playwright.chromium.connectOverCDP(relay.cdpEndpoint(), { isLocal: true });
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
createExtensionBrowser
|
|
59
|
+
});
|