@browsermation/browser-engine 0.0.12 → 0.0.16
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/dist/node_modules/playwright/LICENSE +202 -0
- package/dist/node_modules/playwright/NOTICE +5 -0
- package/dist/node_modules/playwright/README.md +168 -0
- package/dist/node_modules/playwright/ThirdPartyNotices.txt +6197 -0
- package/dist/node_modules/playwright/cli.js +19 -0
- package/dist/node_modules/playwright/index.d.ts +17 -0
- package/dist/node_modules/playwright/index.js +17 -0
- package/dist/node_modules/playwright/index.mjs +18 -0
- package/dist/node_modules/playwright/jsx-runtime.js +42 -0
- package/dist/node_modules/playwright/jsx-runtime.mjs +21 -0
- package/dist/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
- package/dist/node_modules/playwright/lib/agents/generateAgents.js +395 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +55 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +72 -0
- package/dist/node_modules/playwright/lib/common/config.js +280 -0
- package/dist/node_modules/playwright/lib/common/configLoader.js +344 -0
- package/dist/node_modules/playwright/lib/common/esmLoaderHost.js +102 -0
- package/dist/node_modules/playwright/lib/common/expectBundle.js +43 -0
- package/dist/node_modules/playwright/lib/common/expectBundleImpl.js +407 -0
- package/dist/node_modules/playwright/lib/common/fixtures.js +302 -0
- package/dist/node_modules/playwright/lib/common/globals.js +58 -0
- package/dist/node_modules/playwright/lib/common/ipc.js +60 -0
- package/dist/node_modules/playwright/lib/common/poolBuilder.js +85 -0
- package/dist/node_modules/playwright/lib/common/process.js +104 -0
- package/dist/node_modules/playwright/lib/common/suiteUtils.js +140 -0
- package/dist/node_modules/playwright/lib/common/test.js +321 -0
- package/dist/node_modules/playwright/lib/common/testLoader.js +101 -0
- package/dist/node_modules/playwright/lib/common/testType.js +298 -0
- package/dist/node_modules/playwright/lib/common/validators.js +68 -0
- package/dist/node_modules/playwright/lib/fsWatcher.js +67 -0
- package/dist/node_modules/playwright/lib/index.js +682 -0
- package/dist/node_modules/playwright/lib/internalsForTest.js +42 -0
- package/dist/node_modules/playwright/lib/isomorphic/events.js +77 -0
- package/dist/node_modules/playwright/lib/isomorphic/folders.js +30 -0
- package/dist/node_modules/playwright/lib/isomorphic/stringInternPool.js +69 -0
- package/dist/node_modules/playwright/lib/isomorphic/teleReceiver.js +508 -0
- package/dist/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +137 -0
- package/dist/node_modules/playwright/lib/isomorphic/testServerConnection.js +225 -0
- package/dist/node_modules/playwright/lib/isomorphic/testServerInterface.js +16 -0
- package/dist/node_modules/playwright/lib/isomorphic/testTree.js +334 -0
- package/dist/node_modules/playwright/lib/isomorphic/types.d.js +16 -0
- package/dist/node_modules/playwright/lib/loader/loaderMain.js +59 -0
- package/dist/node_modules/playwright/lib/matchers/expect.js +324 -0
- package/dist/node_modules/playwright/lib/matchers/matcherHint.js +87 -0
- package/dist/node_modules/playwright/lib/matchers/matchers.js +382 -0
- package/dist/node_modules/playwright/lib/matchers/toBeTruthy.js +73 -0
- package/dist/node_modules/playwright/lib/matchers/toEqual.js +99 -0
- package/dist/node_modules/playwright/lib/matchers/toHaveURL.js +102 -0
- package/dist/node_modules/playwright/lib/matchers/toMatchAriaSnapshot.js +159 -0
- package/dist/node_modules/playwright/lib/matchers/toMatchSnapshot.js +341 -0
- package/dist/node_modules/playwright/lib/matchers/toMatchText.js +99 -0
- package/dist/node_modules/playwright/lib/mcp/browser/actions.d.js +16 -0
- package/dist/node_modules/playwright/lib/mcp/browser/browserContextFactory.js +296 -0
- package/dist/node_modules/playwright/lib/mcp/browser/browserServerBackend.js +76 -0
- package/dist/node_modules/playwright/lib/mcp/browser/codegen.js +66 -0
- package/dist/node_modules/playwright/lib/mcp/browser/config.js +368 -0
- package/dist/node_modules/playwright/lib/mcp/browser/context.js +267 -0
- package/dist/node_modules/playwright/lib/mcp/browser/response.js +237 -0
- package/dist/node_modules/playwright/lib/mcp/browser/sessionLog.js +160 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tab.js +292 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/common.js +63 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/console.js +44 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/dialogs.js +60 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/evaluate.js +69 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/files.js +58 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/form.js +73 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/install.js +69 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/keyboard.js +84 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/mouse.js +107 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/navigate.js +62 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/network.js +54 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/pdf.js +59 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/runCode.js +75 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/screenshot.js +106 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/snapshot.js +181 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/tabs.js +67 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/tool.js +49 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/tracing.js +74 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/utils.js +89 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/verify.js +153 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/wait.js +63 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools.js +82 -0
- package/dist/node_modules/playwright/lib/mcp/browser/watchdog.js +44 -0
- package/dist/node_modules/playwright/lib/mcp/config.d.js +16 -0
- package/dist/node_modules/playwright/lib/mcp/extension/cdpRelay.js +351 -0
- package/dist/node_modules/playwright/lib/mcp/extension/extensionContextFactory.js +75 -0
- package/dist/node_modules/playwright/lib/mcp/extension/protocol.js +28 -0
- package/dist/node_modules/playwright/lib/mcp/index.js +61 -0
- package/dist/node_modules/playwright/lib/mcp/log.js +35 -0
- package/dist/node_modules/playwright/lib/mcp/program.js +116 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/bundle.js +81 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/exports.js +30 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/http.js +187 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/inProcessTransport.js +71 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/proxyBackend.js +128 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/server.js +198 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/tool.js +47 -0
- package/dist/node_modules/playwright/lib/mcp/test/browserBackend.js +108 -0
- package/dist/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
- package/dist/node_modules/playwright/lib/mcp/test/plannerTools.js +144 -0
- package/dist/node_modules/playwright/lib/mcp/test/seed.js +82 -0
- package/dist/node_modules/playwright/lib/mcp/test/streams.js +44 -0
- package/dist/node_modules/playwright/lib/mcp/test/testBackend.js +99 -0
- package/dist/node_modules/playwright/lib/mcp/test/testContext.js +279 -0
- package/dist/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
- package/dist/node_modules/playwright/lib/mcp/test/testTools.js +106 -0
- package/dist/node_modules/playwright/lib/mcpBundleImpl.js +41 -0
- package/dist/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +198 -0
- package/dist/node_modules/playwright/lib/plugins/index.js +28 -0
- package/dist/node_modules/playwright/lib/plugins/webServerPlugin.js +237 -0
- package/dist/node_modules/playwright/lib/program.js +403 -0
- package/dist/node_modules/playwright/lib/reporters/base.js +609 -0
- package/dist/node_modules/playwright/lib/reporters/blob.js +135 -0
- package/dist/node_modules/playwright/lib/reporters/dot.js +82 -0
- package/dist/node_modules/playwright/lib/reporters/empty.js +32 -0
- package/dist/node_modules/playwright/lib/reporters/github.js +128 -0
- package/dist/node_modules/playwright/lib/reporters/html.js +623 -0
- package/dist/node_modules/playwright/lib/reporters/internalReporter.js +132 -0
- package/dist/node_modules/playwright/lib/reporters/json.js +254 -0
- package/dist/node_modules/playwright/lib/reporters/junit.js +232 -0
- package/dist/node_modules/playwright/lib/reporters/line.js +113 -0
- package/dist/node_modules/playwright/lib/reporters/list.js +231 -0
- package/dist/node_modules/playwright/lib/reporters/listModeReporter.js +69 -0
- package/dist/node_modules/playwright/lib/reporters/markdown.js +144 -0
- package/dist/node_modules/playwright/lib/reporters/merge.js +541 -0
- package/dist/node_modules/playwright/lib/reporters/multiplexer.js +104 -0
- package/dist/node_modules/playwright/lib/reporters/reporterV2.js +102 -0
- package/dist/node_modules/playwright/lib/reporters/teleEmitter.js +299 -0
- package/dist/node_modules/playwright/lib/reporters/versions/blobV1.js +16 -0
- package/dist/node_modules/playwright/lib/runner/dispatcher.js +515 -0
- package/dist/node_modules/playwright/lib/runner/failureTracker.js +72 -0
- package/dist/node_modules/playwright/lib/runner/lastRun.js +77 -0
- package/dist/node_modules/playwright/lib/runner/loadUtils.js +334 -0
- package/dist/node_modules/playwright/lib/runner/loaderHost.js +89 -0
- package/dist/node_modules/playwright/lib/runner/processHost.js +161 -0
- package/dist/node_modules/playwright/lib/runner/projectUtils.js +241 -0
- package/dist/node_modules/playwright/lib/runner/rebase.js +189 -0
- package/dist/node_modules/playwright/lib/runner/reporters.js +138 -0
- package/dist/node_modules/playwright/lib/runner/sigIntWatcher.js +96 -0
- package/dist/node_modules/playwright/lib/runner/taskRunner.js +127 -0
- package/dist/node_modules/playwright/lib/runner/tasks.js +410 -0
- package/dist/node_modules/playwright/lib/runner/testGroups.js +117 -0
- package/dist/node_modules/playwright/lib/runner/testRunner.js +389 -0
- package/dist/node_modules/playwright/lib/runner/testServer.js +269 -0
- package/dist/node_modules/playwright/lib/runner/uiModeReporter.js +30 -0
- package/dist/node_modules/playwright/lib/runner/vcs.js +72 -0
- package/dist/node_modules/playwright/lib/runner/watchMode.js +395 -0
- package/dist/node_modules/playwright/lib/runner/workerHost.js +98 -0
- package/dist/node_modules/playwright/lib/third_party/pirates.js +62 -0
- package/dist/node_modules/playwright/lib/third_party/tsconfig-loader.js +103 -0
- package/dist/node_modules/playwright/lib/transform/babelBundle.js +43 -0
- package/dist/node_modules/playwright/lib/transform/babelBundleImpl.js +461 -0
- package/dist/node_modules/playwright/lib/transform/compilationCache.js +272 -0
- package/dist/node_modules/playwright/lib/transform/esmLoader.js +104 -0
- package/dist/node_modules/playwright/lib/transform/portTransport.js +67 -0
- package/dist/node_modules/playwright/lib/transform/transform.js +293 -0
- package/dist/node_modules/playwright/lib/util.js +403 -0
- package/dist/node_modules/playwright/lib/utilsBundle.js +43 -0
- package/dist/node_modules/playwright/lib/utilsBundleImpl.js +100 -0
- package/dist/node_modules/playwright/lib/worker/fixtureRunner.js +258 -0
- package/dist/node_modules/playwright/lib/worker/testInfo.js +516 -0
- package/dist/node_modules/playwright/lib/worker/testTracing.js +345 -0
- package/dist/node_modules/playwright/lib/worker/timeoutManager.js +174 -0
- package/dist/node_modules/playwright/lib/worker/util.js +31 -0
- package/dist/node_modules/playwright/lib/worker/workerMain.js +529 -0
- package/dist/node_modules/playwright/package.json +72 -0
- package/dist/node_modules/playwright/test.d.ts +18 -0
- package/dist/node_modules/playwright/test.js +24 -0
- package/dist/node_modules/playwright/test.mjs +33 -0
- package/dist/node_modules/playwright/types/test.d.ts +10253 -0
- package/dist/node_modules/playwright/types/testReporter.d.ts +821 -0
- package/dist/node_modules/playwright-core/LICENSE +202 -0
- package/dist/node_modules/playwright-core/NOTICE +5 -0
- package/dist/node_modules/playwright-core/README.md +3 -0
- package/dist/node_modules/playwright-core/ThirdPartyNotices.txt +1161 -0
- package/dist/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/dist/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/dist/node_modules/playwright-core/browsers.json +80 -0
- package/dist/node_modules/playwright-core/cli.js +18 -0
- package/dist/node_modules/playwright-core/index.d.ts +17 -0
- package/dist/node_modules/playwright-core/index.js +32 -0
- package/dist/node_modules/playwright-core/index.mjs +28 -0
- package/dist/node_modules/playwright-core/lib/androidServerImpl.js +65 -0
- package/dist/node_modules/playwright-core/lib/browserServerImpl.js +120 -0
- package/dist/node_modules/playwright-core/lib/cli/driver.js +97 -0
- package/dist/node_modules/playwright-core/lib/cli/program.js +590 -0
- package/dist/node_modules/playwright-core/lib/cli/programWithTestStub.js +74 -0
- package/dist/node_modules/playwright-core/lib/client/android.js +361 -0
- package/dist/node_modules/playwright-core/lib/client/api.js +134 -0
- package/dist/node_modules/playwright-core/lib/client/artifact.js +79 -0
- package/dist/node_modules/playwright-core/lib/client/browser.js +163 -0
- package/dist/node_modules/playwright-core/lib/client/browserContext.js +547 -0
- package/dist/node_modules/playwright-core/lib/client/browserType.js +184 -0
- package/dist/node_modules/playwright-core/lib/client/cdpSession.js +51 -0
- package/dist/node_modules/playwright-core/lib/client/channelOwner.js +194 -0
- package/dist/node_modules/playwright-core/lib/client/clientHelper.js +64 -0
- package/dist/node_modules/playwright-core/lib/client/clientInstrumentation.js +55 -0
- package/dist/node_modules/playwright-core/lib/client/clientStackTrace.js +69 -0
- package/dist/node_modules/playwright-core/lib/client/clock.js +68 -0
- package/dist/node_modules/playwright-core/lib/client/connection.js +314 -0
- package/dist/node_modules/playwright-core/lib/client/consoleMessage.js +58 -0
- package/dist/node_modules/playwright-core/lib/client/coverage.js +44 -0
- package/dist/node_modules/playwright-core/lib/client/dialog.js +56 -0
- package/dist/node_modules/playwright-core/lib/client/download.js +62 -0
- package/dist/node_modules/playwright-core/lib/client/electron.js +138 -0
- package/dist/node_modules/playwright-core/lib/client/elementHandle.js +281 -0
- package/dist/node_modules/playwright-core/lib/client/errors.js +77 -0
- package/dist/node_modules/playwright-core/lib/client/eventEmitter.js +314 -0
- package/dist/node_modules/playwright-core/lib/client/events.js +100 -0
- package/dist/node_modules/playwright-core/lib/client/fetch.js +369 -0
- package/dist/node_modules/playwright-core/lib/client/fileChooser.js +46 -0
- package/dist/node_modules/playwright-core/lib/client/fileUtils.js +34 -0
- package/dist/node_modules/playwright-core/lib/client/frame.js +408 -0
- package/dist/node_modules/playwright-core/lib/client/harRouter.js +87 -0
- package/dist/node_modules/playwright-core/lib/client/input.js +84 -0
- package/dist/node_modules/playwright-core/lib/client/jsHandle.js +109 -0
- package/dist/node_modules/playwright-core/lib/client/jsonPipe.js +39 -0
- package/dist/node_modules/playwright-core/lib/client/localUtils.js +60 -0
- package/dist/node_modules/playwright-core/lib/client/locator.js +369 -0
- package/dist/node_modules/playwright-core/lib/client/network.js +747 -0
- package/dist/node_modules/playwright-core/lib/client/page.js +718 -0
- package/dist/node_modules/playwright-core/lib/client/platform.js +74 -0
- package/dist/node_modules/playwright-core/lib/client/playwright.js +71 -0
- package/dist/node_modules/playwright-core/lib/client/selectors.js +55 -0
- package/dist/node_modules/playwright-core/lib/client/stream.js +39 -0
- package/dist/node_modules/playwright-core/lib/client/timeoutSettings.js +79 -0
- package/dist/node_modules/playwright-core/lib/client/tracing.js +119 -0
- package/dist/node_modules/playwright-core/lib/client/types.js +28 -0
- package/dist/node_modules/playwright-core/lib/client/video.js +59 -0
- package/dist/node_modules/playwright-core/lib/client/waiter.js +142 -0
- package/dist/node_modules/playwright-core/lib/client/webError.js +39 -0
- package/dist/node_modules/playwright-core/lib/client/webSocket.js +93 -0
- package/dist/node_modules/playwright-core/lib/client/worker.js +85 -0
- package/dist/node_modules/playwright-core/lib/client/writableStream.js +39 -0
- package/dist/node_modules/playwright-core/lib/generated/bindingsControllerSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/clockSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/injectedScriptSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/pollingRecorderSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/storageScriptSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/utilityScriptSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/webSocketMockSource.js +336 -0
- package/dist/node_modules/playwright-core/lib/inProcessFactory.js +60 -0
- package/dist/node_modules/playwright-core/lib/inprocess.js +3 -0
- package/dist/node_modules/playwright-core/lib/outofprocess.js +76 -0
- package/dist/node_modules/playwright-core/lib/protocol/serializers.js +192 -0
- package/dist/node_modules/playwright-core/lib/protocol/validator.js +2890 -0
- package/dist/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +193 -0
- package/dist/node_modules/playwright-core/lib/remote/playwrightConnection.js +129 -0
- package/dist/node_modules/playwright-core/lib/remote/playwrightServer.js +335 -0
- package/dist/node_modules/playwright-core/lib/server/android/android.js +465 -0
- package/dist/node_modules/playwright-core/lib/server/android/backendAdb.js +177 -0
- package/dist/node_modules/playwright-core/lib/server/artifact.js +127 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +505 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiChromium.js +153 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +212 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +221 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +130 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiInput.js +146 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +383 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiOverCdp.js +102 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiPage.js +572 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiPdf.js +106 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js +98 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- package/dist/node_modules/playwright-core/lib/server/browser.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/browserContext.js +695 -0
- package/dist/node_modules/playwright-core/lib/server/browserType.js +328 -0
- package/dist/node_modules/playwright-core/lib/server/callLog.js +82 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/chromium.js +402 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +104 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crBrowser.js +510 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crConnection.js +202 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crCoverage.js +235 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crDevTools.js +113 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +131 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +146 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crInput.js +187 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +666 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crPage.js +1069 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crPdf.js +121 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +145 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +136 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/protocol.d.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/videoRecorder.js +115 -0
- package/dist/node_modules/playwright-core/lib/server/clock.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/csharp.js +327 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/java.js +274 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/javascript.js +270 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/jsonl.js +52 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/language.js +132 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/languages.js +68 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/python.js +279 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/types.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/console.js +57 -0
- package/dist/node_modules/playwright-core/lib/server/cookieStore.js +206 -0
- package/dist/node_modules/playwright-core/lib/server/debugController.js +191 -0
- package/dist/node_modules/playwright-core/lib/server/debugger.js +119 -0
- package/dist/node_modules/playwright-core/lib/server/deviceDescriptors.js +39 -0
- package/dist/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +1779 -0
- package/dist/node_modules/playwright-core/lib/server/dialog.js +116 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +381 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +118 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +371 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +89 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +213 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +389 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/dist/node_modules/playwright-core/lib/server/dom.js +806 -0
- package/dist/node_modules/playwright-core/lib/server/download.js +70 -0
- package/dist/node_modules/playwright-core/lib/server/electron/electron.js +270 -0
- package/dist/node_modules/playwright-core/lib/server/electron/loader.js +29 -0
- package/dist/node_modules/playwright-core/lib/server/errors.js +69 -0
- package/dist/node_modules/playwright-core/lib/server/fetch.js +621 -0
- package/dist/node_modules/playwright-core/lib/server/fileChooser.js +43 -0
- package/dist/node_modules/playwright-core/lib/server/fileUploadUtils.js +84 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +428 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffConnection.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +150 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffInput.js +159 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +256 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffPage.js +500 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/firefox.js +116 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/protocol.d.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/formData.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/frameSelectors.js +154 -0
- package/dist/node_modules/playwright-core/lib/server/frames.js +1455 -0
- package/dist/node_modules/playwright-core/lib/server/har/harRecorder.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/har/harTracer.js +607 -0
- package/dist/node_modules/playwright-core/lib/server/harBackend.js +157 -0
- package/dist/node_modules/playwright-core/lib/server/helper.js +96 -0
- package/dist/node_modules/playwright-core/lib/server/index.js +58 -0
- package/dist/node_modules/playwright-core/lib/server/input.js +277 -0
- package/dist/node_modules/playwright-core/lib/server/instrumentation.js +69 -0
- package/dist/node_modules/playwright-core/lib/server/javascript.js +291 -0
- package/dist/node_modules/playwright-core/lib/server/launchApp.js +128 -0
- package/dist/node_modules/playwright-core/lib/server/localUtils.js +214 -0
- package/dist/node_modules/playwright-core/lib/server/macEditingCommands.js +143 -0
- package/dist/node_modules/playwright-core/lib/server/network.js +629 -0
- package/dist/node_modules/playwright-core/lib/server/page.js +886 -0
- package/dist/node_modules/playwright-core/lib/server/pipeTransport.js +89 -0
- package/dist/node_modules/playwright-core/lib/server/playwright.js +69 -0
- package/dist/node_modules/playwright-core/lib/server/progress.js +112 -0
- package/dist/node_modules/playwright-core/lib/server/protocolError.js +52 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/chat.js +161 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderApp.js +387 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +138 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +157 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/throttledFile.js +57 -0
- package/dist/node_modules/playwright-core/lib/server/recorder.js +499 -0
- package/dist/node_modules/playwright-core/lib/server/registry/browserFetcher.js +175 -0
- package/dist/node_modules/playwright-core/lib/server/registry/dependencies.js +371 -0
- package/dist/node_modules/playwright-core/lib/server/registry/index.js +1399 -0
- package/dist/node_modules/playwright-core/lib/server/registry/nativeDeps.js +1280 -0
- package/dist/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +124 -0
- package/dist/node_modules/playwright-core/lib/server/screenshotter.js +333 -0
- package/dist/node_modules/playwright-core/lib/server/selectors.js +112 -0
- package/dist/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/dist/node_modules/playwright-core/lib/server/socksInterceptor.js +95 -0
- package/dist/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +541 -0
- package/dist/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +604 -0
- package/dist/node_modules/playwright-core/lib/server/trace/test/inMemorySnapshotter.js +87 -0
- package/dist/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +241 -0
- package/dist/node_modules/playwright-core/lib/server/transport.js +181 -0
- package/dist/node_modules/playwright-core/lib/server/types.js +28 -0
- package/dist/node_modules/playwright-core/lib/server/usKeyboardLayout.js +145 -0
- package/dist/node_modules/playwright-core/lib/server/utils/ascii.js +44 -0
- package/dist/node_modules/playwright-core/lib/server/utils/comparators.js +139 -0
- package/dist/node_modules/playwright-core/lib/server/utils/crypto.js +216 -0
- package/dist/node_modules/playwright-core/lib/server/utils/debug.js +42 -0
- package/dist/node_modules/playwright-core/lib/server/utils/debugLogger.js +122 -0
- package/dist/node_modules/playwright-core/lib/server/utils/env.js +73 -0
- package/dist/node_modules/playwright-core/lib/server/utils/eventsHelper.js +39 -0
- package/dist/node_modules/playwright-core/lib/server/utils/expectUtils.js +38 -0
- package/dist/node_modules/playwright-core/lib/server/utils/fileUtils.js +191 -0
- package/dist/node_modules/playwright-core/lib/server/utils/happyEyeballs.js +207 -0
- package/dist/node_modules/playwright-core/lib/server/utils/hostPlatform.js +123 -0
- package/dist/node_modules/playwright-core/lib/server/utils/httpServer.js +218 -0
- package/dist/node_modules/playwright-core/lib/server/utils/imageUtils.js +141 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/compare.js +109 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/stats.js +102 -0
- package/dist/node_modules/playwright-core/lib/server/utils/linuxUtils.js +71 -0
- package/dist/node_modules/playwright-core/lib/server/utils/network.js +233 -0
- package/dist/node_modules/playwright-core/lib/server/utils/nodePlatform.js +148 -0
- package/dist/node_modules/playwright-core/lib/server/utils/pipeTransport.js +84 -0
- package/dist/node_modules/playwright-core/lib/server/utils/processLauncher.js +241 -0
- package/dist/node_modules/playwright-core/lib/server/utils/profiler.js +65 -0
- package/dist/node_modules/playwright-core/lib/server/utils/socksProxy.js +511 -0
- package/dist/node_modules/playwright-core/lib/server/utils/spawnAsync.js +41 -0
- package/dist/node_modules/playwright-core/lib/server/utils/task.js +51 -0
- package/dist/node_modules/playwright-core/lib/server/utils/userAgent.js +98 -0
- package/dist/node_modules/playwright-core/lib/server/utils/wsServer.js +121 -0
- package/dist/node_modules/playwright-core/lib/server/utils/zipFile.js +74 -0
- package/dist/node_modules/playwright-core/lib/server/utils/zones.js +57 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/protocol.d.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/webkit.js +110 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +339 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkConnection.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +154 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkInput.js +181 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +169 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkPage.js +1130 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +105 -0
- package/dist/node_modules/playwright-core/lib/third_party/pixelmatch.js +255 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/ariaSnapshot.js +397 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/assert.js +31 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/colors.js +72 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +245 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/headers.js +53 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +689 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +176 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/manualPromise.js +114 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +459 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/multimap.js +80 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/protocolFormatter.js +81 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/protocolMetainfo.js +322 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/rtti.js +43 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +386 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/semaphore.js +54 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/stackTrace.js +158 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +155 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/time.js +49 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +58 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/types.js +16 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +190 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/dist/node_modules/playwright-core/lib/utils.js +109 -0
- package/dist/node_modules/playwright-core/lib/utilsBundle.js +112 -0
- package/dist/node_modules/playwright-core/lib/utilsBundleImpl/index.js +218 -0
- package/dist/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
- package/dist/node_modules/playwright-core/lib/vite/htmlReport/index.html +84 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-BoWUGj0J.js +25 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/index-DJqDAOZp.js +193 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/index-Ri0uHF7I.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-Bucv2d7q.js +25 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-BEpdCv1S.js +266 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.ConWv5KN.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/index.BxQ34UMZ.js +2 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/index.C4Y3Aw8n.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/index.html +43 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +21 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BWTwXl41.js +5 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +17 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/dist/node_modules/playwright-core/lib/zipBundle.js +34 -0
- package/dist/node_modules/playwright-core/lib/zipBundleImpl.js +5 -0
- package/dist/node_modules/playwright-core/package.json +42 -0
- package/dist/node_modules/playwright-core/types/protocol.d.ts +23245 -0
- package/dist/node_modules/playwright-core/types/structs.d.ts +45 -0
- package/dist/node_modules/playwright-core/types/types.d.ts +22856 -0
- package/dist/server.obf.js +1 -1
- package/package.json +11 -12
|
@@ -0,0 +1,237 @@
|
|
|
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 response_exports = {};
|
|
20
|
+
__export(response_exports, {
|
|
21
|
+
Response: () => Response,
|
|
22
|
+
parseResponse: () => parseResponse,
|
|
23
|
+
requestDebug: () => requestDebug
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(response_exports);
|
|
26
|
+
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
27
|
+
var import_tab = require("./tab");
|
|
28
|
+
const requestDebug = (0, import_utilsBundle.debug)("pw:mcp:request");
|
|
29
|
+
class Response {
|
|
30
|
+
constructor(context, toolName, toolArgs) {
|
|
31
|
+
this._result = [];
|
|
32
|
+
this._code = [];
|
|
33
|
+
this._images = [];
|
|
34
|
+
this._includeSnapshot = "none";
|
|
35
|
+
this._includeTabs = false;
|
|
36
|
+
this._context = context;
|
|
37
|
+
this.toolName = toolName;
|
|
38
|
+
this.toolArgs = toolArgs;
|
|
39
|
+
}
|
|
40
|
+
addResult(result) {
|
|
41
|
+
this._result.push(result);
|
|
42
|
+
}
|
|
43
|
+
addError(error) {
|
|
44
|
+
this._result.push(error);
|
|
45
|
+
this._isError = true;
|
|
46
|
+
}
|
|
47
|
+
isError() {
|
|
48
|
+
return this._isError;
|
|
49
|
+
}
|
|
50
|
+
result() {
|
|
51
|
+
return this._result.join("\n");
|
|
52
|
+
}
|
|
53
|
+
addCode(code) {
|
|
54
|
+
this._code.push(code);
|
|
55
|
+
}
|
|
56
|
+
code() {
|
|
57
|
+
return this._code.join("\n");
|
|
58
|
+
}
|
|
59
|
+
addImage(image) {
|
|
60
|
+
this._images.push(image);
|
|
61
|
+
}
|
|
62
|
+
images() {
|
|
63
|
+
return this._images;
|
|
64
|
+
}
|
|
65
|
+
setIncludeSnapshot(full) {
|
|
66
|
+
this._includeSnapshot = full ?? "incremental";
|
|
67
|
+
}
|
|
68
|
+
setIncludeTabs() {
|
|
69
|
+
this._includeTabs = true;
|
|
70
|
+
}
|
|
71
|
+
async finish() {
|
|
72
|
+
if (this._includeSnapshot !== "none" && this._context.currentTab())
|
|
73
|
+
this._tabSnapshot = await this._context.currentTabOrDie().captureSnapshot();
|
|
74
|
+
for (const tab of this._context.tabs())
|
|
75
|
+
await tab.updateTitle();
|
|
76
|
+
}
|
|
77
|
+
tabSnapshot() {
|
|
78
|
+
return this._tabSnapshot;
|
|
79
|
+
}
|
|
80
|
+
logBegin() {
|
|
81
|
+
if (requestDebug.enabled)
|
|
82
|
+
requestDebug(this.toolName, this.toolArgs);
|
|
83
|
+
}
|
|
84
|
+
logEnd() {
|
|
85
|
+
if (requestDebug.enabled)
|
|
86
|
+
requestDebug(this.serialize({ omitSnapshot: true, omitBlobs: true }));
|
|
87
|
+
}
|
|
88
|
+
serialize(options = {}) {
|
|
89
|
+
const response = [];
|
|
90
|
+
if (this._result.length) {
|
|
91
|
+
response.push("### Result");
|
|
92
|
+
response.push(this._result.join("\n"));
|
|
93
|
+
response.push("");
|
|
94
|
+
}
|
|
95
|
+
if (this._code.length) {
|
|
96
|
+
response.push(`### Ran Playwright code
|
|
97
|
+
\`\`\`js
|
|
98
|
+
${this._code.join("\n")}
|
|
99
|
+
\`\`\``);
|
|
100
|
+
response.push("");
|
|
101
|
+
}
|
|
102
|
+
if (this._includeSnapshot !== "none" || this._includeTabs)
|
|
103
|
+
response.push(...renderTabsMarkdown(this._context.tabs(), this._includeTabs));
|
|
104
|
+
if (this._tabSnapshot?.modalStates.length) {
|
|
105
|
+
response.push(...(0, import_tab.renderModalStates)(this._context, this._tabSnapshot.modalStates));
|
|
106
|
+
response.push("");
|
|
107
|
+
} else if (this._tabSnapshot) {
|
|
108
|
+
const includeSnapshot = options.omitSnapshot ? "none" : this._includeSnapshot;
|
|
109
|
+
response.push(renderTabSnapshot(this._tabSnapshot, includeSnapshot));
|
|
110
|
+
response.push("");
|
|
111
|
+
}
|
|
112
|
+
const content = [
|
|
113
|
+
{ type: "text", text: response.join("\n") }
|
|
114
|
+
];
|
|
115
|
+
if (this._context.config.imageResponses !== "omit") {
|
|
116
|
+
for (const image of this._images)
|
|
117
|
+
content.push({ type: "image", data: options.omitBlobs ? "<blob>" : image.data.toString("base64"), mimeType: image.contentType });
|
|
118
|
+
}
|
|
119
|
+
this._redactSecrets(content);
|
|
120
|
+
return { content, isError: this._isError };
|
|
121
|
+
}
|
|
122
|
+
_redactSecrets(content) {
|
|
123
|
+
if (!this._context.config.secrets)
|
|
124
|
+
return;
|
|
125
|
+
for (const item of content) {
|
|
126
|
+
if (item.type !== "text")
|
|
127
|
+
continue;
|
|
128
|
+
for (const [secretName, secretValue] of Object.entries(this._context.config.secrets))
|
|
129
|
+
item.text = item.text.replaceAll(secretValue, `<secret>${secretName}</secret>`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function renderTabSnapshot(tabSnapshot, includeSnapshot) {
|
|
134
|
+
const lines = [];
|
|
135
|
+
if (tabSnapshot.consoleMessages.length) {
|
|
136
|
+
lines.push(`### New console messages`);
|
|
137
|
+
for (const message of tabSnapshot.consoleMessages)
|
|
138
|
+
lines.push(`- ${trim(message.toString(), 100)}`);
|
|
139
|
+
lines.push("");
|
|
140
|
+
}
|
|
141
|
+
if (tabSnapshot.downloads.length) {
|
|
142
|
+
lines.push(`### Downloads`);
|
|
143
|
+
for (const entry of tabSnapshot.downloads) {
|
|
144
|
+
if (entry.finished)
|
|
145
|
+
lines.push(`- Downloaded file ${entry.download.suggestedFilename()} to ${entry.outputFile}`);
|
|
146
|
+
else
|
|
147
|
+
lines.push(`- Downloading file ${entry.download.suggestedFilename()} ...`);
|
|
148
|
+
}
|
|
149
|
+
lines.push("");
|
|
150
|
+
}
|
|
151
|
+
if (includeSnapshot === "incremental" && tabSnapshot.ariaSnapshotDiff === "") {
|
|
152
|
+
return lines.join("\n");
|
|
153
|
+
}
|
|
154
|
+
lines.push(`### Page state`);
|
|
155
|
+
lines.push(`- Page URL: ${tabSnapshot.url}`);
|
|
156
|
+
lines.push(`- Page Title: ${tabSnapshot.title}`);
|
|
157
|
+
if (includeSnapshot !== "none") {
|
|
158
|
+
lines.push(`- Page Snapshot:`);
|
|
159
|
+
lines.push("```yaml");
|
|
160
|
+
if (includeSnapshot === "incremental" && tabSnapshot.ariaSnapshotDiff !== void 0)
|
|
161
|
+
lines.push(tabSnapshot.ariaSnapshotDiff);
|
|
162
|
+
else
|
|
163
|
+
lines.push(tabSnapshot.ariaSnapshot);
|
|
164
|
+
lines.push("```");
|
|
165
|
+
}
|
|
166
|
+
return lines.join("\n");
|
|
167
|
+
}
|
|
168
|
+
function renderTabsMarkdown(tabs, force = false) {
|
|
169
|
+
if (tabs.length === 1 && !force)
|
|
170
|
+
return [];
|
|
171
|
+
if (!tabs.length) {
|
|
172
|
+
return [
|
|
173
|
+
"### Open tabs",
|
|
174
|
+
'No open tabs. Use the "browser_navigate" tool to navigate to a page first.',
|
|
175
|
+
""
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
const lines = ["### Open tabs"];
|
|
179
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
180
|
+
const tab = tabs[i];
|
|
181
|
+
const current = tab.isCurrentTab() ? " (current)" : "";
|
|
182
|
+
lines.push(`- ${i}:${current} [${tab.lastTitle()}] (${tab.page.url()})`);
|
|
183
|
+
}
|
|
184
|
+
lines.push("");
|
|
185
|
+
return lines;
|
|
186
|
+
}
|
|
187
|
+
function trim(text, maxLength) {
|
|
188
|
+
if (text.length <= maxLength)
|
|
189
|
+
return text;
|
|
190
|
+
return text.slice(0, maxLength) + "...";
|
|
191
|
+
}
|
|
192
|
+
function parseSections(text) {
|
|
193
|
+
const sections = /* @__PURE__ */ new Map();
|
|
194
|
+
const sectionHeaders = text.split(/^### /m).slice(1);
|
|
195
|
+
for (const section of sectionHeaders) {
|
|
196
|
+
const firstNewlineIndex = section.indexOf("\n");
|
|
197
|
+
if (firstNewlineIndex === -1)
|
|
198
|
+
continue;
|
|
199
|
+
const sectionName = section.substring(0, firstNewlineIndex);
|
|
200
|
+
const sectionContent = section.substring(firstNewlineIndex + 1).trim();
|
|
201
|
+
sections.set(sectionName, sectionContent);
|
|
202
|
+
}
|
|
203
|
+
return sections;
|
|
204
|
+
}
|
|
205
|
+
function parseResponse(response) {
|
|
206
|
+
if (response.content?.[0].type !== "text")
|
|
207
|
+
return void 0;
|
|
208
|
+
const text = response.content[0].text;
|
|
209
|
+
const sections = parseSections(text);
|
|
210
|
+
const result = sections.get("Result");
|
|
211
|
+
const code = sections.get("Ran Playwright code");
|
|
212
|
+
const tabs = sections.get("Open tabs");
|
|
213
|
+
const pageState = sections.get("Page state");
|
|
214
|
+
const consoleMessages = sections.get("New console messages");
|
|
215
|
+
const modalState = sections.get("Modal state");
|
|
216
|
+
const downloads = sections.get("Downloads");
|
|
217
|
+
const codeNoFrame = code?.replace(/^```js\n/, "").replace(/\n```$/, "");
|
|
218
|
+
const isError = response.isError;
|
|
219
|
+
const attachments = response.content.slice(1);
|
|
220
|
+
return {
|
|
221
|
+
result,
|
|
222
|
+
code: codeNoFrame,
|
|
223
|
+
tabs,
|
|
224
|
+
pageState,
|
|
225
|
+
consoleMessages,
|
|
226
|
+
modalState,
|
|
227
|
+
downloads,
|
|
228
|
+
isError,
|
|
229
|
+
attachments
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
233
|
+
0 && (module.exports = {
|
|
234
|
+
Response,
|
|
235
|
+
parseResponse,
|
|
236
|
+
requestDebug
|
|
237
|
+
});
|
|
@@ -0,0 +1,160 @@
|
|
|
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 sessionLog_exports = {};
|
|
30
|
+
__export(sessionLog_exports, {
|
|
31
|
+
SessionLog: () => SessionLog
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(sessionLog_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_log = require("../log");
|
|
37
|
+
var import_config = require("./config");
|
|
38
|
+
class SessionLog {
|
|
39
|
+
constructor(sessionFolder) {
|
|
40
|
+
this._ordinal = 0;
|
|
41
|
+
this._pendingEntries = [];
|
|
42
|
+
this._sessionFileQueue = Promise.resolve();
|
|
43
|
+
this._folder = sessionFolder;
|
|
44
|
+
this._file = import_path.default.join(this._folder, "session.md");
|
|
45
|
+
}
|
|
46
|
+
static async create(config, clientInfo) {
|
|
47
|
+
const sessionFolder = await (0, import_config.outputFile)(config, clientInfo, `session-${Date.now()}`, { origin: "code", reason: "Saving session" });
|
|
48
|
+
await import_fs.default.promises.mkdir(sessionFolder, { recursive: true });
|
|
49
|
+
console.error(`Session: ${sessionFolder}`);
|
|
50
|
+
return new SessionLog(sessionFolder);
|
|
51
|
+
}
|
|
52
|
+
logResponse(response) {
|
|
53
|
+
const entry = {
|
|
54
|
+
timestamp: performance.now(),
|
|
55
|
+
toolCall: {
|
|
56
|
+
toolName: response.toolName,
|
|
57
|
+
toolArgs: response.toolArgs,
|
|
58
|
+
result: response.result(),
|
|
59
|
+
isError: response.isError()
|
|
60
|
+
},
|
|
61
|
+
code: response.code(),
|
|
62
|
+
tabSnapshot: response.tabSnapshot()
|
|
63
|
+
};
|
|
64
|
+
this._appendEntry(entry);
|
|
65
|
+
}
|
|
66
|
+
logUserAction(action, tab, code, isUpdate) {
|
|
67
|
+
code = code.trim();
|
|
68
|
+
if (isUpdate) {
|
|
69
|
+
const lastEntry = this._pendingEntries[this._pendingEntries.length - 1];
|
|
70
|
+
if (lastEntry?.userAction?.name === action.name) {
|
|
71
|
+
lastEntry.userAction = action;
|
|
72
|
+
lastEntry.code = code;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (action.name === "navigate") {
|
|
77
|
+
const lastEntry = this._pendingEntries[this._pendingEntries.length - 1];
|
|
78
|
+
if (lastEntry?.tabSnapshot?.url === action.url)
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const entry = {
|
|
82
|
+
timestamp: performance.now(),
|
|
83
|
+
userAction: action,
|
|
84
|
+
code,
|
|
85
|
+
tabSnapshot: {
|
|
86
|
+
url: tab.page.url(),
|
|
87
|
+
title: "",
|
|
88
|
+
ariaSnapshot: action.ariaSnapshot || "",
|
|
89
|
+
modalStates: [],
|
|
90
|
+
consoleMessages: [],
|
|
91
|
+
downloads: []
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this._appendEntry(entry);
|
|
95
|
+
}
|
|
96
|
+
_appendEntry(entry) {
|
|
97
|
+
this._pendingEntries.push(entry);
|
|
98
|
+
if (this._flushEntriesTimeout)
|
|
99
|
+
clearTimeout(this._flushEntriesTimeout);
|
|
100
|
+
this._flushEntriesTimeout = setTimeout(() => this._flushEntries(), 1e3);
|
|
101
|
+
}
|
|
102
|
+
async _flushEntries() {
|
|
103
|
+
clearTimeout(this._flushEntriesTimeout);
|
|
104
|
+
const entries = this._pendingEntries;
|
|
105
|
+
this._pendingEntries = [];
|
|
106
|
+
const lines = [""];
|
|
107
|
+
for (const entry of entries) {
|
|
108
|
+
const ordinal = (++this._ordinal).toString().padStart(3, "0");
|
|
109
|
+
if (entry.toolCall) {
|
|
110
|
+
lines.push(
|
|
111
|
+
`### Tool call: ${entry.toolCall.toolName}`,
|
|
112
|
+
`- Args`,
|
|
113
|
+
"```json",
|
|
114
|
+
JSON.stringify(entry.toolCall.toolArgs, null, 2),
|
|
115
|
+
"```"
|
|
116
|
+
);
|
|
117
|
+
if (entry.toolCall.result) {
|
|
118
|
+
lines.push(
|
|
119
|
+
entry.toolCall.isError ? `- Error` : `- Result`,
|
|
120
|
+
"```",
|
|
121
|
+
entry.toolCall.result,
|
|
122
|
+
"```"
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (entry.userAction) {
|
|
127
|
+
const actionData = { ...entry.userAction };
|
|
128
|
+
delete actionData.ariaSnapshot;
|
|
129
|
+
delete actionData.selector;
|
|
130
|
+
delete actionData.signals;
|
|
131
|
+
lines.push(
|
|
132
|
+
`### User action: ${entry.userAction.name}`,
|
|
133
|
+
`- Args`,
|
|
134
|
+
"```json",
|
|
135
|
+
JSON.stringify(actionData, null, 2),
|
|
136
|
+
"```"
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
if (entry.code) {
|
|
140
|
+
lines.push(
|
|
141
|
+
`- Code`,
|
|
142
|
+
"```js",
|
|
143
|
+
entry.code,
|
|
144
|
+
"```"
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
if (entry.tabSnapshot) {
|
|
148
|
+
const fileName = `${ordinal}.snapshot.yml`;
|
|
149
|
+
import_fs.default.promises.writeFile(import_path.default.join(this._folder, fileName), entry.tabSnapshot.ariaSnapshot).catch(import_log.logUnhandledError);
|
|
150
|
+
lines.push(`- Snapshot: ${fileName}`);
|
|
151
|
+
}
|
|
152
|
+
lines.push("", "");
|
|
153
|
+
}
|
|
154
|
+
this._sessionFileQueue = this._sessionFileQueue.then(() => import_fs.default.promises.appendFile(this._file, lines.join("\n")));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
158
|
+
0 && (module.exports = {
|
|
159
|
+
SessionLog
|
|
160
|
+
});
|
|
@@ -0,0 +1,292 @@
|
|
|
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 tab_exports = {};
|
|
20
|
+
__export(tab_exports, {
|
|
21
|
+
Tab: () => Tab,
|
|
22
|
+
TabEvents: () => TabEvents,
|
|
23
|
+
renderModalStates: () => renderModalStates
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(tab_exports);
|
|
26
|
+
var import_events = require("events");
|
|
27
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
28
|
+
var import_utils2 = require("./tools/utils");
|
|
29
|
+
var import_log = require("../log");
|
|
30
|
+
var import_dialogs = require("./tools/dialogs");
|
|
31
|
+
var import_files = require("./tools/files");
|
|
32
|
+
var import_transform = require("../../transform/transform");
|
|
33
|
+
const TabEvents = {
|
|
34
|
+
modalState: "modalState"
|
|
35
|
+
};
|
|
36
|
+
class Tab extends import_events.EventEmitter {
|
|
37
|
+
constructor(context, page, onPageClose) {
|
|
38
|
+
super();
|
|
39
|
+
this._lastTitle = "about:blank";
|
|
40
|
+
this._consoleMessages = [];
|
|
41
|
+
this._recentConsoleMessages = [];
|
|
42
|
+
this._requests = /* @__PURE__ */ new Set();
|
|
43
|
+
this._modalStates = [];
|
|
44
|
+
this._downloads = [];
|
|
45
|
+
this._needsFullSnapshot = false;
|
|
46
|
+
this.context = context;
|
|
47
|
+
this.page = page;
|
|
48
|
+
this._onPageClose = onPageClose;
|
|
49
|
+
page.on("console", (event) => this._handleConsoleMessage(messageToConsoleMessage(event)));
|
|
50
|
+
page.on("pageerror", (error) => this._handleConsoleMessage(pageErrorToConsoleMessage(error)));
|
|
51
|
+
page.on("request", (request) => this._requests.add(request));
|
|
52
|
+
page.on("close", () => this._onClose());
|
|
53
|
+
page.on("filechooser", (chooser) => {
|
|
54
|
+
this.setModalState({
|
|
55
|
+
type: "fileChooser",
|
|
56
|
+
description: "File chooser",
|
|
57
|
+
fileChooser: chooser,
|
|
58
|
+
clearedBy: import_files.uploadFile.schema.name
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
page.on("dialog", (dialog) => this._dialogShown(dialog));
|
|
62
|
+
page.on("download", (download) => {
|
|
63
|
+
void this._downloadStarted(download);
|
|
64
|
+
});
|
|
65
|
+
page.setDefaultNavigationTimeout(this.context.config.timeouts.navigation);
|
|
66
|
+
page.setDefaultTimeout(this.context.config.timeouts.action);
|
|
67
|
+
page[tabSymbol] = this;
|
|
68
|
+
this.initializedPromise = this._initialize();
|
|
69
|
+
}
|
|
70
|
+
static forPage(page) {
|
|
71
|
+
return page[tabSymbol];
|
|
72
|
+
}
|
|
73
|
+
static async collectConsoleMessages(page) {
|
|
74
|
+
const result = [];
|
|
75
|
+
const messages = await page.consoleMessages().catch(() => []);
|
|
76
|
+
for (const message of messages)
|
|
77
|
+
result.push(messageToConsoleMessage(message));
|
|
78
|
+
const errors = await page.pageErrors().catch(() => []);
|
|
79
|
+
for (const error of errors)
|
|
80
|
+
result.push(pageErrorToConsoleMessage(error));
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
async _initialize() {
|
|
84
|
+
for (const message of await Tab.collectConsoleMessages(this.page))
|
|
85
|
+
this._handleConsoleMessage(message);
|
|
86
|
+
const requests = await this.page.requests().catch(() => []);
|
|
87
|
+
for (const request of requests)
|
|
88
|
+
this._requests.add(request);
|
|
89
|
+
for (const initPage of this.context.config.browser.initPage || []) {
|
|
90
|
+
try {
|
|
91
|
+
const { default: func } = await (0, import_transform.requireOrImport)(initPage);
|
|
92
|
+
await func({ page: this.page });
|
|
93
|
+
} catch (e) {
|
|
94
|
+
(0, import_log.logUnhandledError)(e);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
modalStates() {
|
|
99
|
+
return this._modalStates;
|
|
100
|
+
}
|
|
101
|
+
setModalState(modalState) {
|
|
102
|
+
this._modalStates.push(modalState);
|
|
103
|
+
this.emit(TabEvents.modalState, modalState);
|
|
104
|
+
}
|
|
105
|
+
clearModalState(modalState) {
|
|
106
|
+
this._modalStates = this._modalStates.filter((state) => state !== modalState);
|
|
107
|
+
}
|
|
108
|
+
modalStatesMarkdown() {
|
|
109
|
+
return renderModalStates(this.context, this.modalStates());
|
|
110
|
+
}
|
|
111
|
+
_dialogShown(dialog) {
|
|
112
|
+
this.setModalState({
|
|
113
|
+
type: "dialog",
|
|
114
|
+
description: `"${dialog.type()}" dialog with message "${dialog.message()}"`,
|
|
115
|
+
dialog,
|
|
116
|
+
clearedBy: import_dialogs.handleDialog.schema.name
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async _downloadStarted(download) {
|
|
120
|
+
const entry = {
|
|
121
|
+
download,
|
|
122
|
+
finished: false,
|
|
123
|
+
outputFile: await this.context.outputFile(download.suggestedFilename(), { origin: "web", reason: "Saving download" })
|
|
124
|
+
};
|
|
125
|
+
this._downloads.push(entry);
|
|
126
|
+
await download.saveAs(entry.outputFile);
|
|
127
|
+
entry.finished = true;
|
|
128
|
+
}
|
|
129
|
+
_clearCollectedArtifacts() {
|
|
130
|
+
this._consoleMessages.length = 0;
|
|
131
|
+
this._recentConsoleMessages.length = 0;
|
|
132
|
+
this._requests.clear();
|
|
133
|
+
}
|
|
134
|
+
_handleConsoleMessage(message) {
|
|
135
|
+
this._consoleMessages.push(message);
|
|
136
|
+
this._recentConsoleMessages.push(message);
|
|
137
|
+
}
|
|
138
|
+
_onClose() {
|
|
139
|
+
this._clearCollectedArtifacts();
|
|
140
|
+
this._onPageClose(this);
|
|
141
|
+
}
|
|
142
|
+
async updateTitle() {
|
|
143
|
+
await this._raceAgainstModalStates(async () => {
|
|
144
|
+
this._lastTitle = await (0, import_utils2.callOnPageNoTrace)(this.page, (page) => page.title());
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
lastTitle() {
|
|
148
|
+
return this._lastTitle;
|
|
149
|
+
}
|
|
150
|
+
isCurrentTab() {
|
|
151
|
+
return this === this.context.currentTab();
|
|
152
|
+
}
|
|
153
|
+
async waitForLoadState(state, options) {
|
|
154
|
+
await (0, import_utils2.callOnPageNoTrace)(this.page, (page) => page.waitForLoadState(state, options).catch(import_log.logUnhandledError));
|
|
155
|
+
}
|
|
156
|
+
async navigate(url) {
|
|
157
|
+
this._clearCollectedArtifacts();
|
|
158
|
+
const downloadEvent = (0, import_utils2.callOnPageNoTrace)(this.page, (page) => page.waitForEvent("download").catch(import_log.logUnhandledError));
|
|
159
|
+
try {
|
|
160
|
+
await this.page.goto(url, { waitUntil: "domcontentloaded" });
|
|
161
|
+
} catch (_e) {
|
|
162
|
+
const e = _e;
|
|
163
|
+
const mightBeDownload = e.message.includes("net::ERR_ABORTED") || e.message.includes("Download is starting");
|
|
164
|
+
if (!mightBeDownload)
|
|
165
|
+
throw e;
|
|
166
|
+
const download = await Promise.race([
|
|
167
|
+
downloadEvent,
|
|
168
|
+
new Promise((resolve) => setTimeout(resolve, 3e3))
|
|
169
|
+
]);
|
|
170
|
+
if (!download)
|
|
171
|
+
throw e;
|
|
172
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
await this.waitForLoadState("load", { timeout: 5e3 });
|
|
176
|
+
}
|
|
177
|
+
async consoleMessages(type) {
|
|
178
|
+
await this.initializedPromise;
|
|
179
|
+
return this._consoleMessages.filter((message) => type ? message.type === type : true);
|
|
180
|
+
}
|
|
181
|
+
async requests() {
|
|
182
|
+
await this.initializedPromise;
|
|
183
|
+
return this._requests;
|
|
184
|
+
}
|
|
185
|
+
async captureSnapshot() {
|
|
186
|
+
let tabSnapshot;
|
|
187
|
+
const modalStates = await this._raceAgainstModalStates(async () => {
|
|
188
|
+
const snapshot = await this.page._snapshotForAI({ track: "response" });
|
|
189
|
+
tabSnapshot = {
|
|
190
|
+
url: this.page.url(),
|
|
191
|
+
title: await this.page.title(),
|
|
192
|
+
ariaSnapshot: snapshot.full,
|
|
193
|
+
ariaSnapshotDiff: this._needsFullSnapshot ? void 0 : snapshot.incremental,
|
|
194
|
+
modalStates: [],
|
|
195
|
+
consoleMessages: [],
|
|
196
|
+
downloads: this._downloads
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
if (tabSnapshot) {
|
|
200
|
+
tabSnapshot.consoleMessages = this._recentConsoleMessages;
|
|
201
|
+
this._recentConsoleMessages = [];
|
|
202
|
+
}
|
|
203
|
+
this._needsFullSnapshot = !tabSnapshot;
|
|
204
|
+
return tabSnapshot ?? {
|
|
205
|
+
url: this.page.url(),
|
|
206
|
+
title: "",
|
|
207
|
+
ariaSnapshot: "",
|
|
208
|
+
modalStates,
|
|
209
|
+
consoleMessages: [],
|
|
210
|
+
downloads: []
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
_javaScriptBlocked() {
|
|
214
|
+
return this._modalStates.some((state) => state.type === "dialog");
|
|
215
|
+
}
|
|
216
|
+
async _raceAgainstModalStates(action) {
|
|
217
|
+
if (this.modalStates().length)
|
|
218
|
+
return this.modalStates();
|
|
219
|
+
const promise = new import_utils.ManualPromise();
|
|
220
|
+
const listener = (modalState) => promise.resolve([modalState]);
|
|
221
|
+
this.once(TabEvents.modalState, listener);
|
|
222
|
+
return await Promise.race([
|
|
223
|
+
action().then(() => {
|
|
224
|
+
this.off(TabEvents.modalState, listener);
|
|
225
|
+
return [];
|
|
226
|
+
}),
|
|
227
|
+
promise
|
|
228
|
+
]);
|
|
229
|
+
}
|
|
230
|
+
async waitForCompletion(callback) {
|
|
231
|
+
await this._raceAgainstModalStates(() => (0, import_utils2.waitForCompletion)(this, callback));
|
|
232
|
+
}
|
|
233
|
+
async refLocator(params) {
|
|
234
|
+
return (await this.refLocators([params]))[0];
|
|
235
|
+
}
|
|
236
|
+
async refLocators(params) {
|
|
237
|
+
return Promise.all(params.map(async (param) => {
|
|
238
|
+
try {
|
|
239
|
+
const locator = this.page.locator(`aria-ref=${param.ref}`).describe(param.element);
|
|
240
|
+
const { resolvedSelector } = await locator._resolveSelector();
|
|
241
|
+
return { locator, resolved: (0, import_utils.asLocator)("javascript", resolvedSelector) };
|
|
242
|
+
} catch (e) {
|
|
243
|
+
throw new Error(`Ref ${param.ref} not found in the current page snapshot. Try capturing new snapshot.`);
|
|
244
|
+
}
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
async waitForTimeout(time) {
|
|
248
|
+
if (this._javaScriptBlocked()) {
|
|
249
|
+
await new Promise((f) => setTimeout(f, time));
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
await (0, import_utils2.callOnPageNoTrace)(this.page, (page) => {
|
|
253
|
+
return page.evaluate(() => new Promise((f) => setTimeout(f, 1e3)));
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function messageToConsoleMessage(message) {
|
|
258
|
+
return {
|
|
259
|
+
type: message.type(),
|
|
260
|
+
text: message.text(),
|
|
261
|
+
toString: () => `[${message.type().toUpperCase()}] ${message.text()} @ ${message.location().url}:${message.location().lineNumber}`
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function pageErrorToConsoleMessage(errorOrValue) {
|
|
265
|
+
if (errorOrValue instanceof Error) {
|
|
266
|
+
return {
|
|
267
|
+
type: "error",
|
|
268
|
+
text: errorOrValue.message,
|
|
269
|
+
toString: () => errorOrValue.stack || errorOrValue.message
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
type: "error",
|
|
274
|
+
text: String(errorOrValue),
|
|
275
|
+
toString: () => String(errorOrValue)
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function renderModalStates(context, modalStates) {
|
|
279
|
+
const result = ["### Modal state"];
|
|
280
|
+
if (modalStates.length === 0)
|
|
281
|
+
result.push("- There is no modal state present");
|
|
282
|
+
for (const state of modalStates)
|
|
283
|
+
result.push(`- [${state.description}]: can be handled by the "${state.clearedBy}" tool`);
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
const tabSymbol = Symbol("tabSymbol");
|
|
287
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
288
|
+
0 && (module.exports = {
|
|
289
|
+
Tab,
|
|
290
|
+
TabEvents,
|
|
291
|
+
renderModalStates
|
|
292
|
+
});
|