@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,159 @@
|
|
|
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 toMatchAriaSnapshot_exports = {};
|
|
30
|
+
__export(toMatchAriaSnapshot_exports, {
|
|
31
|
+
toMatchAriaSnapshot: () => toMatchAriaSnapshot
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(toMatchAriaSnapshot_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
37
|
+
var import_matcherHint = require("./matcherHint");
|
|
38
|
+
var import_util = require("../util");
|
|
39
|
+
var import_expect = require("./expect");
|
|
40
|
+
var import_globals = require("../common/globals");
|
|
41
|
+
async function toMatchAriaSnapshot(locator, expectedParam, options = {}) {
|
|
42
|
+
const matcherName = "toMatchAriaSnapshot";
|
|
43
|
+
const testInfo = (0, import_globals.currentTestInfo)();
|
|
44
|
+
if (!testInfo)
|
|
45
|
+
throw new Error(`toMatchAriaSnapshot() must be called during the test`);
|
|
46
|
+
if (testInfo._projectInternal.ignoreSnapshots)
|
|
47
|
+
return { pass: !this.isNot, message: () => "", name: "toMatchAriaSnapshot", expected: "" };
|
|
48
|
+
const updateSnapshots = testInfo.config.updateSnapshots;
|
|
49
|
+
let expected;
|
|
50
|
+
let timeout;
|
|
51
|
+
let expectedPath;
|
|
52
|
+
if ((0, import_utils.isString)(expectedParam)) {
|
|
53
|
+
expected = expectedParam;
|
|
54
|
+
timeout = options.timeout ?? this.timeout;
|
|
55
|
+
} else {
|
|
56
|
+
const legacyPath = testInfo._resolveSnapshotPaths("aria", expectedParam?.name, "dontUpdateSnapshotIndex", ".yml").absoluteSnapshotPath;
|
|
57
|
+
expectedPath = testInfo._resolveSnapshotPaths("aria", expectedParam?.name, "updateSnapshotIndex").absoluteSnapshotPath;
|
|
58
|
+
if (!await (0, import_util.fileExistsAsync)(expectedPath) && await (0, import_util.fileExistsAsync)(legacyPath))
|
|
59
|
+
expectedPath = legacyPath;
|
|
60
|
+
expected = await import_fs.default.promises.readFile(expectedPath, "utf8").catch(() => "");
|
|
61
|
+
timeout = expectedParam?.timeout ?? this.timeout;
|
|
62
|
+
}
|
|
63
|
+
const generateMissingBaseline = updateSnapshots === "missing" && !expected;
|
|
64
|
+
if (generateMissingBaseline) {
|
|
65
|
+
if (this.isNot) {
|
|
66
|
+
const message2 = `Matchers using ".not" can't generate new baselines`;
|
|
67
|
+
return { pass: this.isNot, message: () => message2, name: "toMatchAriaSnapshot" };
|
|
68
|
+
} else {
|
|
69
|
+
expected = `- none "Generating new baseline"`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
expected = unshift(expected);
|
|
73
|
+
const { matches: pass, received, log, timedOut, errorMessage } = await locator._expect("to.match.aria", { expectedValue: expected, isNot: this.isNot, timeout });
|
|
74
|
+
const typedReceived = received;
|
|
75
|
+
const message = () => {
|
|
76
|
+
let printedExpected;
|
|
77
|
+
let printedReceived;
|
|
78
|
+
let printedDiff;
|
|
79
|
+
if (errorMessage) {
|
|
80
|
+
printedExpected = `Expected: ${this.isNot ? "not " : ""}${this.utils.printExpected(expected)}`;
|
|
81
|
+
} else if (pass) {
|
|
82
|
+
const receivedString = (0, import_expect.printReceivedStringContainExpectedSubstring)(typedReceived.raw, typedReceived.raw.indexOf(expected), expected.length);
|
|
83
|
+
printedExpected = `Expected: not ${this.utils.printExpected(expected)}`;
|
|
84
|
+
printedReceived = `Received: ${receivedString}`;
|
|
85
|
+
} else {
|
|
86
|
+
printedDiff = this.utils.printDiffOrStringify(expected, typedReceived.raw, "Expected", "Received", false);
|
|
87
|
+
}
|
|
88
|
+
return (0, import_matcherHint.formatMatcherMessage)(this, {
|
|
89
|
+
matcherName,
|
|
90
|
+
expectation: "expected",
|
|
91
|
+
locator,
|
|
92
|
+
timeout,
|
|
93
|
+
timedOut,
|
|
94
|
+
printedExpected,
|
|
95
|
+
printedReceived,
|
|
96
|
+
printedDiff,
|
|
97
|
+
errorMessage,
|
|
98
|
+
log
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
if (errorMessage)
|
|
102
|
+
return { pass: this.isNot, message, name: "toMatchAriaSnapshot", expected };
|
|
103
|
+
if (!this.isNot) {
|
|
104
|
+
if (updateSnapshots === "all" || updateSnapshots === "changed" && pass === this.isNot || generateMissingBaseline) {
|
|
105
|
+
if (expectedPath) {
|
|
106
|
+
await import_fs.default.promises.mkdir(import_path.default.dirname(expectedPath), { recursive: true });
|
|
107
|
+
await import_fs.default.promises.writeFile(expectedPath, typedReceived.regex, "utf8");
|
|
108
|
+
const relativePath = import_path.default.relative(process.cwd(), expectedPath);
|
|
109
|
+
if (updateSnapshots === "missing") {
|
|
110
|
+
const message2 = `A snapshot doesn't exist at ${relativePath}, writing actual.`;
|
|
111
|
+
testInfo._hasNonRetriableError = true;
|
|
112
|
+
testInfo._failWithError(new Error(message2));
|
|
113
|
+
} else {
|
|
114
|
+
const message2 = `A snapshot is generated at ${relativePath}.`;
|
|
115
|
+
console.log(message2);
|
|
116
|
+
}
|
|
117
|
+
return { pass: true, message: () => "", name: "toMatchAriaSnapshot" };
|
|
118
|
+
} else {
|
|
119
|
+
const suggestedRebaseline = `\`
|
|
120
|
+
${(0, import_utils.escapeTemplateString)(indent(typedReceived.regex, "{indent} "))}
|
|
121
|
+
{indent}\``;
|
|
122
|
+
if (updateSnapshots === "missing") {
|
|
123
|
+
const message2 = "A snapshot is not provided, generating new baseline.";
|
|
124
|
+
testInfo._hasNonRetriableError = true;
|
|
125
|
+
testInfo._failWithError(new Error(message2));
|
|
126
|
+
}
|
|
127
|
+
return { pass: false, message: () => "", name: "toMatchAriaSnapshot", suggestedRebaseline };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
name: matcherName,
|
|
133
|
+
expected,
|
|
134
|
+
message,
|
|
135
|
+
pass,
|
|
136
|
+
actual: received,
|
|
137
|
+
log,
|
|
138
|
+
timeout: timedOut ? timeout : void 0
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function unshift(snapshot) {
|
|
142
|
+
const lines = snapshot.split("\n");
|
|
143
|
+
let whitespacePrefixLength = 100;
|
|
144
|
+
for (const line of lines) {
|
|
145
|
+
if (!line.trim())
|
|
146
|
+
continue;
|
|
147
|
+
const match = line.match(/^(\s*)/);
|
|
148
|
+
if (match && match[1].length < whitespacePrefixLength)
|
|
149
|
+
whitespacePrefixLength = match[1].length;
|
|
150
|
+
}
|
|
151
|
+
return lines.filter((t) => t.trim()).map((line) => line.substring(whitespacePrefixLength)).join("\n");
|
|
152
|
+
}
|
|
153
|
+
function indent(snapshot, indent2) {
|
|
154
|
+
return snapshot.split("\n").map((line) => indent2 + line).join("\n");
|
|
155
|
+
}
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {
|
|
158
|
+
toMatchAriaSnapshot
|
|
159
|
+
});
|
|
@@ -0,0 +1,341 @@
|
|
|
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 toMatchSnapshot_exports = {};
|
|
30
|
+
__export(toMatchSnapshot_exports, {
|
|
31
|
+
toHaveScreenshot: () => toHaveScreenshot,
|
|
32
|
+
toHaveScreenshotStepTitle: () => toHaveScreenshotStepTitle,
|
|
33
|
+
toMatchSnapshot: () => toMatchSnapshot
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(toMatchSnapshot_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
39
|
+
var import_utils2 = require("playwright-core/lib/utils");
|
|
40
|
+
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
41
|
+
var import_util = require("../util");
|
|
42
|
+
var import_matcherHint = require("./matcherHint");
|
|
43
|
+
var import_globals = require("../common/globals");
|
|
44
|
+
const NonConfigProperties = [
|
|
45
|
+
"clip",
|
|
46
|
+
"fullPage",
|
|
47
|
+
"mask",
|
|
48
|
+
"maskColor",
|
|
49
|
+
"omitBackground",
|
|
50
|
+
"timeout"
|
|
51
|
+
];
|
|
52
|
+
class SnapshotHelper {
|
|
53
|
+
constructor(testInfo, matcherName, locator, anonymousSnapshotExtension, configOptions, nameOrOptions, optOptions) {
|
|
54
|
+
let name;
|
|
55
|
+
if (Array.isArray(nameOrOptions) || typeof nameOrOptions === "string") {
|
|
56
|
+
name = nameOrOptions;
|
|
57
|
+
this.options = { ...optOptions };
|
|
58
|
+
} else {
|
|
59
|
+
const { name: nameFromOptions, ...options } = nameOrOptions;
|
|
60
|
+
this.options = options;
|
|
61
|
+
name = nameFromOptions;
|
|
62
|
+
}
|
|
63
|
+
this.name = Array.isArray(name) ? name.join(import_path.default.sep) : name || "";
|
|
64
|
+
const resolvedPaths = testInfo._resolveSnapshotPaths(matcherName === "toHaveScreenshot" ? "screenshot" : "snapshot", name, "updateSnapshotIndex", anonymousSnapshotExtension);
|
|
65
|
+
this.expectedPath = resolvedPaths.absoluteSnapshotPath;
|
|
66
|
+
this.attachmentBaseName = resolvedPaths.relativeOutputPath;
|
|
67
|
+
const outputBasePath = testInfo._getOutputPath(resolvedPaths.relativeOutputPath);
|
|
68
|
+
this.legacyExpectedPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-expected");
|
|
69
|
+
this.previousPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-previous");
|
|
70
|
+
this.actualPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-actual");
|
|
71
|
+
this.diffPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-diff");
|
|
72
|
+
const filteredConfigOptions = { ...configOptions };
|
|
73
|
+
for (const prop of NonConfigProperties)
|
|
74
|
+
delete filteredConfigOptions[prop];
|
|
75
|
+
this.options = {
|
|
76
|
+
...filteredConfigOptions,
|
|
77
|
+
...this.options
|
|
78
|
+
};
|
|
79
|
+
if (this.options._comparator) {
|
|
80
|
+
this.options.comparator = this.options._comparator;
|
|
81
|
+
delete this.options._comparator;
|
|
82
|
+
}
|
|
83
|
+
if (this.options.maxDiffPixels !== void 0 && this.options.maxDiffPixels < 0)
|
|
84
|
+
throw new Error("`maxDiffPixels` option value must be non-negative integer");
|
|
85
|
+
if (this.options.maxDiffPixelRatio !== void 0 && (this.options.maxDiffPixelRatio < 0 || this.options.maxDiffPixelRatio > 1))
|
|
86
|
+
throw new Error("`maxDiffPixelRatio` option value must be between 0 and 1");
|
|
87
|
+
this.matcherName = matcherName;
|
|
88
|
+
this.locator = locator;
|
|
89
|
+
this.updateSnapshots = testInfo.config.updateSnapshots;
|
|
90
|
+
this.mimeType = import_utilsBundle.mime.getType(import_path.default.basename(this.expectedPath)) ?? "application/octet-stream";
|
|
91
|
+
this.comparator = (0, import_utils.getComparator)(this.mimeType);
|
|
92
|
+
this.testInfo = testInfo;
|
|
93
|
+
this.kind = this.mimeType.startsWith("image/") ? "Screenshot" : "Snapshot";
|
|
94
|
+
}
|
|
95
|
+
createMatcherResult(message, pass, log) {
|
|
96
|
+
const unfiltered = {
|
|
97
|
+
name: this.matcherName,
|
|
98
|
+
expected: this.expectedPath,
|
|
99
|
+
actual: this.actualPath,
|
|
100
|
+
diff: this.diffPath,
|
|
101
|
+
pass,
|
|
102
|
+
message: () => message,
|
|
103
|
+
log
|
|
104
|
+
};
|
|
105
|
+
return Object.fromEntries(Object.entries(unfiltered).filter(([_, v]) => v !== void 0));
|
|
106
|
+
}
|
|
107
|
+
handleMissingNegated() {
|
|
108
|
+
const isWriteMissingMode = this.updateSnapshots !== "none";
|
|
109
|
+
const message = `A snapshot doesn't exist at ${this.expectedPath}${isWriteMissingMode ? `, matchers using ".not" won't write them automatically.` : "."}`;
|
|
110
|
+
return this.createMatcherResult(message, true);
|
|
111
|
+
}
|
|
112
|
+
handleDifferentNegated() {
|
|
113
|
+
return this.createMatcherResult("", false);
|
|
114
|
+
}
|
|
115
|
+
handleMatchingNegated() {
|
|
116
|
+
const message = [
|
|
117
|
+
import_utils2.colors.red(`${this.kind} comparison failed:`),
|
|
118
|
+
"",
|
|
119
|
+
indent("Expected result should be different from the actual one.", " ")
|
|
120
|
+
].join("\n");
|
|
121
|
+
return this.createMatcherResult(message, true);
|
|
122
|
+
}
|
|
123
|
+
handleMissing(actual, step) {
|
|
124
|
+
const isWriteMissingMode = this.updateSnapshots !== "none";
|
|
125
|
+
if (isWriteMissingMode)
|
|
126
|
+
writeFileSync(this.expectedPath, actual);
|
|
127
|
+
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-expected"), contentType: this.mimeType, path: this.expectedPath });
|
|
128
|
+
writeFileSync(this.actualPath, actual);
|
|
129
|
+
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-actual"), contentType: this.mimeType, path: this.actualPath });
|
|
130
|
+
const message = `A snapshot doesn't exist at ${this.expectedPath}${isWriteMissingMode ? ", writing actual." : "."}`;
|
|
131
|
+
if (this.updateSnapshots === "all" || this.updateSnapshots === "changed") {
|
|
132
|
+
console.log(message);
|
|
133
|
+
return this.createMatcherResult(message, true);
|
|
134
|
+
}
|
|
135
|
+
if (this.updateSnapshots === "missing") {
|
|
136
|
+
this.testInfo._hasNonRetriableError = true;
|
|
137
|
+
this.testInfo._failWithError(new Error(message));
|
|
138
|
+
return this.createMatcherResult("", true);
|
|
139
|
+
}
|
|
140
|
+
return this.createMatcherResult(message, false);
|
|
141
|
+
}
|
|
142
|
+
handleDifferent(actual, expected, previous, diff, header, diffError, log, step) {
|
|
143
|
+
const output = [`${header}${indent(diffError, " ")}`];
|
|
144
|
+
if (this.name) {
|
|
145
|
+
output.push("");
|
|
146
|
+
output.push(` Snapshot: ${this.name}`);
|
|
147
|
+
}
|
|
148
|
+
if (expected !== void 0) {
|
|
149
|
+
writeFileSync(this.legacyExpectedPath, expected);
|
|
150
|
+
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-expected"), contentType: this.mimeType, path: this.expectedPath });
|
|
151
|
+
}
|
|
152
|
+
if (previous !== void 0) {
|
|
153
|
+
writeFileSync(this.previousPath, previous);
|
|
154
|
+
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-previous"), contentType: this.mimeType, path: this.previousPath });
|
|
155
|
+
}
|
|
156
|
+
if (actual !== void 0) {
|
|
157
|
+
writeFileSync(this.actualPath, actual);
|
|
158
|
+
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-actual"), contentType: this.mimeType, path: this.actualPath });
|
|
159
|
+
}
|
|
160
|
+
if (diff !== void 0) {
|
|
161
|
+
writeFileSync(this.diffPath, diff);
|
|
162
|
+
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-diff"), contentType: this.mimeType, path: this.diffPath });
|
|
163
|
+
}
|
|
164
|
+
if (log?.length)
|
|
165
|
+
output.push((0, import_matcherHint.callLogText)(log));
|
|
166
|
+
else
|
|
167
|
+
output.push("");
|
|
168
|
+
return this.createMatcherResult(output.join("\n"), false, log);
|
|
169
|
+
}
|
|
170
|
+
handleMatching() {
|
|
171
|
+
return this.createMatcherResult("", true);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function toMatchSnapshot(received, nameOrOptions = {}, optOptions = {}) {
|
|
175
|
+
const testInfo = (0, import_globals.currentTestInfo)();
|
|
176
|
+
if (!testInfo)
|
|
177
|
+
throw new Error(`toMatchSnapshot() must be called during the test`);
|
|
178
|
+
if (received instanceof Promise)
|
|
179
|
+
throw new Error("An unresolved Promise was passed to toMatchSnapshot(), make sure to resolve it by adding await to it.");
|
|
180
|
+
if (testInfo._projectInternal.ignoreSnapshots)
|
|
181
|
+
return { pass: !this.isNot, message: () => "", name: "toMatchSnapshot", expected: nameOrOptions };
|
|
182
|
+
const configOptions = testInfo._projectInternal.expect?.toMatchSnapshot || {};
|
|
183
|
+
const helper = new SnapshotHelper(
|
|
184
|
+
testInfo,
|
|
185
|
+
"toMatchSnapshot",
|
|
186
|
+
void 0,
|
|
187
|
+
"." + determineFileExtension(received),
|
|
188
|
+
configOptions,
|
|
189
|
+
nameOrOptions,
|
|
190
|
+
optOptions
|
|
191
|
+
);
|
|
192
|
+
if (this.isNot) {
|
|
193
|
+
if (!import_fs.default.existsSync(helper.expectedPath))
|
|
194
|
+
return helper.handleMissingNegated();
|
|
195
|
+
const isDifferent = !!helper.comparator(received, import_fs.default.readFileSync(helper.expectedPath), helper.options);
|
|
196
|
+
return isDifferent ? helper.handleDifferentNegated() : helper.handleMatchingNegated();
|
|
197
|
+
}
|
|
198
|
+
if (!import_fs.default.existsSync(helper.expectedPath))
|
|
199
|
+
return helper.handleMissing(received, this._stepInfo);
|
|
200
|
+
const expected = import_fs.default.readFileSync(helper.expectedPath);
|
|
201
|
+
if (helper.updateSnapshots === "all") {
|
|
202
|
+
if (!(0, import_utils.compareBuffersOrStrings)(received, expected))
|
|
203
|
+
return helper.handleMatching();
|
|
204
|
+
writeFileSync(helper.expectedPath, received);
|
|
205
|
+
console.log(helper.expectedPath + " is not the same, writing actual.");
|
|
206
|
+
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
|
|
207
|
+
}
|
|
208
|
+
if (helper.updateSnapshots === "changed") {
|
|
209
|
+
const result2 = helper.comparator(received, expected, helper.options);
|
|
210
|
+
if (!result2)
|
|
211
|
+
return helper.handleMatching();
|
|
212
|
+
writeFileSync(helper.expectedPath, received);
|
|
213
|
+
console.log(helper.expectedPath + " does not match, writing actual.");
|
|
214
|
+
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
|
|
215
|
+
}
|
|
216
|
+
const result = helper.comparator(received, expected, helper.options);
|
|
217
|
+
if (!result)
|
|
218
|
+
return helper.handleMatching();
|
|
219
|
+
const header = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toMatchSnapshot", receiver: (0, import_utils.isString)(received) ? "string" : "Buffer", expectation: "expected" });
|
|
220
|
+
return helper.handleDifferent(received, expected, void 0, result.diff, header, result.errorMessage, void 0, this._stepInfo);
|
|
221
|
+
}
|
|
222
|
+
function toHaveScreenshotStepTitle(nameOrOptions = {}, optOptions = {}) {
|
|
223
|
+
let name;
|
|
224
|
+
if (typeof nameOrOptions === "object" && !Array.isArray(nameOrOptions))
|
|
225
|
+
name = nameOrOptions.name;
|
|
226
|
+
else
|
|
227
|
+
name = nameOrOptions;
|
|
228
|
+
return Array.isArray(name) ? name.join(import_path.default.sep) : name || "";
|
|
229
|
+
}
|
|
230
|
+
async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions = {}) {
|
|
231
|
+
const testInfo = (0, import_globals.currentTestInfo)();
|
|
232
|
+
if (!testInfo)
|
|
233
|
+
throw new Error(`toHaveScreenshot() must be called during the test`);
|
|
234
|
+
if (testInfo._projectInternal.ignoreSnapshots)
|
|
235
|
+
return { pass: !this.isNot, message: () => "", name: "toHaveScreenshot", expected: nameOrOptions };
|
|
236
|
+
(0, import_util.expectTypes)(pageOrLocator, ["Page", "Locator"], "toHaveScreenshot");
|
|
237
|
+
const [page, locator] = pageOrLocator.constructor.name === "Page" ? [pageOrLocator, void 0] : [pageOrLocator.page(), pageOrLocator];
|
|
238
|
+
const configOptions = testInfo._projectInternal.expect?.toHaveScreenshot || {};
|
|
239
|
+
const helper = new SnapshotHelper(testInfo, "toHaveScreenshot", locator, void 0, configOptions, nameOrOptions, optOptions);
|
|
240
|
+
if (!helper.expectedPath.toLowerCase().endsWith(".png"))
|
|
241
|
+
throw new Error(`Screenshot name "${import_path.default.basename(helper.expectedPath)}" must have '.png' extension`);
|
|
242
|
+
(0, import_util.expectTypes)(pageOrLocator, ["Page", "Locator"], "toHaveScreenshot");
|
|
243
|
+
const style = await loadScreenshotStyles(helper.options.stylePath);
|
|
244
|
+
const timeout = helper.options.timeout ?? this.timeout;
|
|
245
|
+
const expectScreenshotOptions = {
|
|
246
|
+
locator,
|
|
247
|
+
animations: helper.options.animations ?? "disabled",
|
|
248
|
+
caret: helper.options.caret ?? "hide",
|
|
249
|
+
clip: helper.options.clip,
|
|
250
|
+
fullPage: helper.options.fullPage,
|
|
251
|
+
mask: helper.options.mask,
|
|
252
|
+
maskColor: helper.options.maskColor,
|
|
253
|
+
omitBackground: helper.options.omitBackground,
|
|
254
|
+
scale: helper.options.scale ?? "css",
|
|
255
|
+
style,
|
|
256
|
+
isNot: !!this.isNot,
|
|
257
|
+
timeout,
|
|
258
|
+
comparator: helper.options.comparator,
|
|
259
|
+
maxDiffPixels: helper.options.maxDiffPixels,
|
|
260
|
+
maxDiffPixelRatio: helper.options.maxDiffPixelRatio,
|
|
261
|
+
threshold: helper.options.threshold
|
|
262
|
+
};
|
|
263
|
+
const hasSnapshot = import_fs.default.existsSync(helper.expectedPath);
|
|
264
|
+
if (this.isNot) {
|
|
265
|
+
if (!hasSnapshot)
|
|
266
|
+
return helper.handleMissingNegated();
|
|
267
|
+
expectScreenshotOptions.expected = await import_fs.default.promises.readFile(helper.expectedPath);
|
|
268
|
+
const isDifferent = !(await page._expectScreenshot(expectScreenshotOptions)).errorMessage;
|
|
269
|
+
return isDifferent ? helper.handleDifferentNegated() : helper.handleMatchingNegated();
|
|
270
|
+
}
|
|
271
|
+
if (helper.updateSnapshots === "none" && !hasSnapshot)
|
|
272
|
+
return helper.createMatcherResult(`A snapshot doesn't exist at ${helper.expectedPath}.`, false);
|
|
273
|
+
if (!hasSnapshot) {
|
|
274
|
+
const { actual: actual2, previous: previous2, diff: diff2, errorMessage: errorMessage2, log: log2, timedOut: timedOut2 } = await page._expectScreenshot(expectScreenshotOptions);
|
|
275
|
+
if (errorMessage2) {
|
|
276
|
+
const header2 = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toHaveScreenshot", locator, expectation: "expected", timeout, timedOut: timedOut2 });
|
|
277
|
+
return helper.handleDifferent(actual2, void 0, previous2, diff2, header2, errorMessage2, log2, this._stepInfo);
|
|
278
|
+
}
|
|
279
|
+
return helper.handleMissing(actual2, this._stepInfo);
|
|
280
|
+
}
|
|
281
|
+
const expected = await import_fs.default.promises.readFile(helper.expectedPath);
|
|
282
|
+
expectScreenshotOptions.expected = helper.updateSnapshots === "all" ? void 0 : expected;
|
|
283
|
+
const { actual, previous, diff, errorMessage, log, timedOut } = await page._expectScreenshot(expectScreenshotOptions);
|
|
284
|
+
const writeFiles = (actualBuffer) => {
|
|
285
|
+
writeFileSync(helper.expectedPath, actualBuffer);
|
|
286
|
+
writeFileSync(helper.actualPath, actualBuffer);
|
|
287
|
+
console.log(helper.expectedPath + " is re-generated, writing actual.");
|
|
288
|
+
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
|
|
289
|
+
};
|
|
290
|
+
if (!errorMessage) {
|
|
291
|
+
if (helper.updateSnapshots === "all" && actual && (0, import_utils.compareBuffersOrStrings)(actual, expected)) {
|
|
292
|
+
console.log(helper.expectedPath + " is re-generated, writing actual.");
|
|
293
|
+
return writeFiles(actual);
|
|
294
|
+
}
|
|
295
|
+
return helper.handleMatching();
|
|
296
|
+
}
|
|
297
|
+
if (helper.updateSnapshots === "changed" || helper.updateSnapshots === "all") {
|
|
298
|
+
if (actual)
|
|
299
|
+
return writeFiles(actual);
|
|
300
|
+
let header2 = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toHaveScreenshot", locator, expectation: "expected", timeout, timedOut });
|
|
301
|
+
header2 += " Failed to re-generate expected.\n";
|
|
302
|
+
return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header2, errorMessage, log, this._stepInfo);
|
|
303
|
+
}
|
|
304
|
+
const header = (0, import_matcherHint.formatMatcherMessage)(this, { matcherName: "toHaveScreenshot", locator, expectation: "expected", timeout, timedOut });
|
|
305
|
+
return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header, errorMessage, log, this._stepInfo);
|
|
306
|
+
}
|
|
307
|
+
function writeFileSync(aPath, content) {
|
|
308
|
+
import_fs.default.mkdirSync(import_path.default.dirname(aPath), { recursive: true });
|
|
309
|
+
import_fs.default.writeFileSync(aPath, content);
|
|
310
|
+
}
|
|
311
|
+
function indent(lines, tab) {
|
|
312
|
+
return lines.replace(/^(?=.+$)/gm, tab);
|
|
313
|
+
}
|
|
314
|
+
function determineFileExtension(file) {
|
|
315
|
+
if (typeof file === "string")
|
|
316
|
+
return "txt";
|
|
317
|
+
if (compareMagicBytes(file, [137, 80, 78, 71, 13, 10, 26, 10]))
|
|
318
|
+
return "png";
|
|
319
|
+
if (compareMagicBytes(file, [255, 216, 255]))
|
|
320
|
+
return "jpg";
|
|
321
|
+
return "dat";
|
|
322
|
+
}
|
|
323
|
+
function compareMagicBytes(file, magicBytes) {
|
|
324
|
+
return Buffer.compare(Buffer.from(magicBytes), file.slice(0, magicBytes.length)) === 0;
|
|
325
|
+
}
|
|
326
|
+
async function loadScreenshotStyles(stylePath) {
|
|
327
|
+
if (!stylePath)
|
|
328
|
+
return;
|
|
329
|
+
const stylePaths = Array.isArray(stylePath) ? stylePath : [stylePath];
|
|
330
|
+
const styles = await Promise.all(stylePaths.map(async (stylePath2) => {
|
|
331
|
+
const text = await import_fs.default.promises.readFile(stylePath2, "utf8");
|
|
332
|
+
return text.trim();
|
|
333
|
+
}));
|
|
334
|
+
return styles.join("\n").trim() || void 0;
|
|
335
|
+
}
|
|
336
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
337
|
+
0 && (module.exports = {
|
|
338
|
+
toHaveScreenshot,
|
|
339
|
+
toHaveScreenshotStepTitle,
|
|
340
|
+
toMatchSnapshot
|
|
341
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
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 toMatchText_exports = {};
|
|
20
|
+
__export(toMatchText_exports, {
|
|
21
|
+
toMatchText: () => toMatchText
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(toMatchText_exports);
|
|
24
|
+
var import_util = require("../util");
|
|
25
|
+
var import_expect = require("./expect");
|
|
26
|
+
var import_matcherHint = require("./matcherHint");
|
|
27
|
+
var import_expectBundle = require("../common/expectBundle");
|
|
28
|
+
async function toMatchText(matcherName, receiver, receiverType, query, expected, options = {}) {
|
|
29
|
+
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
|
|
30
|
+
const locator = receiverType === "Locator" ? receiver : void 0;
|
|
31
|
+
if (!(typeof expected === "string") && !(expected && typeof expected.test === "function")) {
|
|
32
|
+
const errorMessage2 = `Error: ${(0, import_expectBundle.EXPECTED_COLOR)("expected")} value must be a string or regular expression
|
|
33
|
+
${this.utils.printWithType("Expected", expected, this.utils.printExpected)}`;
|
|
34
|
+
throw new Error((0, import_matcherHint.formatMatcherMessage)(this, { locator, matcherName, expectation: "expected", errorMessage: errorMessage2 }));
|
|
35
|
+
}
|
|
36
|
+
const timeout = options.timeout ?? this.timeout;
|
|
37
|
+
const { matches: pass, received, log, timedOut, errorMessage } = await query(!!this.isNot, timeout);
|
|
38
|
+
if (pass === !this.isNot) {
|
|
39
|
+
return {
|
|
40
|
+
name: matcherName,
|
|
41
|
+
message: () => "",
|
|
42
|
+
pass,
|
|
43
|
+
expected
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const expectedSuffix = typeof expected === "string" ? options.matchSubstring ? " substring" : "" : " pattern";
|
|
47
|
+
const receivedSuffix = typeof expected === "string" ? options.matchSubstring ? " string" : "" : " string";
|
|
48
|
+
const receivedString = received || "";
|
|
49
|
+
let printedReceived;
|
|
50
|
+
let printedExpected;
|
|
51
|
+
let printedDiff;
|
|
52
|
+
if (pass) {
|
|
53
|
+
if (typeof expected === "string") {
|
|
54
|
+
printedExpected = `Expected${expectedSuffix}: not ${this.utils.printExpected(expected)}`;
|
|
55
|
+
if (!errorMessage) {
|
|
56
|
+
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedSubstring)(receivedString, receivedString.indexOf(expected), expected.length);
|
|
57
|
+
printedReceived = `Received${receivedSuffix}: ${formattedReceived}`;
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
printedExpected = `Expected${expectedSuffix}: not ${this.utils.printExpected(expected)}`;
|
|
61
|
+
if (!errorMessage) {
|
|
62
|
+
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedResult)(receivedString, typeof expected.exec === "function" ? expected.exec(receivedString) : null);
|
|
63
|
+
printedReceived = `Received${receivedSuffix}: ${formattedReceived}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
if (errorMessage)
|
|
68
|
+
printedExpected = `Expected${expectedSuffix}: ${this.utils.printExpected(expected)}`;
|
|
69
|
+
else
|
|
70
|
+
printedDiff = this.utils.printDiffOrStringify(expected, receivedString, `Expected${expectedSuffix}`, `Received${receivedSuffix}`, false);
|
|
71
|
+
}
|
|
72
|
+
const message = () => {
|
|
73
|
+
return (0, import_matcherHint.formatMatcherMessage)(this, {
|
|
74
|
+
matcherName,
|
|
75
|
+
expectation: "expected",
|
|
76
|
+
locator,
|
|
77
|
+
timeout,
|
|
78
|
+
timedOut,
|
|
79
|
+
printedExpected,
|
|
80
|
+
printedReceived,
|
|
81
|
+
printedDiff,
|
|
82
|
+
log,
|
|
83
|
+
errorMessage
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
name: matcherName,
|
|
88
|
+
expected,
|
|
89
|
+
message,
|
|
90
|
+
pass,
|
|
91
|
+
actual: received,
|
|
92
|
+
log,
|
|
93
|
+
timeout: timedOut ? timeout : void 0
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
toMatchText
|
|
99
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var actions_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(actions_d_exports);
|