From fe0545efc0f3a7b8116539cba235a5f0cd438656 Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Sun, 4 May 2025 02:12:41 -0700 Subject: [PATCH] fix(deps): update dependency playwright to v1.52.0 --- tvapp2/node_modules/.package-lock.json | 10 +- .../playwright-core/browsers.json | 28 +- .../playwright-core/lib/androidServerImpl.js | 90 +- .../playwright-core/lib/browserServerImpl.js | 121 +- .../playwright-core/lib/cli/driver.js | 140 +- .../playwright-core/lib/cli/program.js | 640 ++- .../lib/cli/programWithTestStub.js | 96 +- .../lib/client/accessibility.js | 63 +- .../playwright-core/lib/client/android.js | 369 +- .../playwright-core/lib/client/api.js | 414 +- .../playwright-core/lib/client/artifact.js | 75 +- .../playwright-core/lib/client/browser.js | 118 +- .../lib/client/browserContext.js | 643 ++- .../playwright-core/lib/client/browserType.js | 198 +- .../playwright-core/lib/client/cdpSession.js | 60 +- .../lib/client/channelOwner.js | 177 +- .../lib/client/clientHelper.js | 87 +- .../lib/client/clientInstrumentation.js | 77 +- .../playwright-core/lib/client/clock.js | 72 +- .../playwright-core/lib/client/connection.js | 402 +- .../lib/client/consoleMessage.js | 59 +- .../playwright-core/lib/client/coverage.js | 47 +- .../playwright-core/lib/client/dialog.js | 61 +- .../playwright-core/lib/client/download.js | 50 +- .../playwright-core/lib/client/electron.js | 148 +- .../lib/client/elementHandle.js | 258 +- .../playwright-core/lib/client/errors.js | 106 +- .../lib/client/eventEmitter.js | 245 +- .../playwright-core/lib/client/events.js | 140 +- .../playwright-core/lib/client/fetch.js | 293 +- .../playwright-core/lib/client/fileChooser.js | 49 +- .../playwright-core/lib/client/frame.js | 513 +- .../playwright-core/lib/client/harRouter.js | 94 +- .../playwright-core/lib/client/input.js | 109 +- .../playwright-core/lib/client/jsHandle.js | 123 +- .../playwright-core/lib/client/jsonPipe.js | 50 +- .../playwright-core/lib/client/localUtils.js | 57 +- .../playwright-core/lib/client/locator.js | 373 +- .../playwright-core/lib/client/network.js | 574 +-- .../playwright-core/lib/client/page.js | 606 +-- .../playwright-core/lib/client/playwright.js | 117 +- .../playwright-core/lib/client/selectors.js | 94 +- .../playwright-core/lib/client/stream.js | 54 +- .../playwright-core/lib/client/tracing.js | 132 +- .../playwright-core/lib/client/types.js | 48 +- .../playwright-core/lib/client/video.js | 62 +- .../playwright-core/lib/client/waiter.js | 157 +- .../playwright-core/lib/client/webError.js | 48 +- .../playwright-core/lib/client/worker.js | 104 +- .../lib/client/writableStream.js | 50 +- .../lib/generated/clockSource.js | 31 +- .../lib/generated/consoleApiSource.js | 31 +- .../lib/generated/injectedScriptSource.js | 31 +- .../lib/generated/pollingRecorderSource.js | 31 +- .../lib/generated/utilityScriptSource.js | 31 +- .../lib/generated/webSocketMockSource.js | 381 +- .../playwright-core/lib/inProcessFactory.js | 106 +- .../playwright-core/lib/inprocess.js | 21 +- .../playwright-core/lib/outofprocess.js | 99 +- .../playwright-core/lib/protocol/debug.js | 234 +- .../lib/protocol/serializers.js | 293 +- .../playwright-core/lib/protocol/validator.js | 4592 ++++++++--------- .../lib/protocol/validatorPrimitives.js | 187 +- .../lib/remote/playwrightConnection.js | 297 +- .../lib/remote/playwrightServer.js | 185 +- .../lib/server/accessibility.js | 81 +- .../lib/server/android/android.js | 425 +- .../lib/server/android/backendAdb.js | 171 +- .../playwright-core/lib/server/artifact.js | 133 +- .../lib/server/bidi/bidiBrowser.js | 374 +- .../lib/server/bidi/bidiChromium.js | 185 +- .../lib/server/bidi/bidiConnection.js | 149 +- .../lib/server/bidi/bidiExecutionContext.js | 241 +- .../lib/server/bidi/bidiFirefox.js | 145 +- .../lib/server/bidi/bidiInput.js | 183 +- .../lib/server/bidi/bidiNetworkManager.js | 291 +- .../lib/server/bidi/bidiOverCdp.js | 115 +- .../lib/server/bidi/bidiPage.js | 466 +- .../lib/server/bidi/bidiPdf.js | 140 +- .../bidi/third_party/bidiDeserializer.js | 105 +- .../server/bidi/third_party/bidiKeyboard.js | 456 +- .../server/bidi/third_party/bidiProtocol.js | 275 +- .../server/bidi/third_party/bidiSerializer.js | 130 +- .../server/bidi/third_party/firefoxPrefs.js | 260 +- .../playwright-core/lib/server/browser.js | 160 +- .../lib/server/browserContext.js | 674 ++- .../playwright-core/lib/server/browserType.js | 351 +- .../lib/server/chromium/chromium.js | 406 +- .../lib/server/chromium/chromiumSwitches.js | 164 +- .../lib/server/chromium/crAccessibility.js | 288 +- .../lib/server/chromium/crBrowser.js | 527 +- .../lib/server/chromium/crConnection.js | 209 +- .../lib/server/chromium/crCoverage.js | 238 +- .../lib/server/chromium/crDevTools.js | 111 +- .../lib/server/chromium/crDragDrop.js | 141 +- .../lib/server/chromium/crExecutionContext.js | 171 +- .../lib/server/chromium/crInput.js | 192 +- .../lib/server/chromium/crNetworkManager.js | 639 +-- .../lib/server/chromium/crPage.js | 1070 ++-- .../lib/server/chromium/crPdf.js | 142 +- .../lib/server/chromium/crProtocolHelper.js | 172 +- .../lib/server/chromium/crServiceWorker.js | 152 +- .../server/chromium/defaultFontFamilies.js | 287 +- .../lib/server/chromium/videoRecorder.js | 164 +- .../playwright-core/lib/server/clock.js | 104 +- .../lib/server/codegen/csharp.js | 345 +- .../lib/server/codegen/java.js | 283 +- .../lib/server/codegen/javascript.js | 311 +- .../lib/server/codegen/jsonl.js | 60 +- .../lib/server/codegen/language.js | 127 +- .../lib/server/codegen/languages.js | 92 +- .../lib/server/codegen/python.js | 265 +- .../lib/server/codegen/types.js | 19 +- .../playwright-core/lib/server/console.js | 60 +- .../playwright-core/lib/server/cookieStore.js | 191 +- .../lib/server/debugController.js | 221 +- .../playwright-core/lib/server/debugger.js | 160 +- .../lib/server/deviceDescriptors.js | 61 +- .../lib/server/deviceDescriptorsSource.json | 100 +- .../playwright-core/lib/server/dialog.js | 71 +- .../server/dispatchers/androidDispatcher.js | 303 +- .../server/dispatchers/artifactDispatcher.js | 126 +- .../dispatchers/browserContextDispatcher.js | 381 +- .../server/dispatchers/browserDispatcher.js | 175 +- .../dispatchers/browserTypeDispatcher.js | 70 +- .../dispatchers/cdpSessionDispatcher.js | 68 +- .../dispatchers/debugControllerDispatcher.js | 114 +- .../server/dispatchers/dialogDispatcher.js | 57 +- .../lib/server/dispatchers/dispatcher.js | 403 +- .../server/dispatchers/electronDispatcher.js | 111 +- .../dispatchers/elementHandlerDispatcher.js | 198 +- .../lib/server/dispatchers/frameDispatcher.js | 254 +- .../server/dispatchers/jsHandleDispatcher.js | 115 +- .../server/dispatchers/jsonPipeDispatcher.js | 71 +- .../dispatchers/localUtilsDispatcher.js | 175 +- .../server/dispatchers/networkDispatchers.js | 197 +- .../lib/server/dispatchers/pageDispatcher.js | 297 +- .../dispatchers/playwrightDispatcher.js | 145 +- .../server/dispatchers/selectorsDispatcher.js | 52 +- .../server/dispatchers/streamDispatcher.js | 87 +- .../server/dispatchers/tracingDispatcher.js | 77 +- .../dispatchers/webSocketRouteDispatcher.js | 227 +- .../dispatchers/writableStreamDispatcher.js | 92 +- .../playwright-core/lib/server/dom.js | 858 ++- .../playwright-core/lib/server/download.js | 80 +- .../lib/server/electron/electron.js | 332 +- .../lib/server/electron/loader.js | 44 +- .../playwright-core/lib/server/errors.js | 93 +- .../playwright-core/lib/server/fetch.js | 612 ++- .../playwright-core/lib/server/fileChooser.js | 49 +- .../lib/server/fileUploadUtils.js | 124 +- .../lib/server/firefox/ffAccessibility.js | 284 +- .../lib/server/firefox/ffBrowser.js | 490 +- .../lib/server/firefox/ffConnection.js | 149 +- .../lib/server/firefox/ffExecutionContext.js | 164 +- .../lib/server/firefox/ffInput.js | 136 +- .../lib/server/firefox/ffNetworkManager.js | 241 +- .../lib/server/firefox/ffPage.js | 509 +- .../lib/server/firefox/firefox.js | 143 +- .../playwright-core/lib/server/formData.js | 142 +- .../lib/server/frameSelectors.js | 188 +- .../playwright-core/lib/server/frames.js | 1549 +++--- .../lib/server/har/harRecorder.js | 162 +- .../lib/server/har/harTracer.js | 509 +- .../playwright-core/lib/server/helper.js | 115 +- .../playwright-core/lib/server/index.js | 154 +- .../playwright-core/lib/server/input.js | 297 +- .../lib/server/instrumentation.js | 93 +- .../isomorphic/utilityScriptSerializers.js | 229 - .../playwright-core/lib/server/javascript.js | 271 +- .../playwright-core/lib/server/launchApp.js | 169 +- .../lib/server/macEditingCommands.js | 278 +- .../playwright-core/lib/server/network.js | 558 +- .../playwright-core/lib/server/page.js | 760 ++- .../lib/server/pipeTransport.js | 94 +- .../playwright-core/lib/server/playwright.js | 127 +- .../playwright-core/lib/server/progress.js | 107 +- .../lib/server/protocolError.js | 65 +- .../playwright-core/lib/server/recorder.js | 363 +- .../lib/server/recorder/chat.js | 156 +- .../lib/server/recorder/contextRecorder.js | 272 +- .../lib/server/recorder/recorderApp.js | 263 +- .../lib/server/recorder/recorderCollection.js | 100 +- .../lib/server/recorder/recorderFrontend.js | 19 +- .../lib/server/recorder/recorderRunner.js | 182 +- .../lib/server/recorder/recorderUtils.js | 101 +- .../lib/server/recorder/throttledFile.js | 72 +- .../lib/server/registry/browserFetcher.js | 207 +- .../lib/server/registry/dependencies.js | 441 +- .../lib/server/registry/index.js | 1696 +++--- .../lib/server/registry/nativeDeps.js | 1537 ++++-- .../server/registry/oopDownloadBrowserMain.js | 132 +- .../lib/server/screenshotter.js | 348 +- .../playwright-core/lib/server/selectors.js | 131 +- .../socksClientCertificatesInterceptor.js | 351 +- .../lib/server/socksInterceptor.js | 132 +- .../lib/server/trace/recorder/snapshotter.js | 159 +- .../trace/recorder/snapshotterInjected.js | 455 +- .../lib/server/trace/recorder/tracing.js | 656 ++- .../server/trace/test/inMemorySnapshotter.js | 98 +- .../lib/server/trace/viewer/traceViewer.js | 314 +- .../playwright-core/lib/server/transport.js | 257 +- .../playwright-core/lib/server/types.js | 48 +- .../lib/server/usKeyboardLayout.js | 696 +-- .../lib/server/webkit/webkit.js | 139 +- .../lib/server/webkit/wkAccessibility.js | 279 +- .../lib/server/webkit/wkBrowser.js | 335 +- .../lib/server/webkit/wkConnection.js | 142 +- .../lib/server/webkit/wkExecutionContext.js | 154 +- .../lib/server/webkit/wkInput.js | 162 +- .../server/webkit/wkInterceptableRequest.js | 197 +- .../lib/server/webkit/wkPage.js | 1144 ++-- .../lib/server/webkit/wkProvisionalPage.js | 101 +- .../lib/server/webkit/wkWorkers.js | 154 +- .../lib/utils/isomorphic/ariaSnapshot.js | 296 +- .../lib/utils/isomorphic/cssParser.js | 246 +- .../lib/utils/isomorphic/cssTokenizer.js | 800 +-- .../lib/utils/isomorphic/locatorGenerators.js | 697 ++- .../lib/utils/isomorphic/locatorParser.js | 201 +- .../lib/utils/isomorphic/locatorUtils.js | 107 +- .../lib/utils/isomorphic/mimeType.js | 473 +- .../lib/utils/isomorphic/selectorParser.js | 376 +- .../lib/utils/isomorphic/stringUtils.js | 215 +- .../lib/utils/isomorphic/traceUtils.js | 79 +- .../lib/utils/isomorphic/urlMatch.js | 179 +- .../playwright-core/lib/utilsBundle.js | 153 +- .../lib/vite/htmlReport/index.html | 36 +- .../lib/vite/recorder/index.html | 2 +- .../lib/vite/traceViewer/index.html | 6 +- .../lib/vite/traceViewer/sw.bundle.js | 6 +- .../lib/vite/traceViewer/uiMode.html | 6 +- .../playwright-core/lib/zipBundle.js | 55 +- .../node_modules/playwright-core/package.json | 2 +- .../playwright-core/types/protocol.d.ts | 453 +- .../playwright-core/types/types.d.ts | 51 +- tvapp2/node_modules/playwright/README.md | 6 +- .../playwright/lib/common/config.js | 301 +- .../playwright/lib/common/configLoader.js | 408 +- .../playwright/lib/common/esmLoaderHost.js | 155 +- .../playwright/lib/common/expectBundle.js | 75 +- .../playwright/lib/common/fixtures.js | 292 +- .../playwright/lib/common/globals.js | 62 +- .../node_modules/playwright/lib/common/ipc.js | 89 +- .../playwright/lib/common/poolBuilder.js | 104 +- .../playwright/lib/common/process.js | 171 +- .../playwright/lib/common/suiteUtils.js | 181 +- .../playwright/lib/common/test.js | 182 +- .../playwright/lib/common/testLoader.js | 138 +- .../playwright/lib/common/testType.js | 352 +- .../node_modules/playwright/lib/fsWatcher.js | 90 +- tvapp2/node_modules/playwright/lib/index.js | 1009 ++-- .../playwright/lib/internalsForTest.js | 64 +- .../playwright/lib/isomorphic/events.js | 93 +- .../playwright/lib/isomorphic/folders.js | 47 +- .../lib/isomorphic/stringInternPool.js | 65 +- .../playwright/lib/isomorphic/teleReceiver.js | 366 +- .../lib/isomorphic/teleSuiteUpdater.js | 137 +- .../lib/isomorphic/testServerConnection.js | 181 +- .../lib/isomorphic/testServerInterface.js | 19 +- .../playwright/lib/isomorphic/testTree.js | 237 +- .../playwright/lib/loader/loaderMain.js | 83 +- .../playwright/lib/matchers/expect.js | 427 +- .../playwright/lib/matchers/matcherHint.js | 82 +- .../playwright/lib/matchers/matchers.js | 601 +-- .../playwright/lib/matchers/toBeTruthy.js | 80 +- .../playwright/lib/matchers/toEqual.js | 105 +- .../lib/matchers/toMatchAriaSnapshot.js | 236 +- .../lib/matchers/toMatchSnapshot.js | 483 +- .../playwright/lib/matchers/toMatchText.js | 104 +- .../lib/plugins/gitCommitInfoPlugin.js | 244 +- .../playwright/lib/plugins/index.js | 34 +- .../playwright/lib/plugins/webServerPlugin.js | 228 +- tvapp2/node_modules/playwright/lib/program.js | 512 +- .../playwright/lib/reporters/base.js | 532 +- .../playwright/lib/reporters/blob.js | 166 +- .../playwright/lib/reporters/dot.js | 81 +- .../playwright/lib/reporters/empty.js | 45 +- .../playwright/lib/reporters/github.js | 120 +- .../playwright/lib/reporters/html.js | 577 +-- .../lib/reporters/internalReporter.js | 153 +- .../playwright/lib/reporters/json.js | 201 +- .../playwright/lib/reporters/junit.js | 217 +- .../playwright/lib/reporters/line.js | 95 +- .../playwright/lib/reporters/list.js | 176 +- .../playwright/lib/reporters/markdown.js | 76 - .../playwright/lib/reporters/merge.js | 399 +- .../playwright/lib/reporters/multiplexer.js | 125 +- .../playwright/lib/reporters/reporterV2.js | 116 +- .../playwright/lib/reporters/teleEmitter.js | 174 +- .../lib/reporters/versions/blobV1.js | 19 +- .../playwright/lib/runner/dispatcher.js | 537 +- .../playwright/lib/runner/failureTracker.js | 61 +- .../playwright/lib/runner/lastRun.js | 100 +- .../playwright/lib/runner/loadUtils.js | 324 +- .../playwright/lib/runner/loaderHost.js | 102 +- .../playwright/lib/runner/processHost.js | 196 +- .../playwright/lib/runner/projectUtils.js | 242 +- .../playwright/lib/runner/rebase.js | 223 +- .../playwright/lib/runner/reporters.js | 193 +- .../playwright/lib/runner/runner.js | 171 +- .../playwright/lib/runner/sigIntWatcher.js | 116 +- .../playwright/lib/runner/taskRunner.js | 143 +- .../playwright/lib/runner/tasks.js | 493 +- .../playwright/lib/runner/testGroups.js | 107 +- .../playwright/lib/runner/testServer.js | 620 +-- .../playwright/lib/runner/uiModeReporter.js | 51 +- .../node_modules/playwright/lib/runner/vcs.js | 101 +- .../playwright/lib/runner/watchMode.js | 572 +- .../playwright/lib/runner/workerHost.js | 104 +- .../lib/third_party/tsconfig-loader.js | 141 +- .../playwright/lib/transform/babelBundle.js | 67 +- .../lib/transform/babelBundleImpl.js | 1965 +------ .../lib/transform/compilationCache.js | 297 +- .../playwright/lib/transform/esmLoader.js | 153 +- .../playwright/lib/transform/esmUtils.js | 75 +- .../playwright/lib/transform/portTransport.js | 81 +- .../playwright/lib/transform/transform.js | 331 +- tvapp2/node_modules/playwright/lib/util.js | 469 +- .../playwright/lib/utilsBundle.js | 71 +- .../playwright/lib/worker/fixtureRunner.js | 235 +- .../playwright/lib/worker/testInfo.js | 452 +- .../playwright/lib/worker/testTracing.js | 361 +- .../playwright/lib/worker/timeoutManager.js | 201 +- .../playwright/lib/worker/util.js | 54 +- .../playwright/lib/worker/workerMain.js | 593 +-- tvapp2/node_modules/playwright/package.json | 4 +- .../node_modules/playwright/types/test.d.ts | 169 +- .../playwright/types/testReporter.d.ts | 51 +- tvapp2/package-lock.json | 26 +- tvapp2/package.json | 2 +- 330 files changed, 39393 insertions(+), 40882 deletions(-) delete mode 100755 tvapp2/node_modules/playwright-core/lib/server/isomorphic/utilityScriptSerializers.js delete mode 100755 tvapp2/node_modules/playwright/lib/reporters/markdown.js diff --git a/tvapp2/node_modules/.package-lock.json b/tvapp2/node_modules/.package-lock.json index 20e40559..f8727da4 100755 --- a/tvapp2/node_modules/.package-lock.json +++ b/tvapp2/node_modules/.package-lock.json @@ -3335,10 +3335,12 @@ } }, "node_modules/playwright": { - "version": "1.51.1", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", + "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.51.1" + "playwright-core": "1.52.0" }, "bin": { "playwright": "cli.js" @@ -3351,7 +3353,9 @@ } }, "node_modules/playwright-core": { - "version": "1.51.1", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz", + "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" diff --git a/tvapp2/node_modules/playwright-core/browsers.json b/tvapp2/node_modules/playwright-core/browsers.json index d21a5aa1..a063d089 100755 --- a/tvapp2/node_modules/playwright-core/browsers.json +++ b/tvapp2/node_modules/playwright-core/browsers.json @@ -3,43 +3,43 @@ "browsers": [ { "name": "chromium", - "revision": "1161", + "revision": "1169", "installByDefault": true, - "browserVersion": "134.0.6998.35" + "browserVersion": "136.0.7103.25" }, { "name": "chromium-headless-shell", - "revision": "1161", + "revision": "1169", "installByDefault": true, - "browserVersion": "134.0.6998.35" + "browserVersion": "136.0.7103.25" }, { "name": "chromium-tip-of-tree", - "revision": "1304", + "revision": "1320", "installByDefault": false, - "browserVersion": "135.0.7021.0" + "browserVersion": "137.0.7105.0" }, { "name": "chromium-tip-of-tree-headless-shell", - "revision": "1304", + "revision": "1320", "installByDefault": false, - "browserVersion": "135.0.7021.0" + "browserVersion": "137.0.7105.0" }, { "name": "firefox", - "revision": "1475", + "revision": "1482", "installByDefault": true, - "browserVersion": "135.0" + "browserVersion": "137.0" }, { "name": "firefox-beta", - "revision": "1471", + "revision": "1477", "installByDefault": false, - "browserVersion": "136.0b4" + "browserVersion": "137.0b2" }, { "name": "webkit", - "revision": "2140", + "revision": "2158", "installByDefault": true, "revisionOverrides": { "debian11-x64": "2105", @@ -50,6 +50,8 @@ "mac11-arm64": "1816", "mac12": "2009", "mac12-arm64": "2009", + "mac13": "2140", + "mac13-arm64": "2140", "ubuntu20.04-x64": "2092", "ubuntu20.04-arm64": "2092" }, diff --git a/tvapp2/node_modules/playwright-core/lib/androidServerImpl.js b/tvapp2/node_modules/playwright-core/lib/androidServerImpl.js index dca0711b..0cf23890 100755 --- a/tvapp2/node_modules/playwright-core/lib/androidServerImpl.js +++ b/tvapp2/node_modules/playwright-core/lib/androidServerImpl.js @@ -1,69 +1,63 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var androidServerImpl_exports = {}; +__export(androidServerImpl_exports, { + AndroidServerLauncherImpl: () => AndroidServerLauncherImpl }); -exports.AndroidServerLauncherImpl = void 0; -var _playwrightServer = require("./remote/playwrightServer"); -var _playwright = require("./server/playwright"); -var _crypto = require("./server/utils/crypto"); -var _utilsBundle = require("./utilsBundle"); -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the 'License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +module.exports = __toCommonJS(androidServerImpl_exports); +var import_playwrightServer = require("./remote/playwrightServer"); +var import_playwright = require("./server/playwright"); +var import_crypto = require("./server/utils/crypto"); +var import_utilsBundle = require("./utilsBundle"); class AndroidServerLauncherImpl { async launchServer(options = {}) { - const playwright = (0, _playwright.createPlaywright)({ - sdkLanguage: 'javascript', - isServer: true - }); - // 1. Pre-connect to the device + const playwright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isServer: true }); let devices = await playwright.android.devices({ host: options.adbHost, port: options.adbPort, omitDriverInstall: options.omitDriverInstall }); - if (devices.length === 0) throw new Error('No devices found'); + if (devices.length === 0) + throw new Error("No devices found"); if (options.deviceSerialNumber) { - devices = devices.filter(d => d.serial === options.deviceSerialNumber); - if (devices.length === 0) throw new Error(`No device with serial number '${options.deviceSerialNumber}' was found`); + devices = devices.filter((d) => d.serial === options.deviceSerialNumber); + if (devices.length === 0) + throw new Error(`No device with serial number '${options.deviceSerialNumber}' was found`); } - if (devices.length > 1) throw new Error(`More than one device found. Please specify deviceSerialNumber`); + if (devices.length > 1) + throw new Error(`More than one device found. Please specify deviceSerialNumber`); const device = devices[0]; - const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _crypto.createGuid)()}`; - - // 2. Start the server - const server = new _playwrightServer.PlaywrightServer({ - mode: 'launchServer', - path, - maxConnections: 1, - preLaunchedAndroidDevice: device - }); + const path = options.wsPath ? options.wsPath.startsWith("/") ? options.wsPath : `/${options.wsPath}` : `/${(0, import_crypto.createGuid)()}`; + const server = new import_playwrightServer.PlaywrightServer({ mode: "launchServer", path, maxConnections: 1, preLaunchedAndroidDevice: device }); const wsEndpoint = await server.listen(options.port, options.host); - - // 3. Return the BrowserServer interface - const browserServer = new _utilsBundle.ws.EventEmitter(); + const browserServer = new import_utilsBundle.ws.EventEmitter(); browserServer.wsEndpoint = () => wsEndpoint; browserServer.close = () => device.close(); browserServer.kill = () => device.close(); - device.on('close', () => { + device.on("close", () => { server.close(); - browserServer.emit('close'); + browserServer.emit("close"); }); return browserServer; } } -exports.AndroidServerLauncherImpl = AndroidServerLauncherImpl; \ No newline at end of file +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + AndroidServerLauncherImpl +}); diff --git a/tvapp2/node_modules/playwright-core/lib/browserServerImpl.js b/tvapp2/node_modules/playwright-core/lib/browserServerImpl.js index df7fb530..3e6e88e3 100755 --- a/tvapp2/node_modules/playwright-core/lib/browserServerImpl.js +++ b/tvapp2/node_modules/playwright-core/lib/browserServerImpl.js @@ -1,73 +1,57 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var browserServerImpl_exports = {}; +__export(browserServerImpl_exports, { + BrowserServerLauncherImpl: () => BrowserServerLauncherImpl }); -exports.BrowserServerLauncherImpl = void 0; -var _socksProxy = require("./server/utils/socksProxy"); -var _playwrightServer = require("./remote/playwrightServer"); -var _helper = require("./server/helper"); -var _instrumentation = require("./server/instrumentation"); -var _playwright = require("./server/playwright"); -var _crypto = require("./server/utils/crypto"); -var _stackTrace = require("./utils/isomorphic/stackTrace"); -var _utilsBundle = require("./utilsBundle"); -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the 'License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +module.exports = __toCommonJS(browserServerImpl_exports); +var import_socksProxy = require("./server/utils/socksProxy"); +var import_playwrightServer = require("./remote/playwrightServer"); +var import_helper = require("./server/helper"); +var import_instrumentation = require("./server/instrumentation"); +var import_playwright = require("./server/playwright"); +var import_crypto = require("./server/utils/crypto"); +var import_stackTrace = require("./utils/isomorphic/stackTrace"); +var import_utilsBundle = require("./utilsBundle"); class BrowserServerLauncherImpl { constructor(browserName) { - this._browserName = void 0; this._browserName = browserName; } async launchServer(options = {}) { - const playwright = (0, _playwright.createPlaywright)({ - sdkLanguage: 'javascript', - isServer: true - }); - // TODO: enable socks proxy once ipv6 is supported. - const socksProxy = false ? new _socksProxy.SocksProxy() : undefined; - playwright.options.socksProxyPort = await (socksProxy === null || socksProxy === void 0 ? void 0 : socksProxy.listen(0)); - - // 1. Pre-launch the browser - const metadata = (0, _instrumentation.serverSideCallMetadata)(); + const playwright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isServer: true }); + const socksProxy = false ? new SocksProxy() : void 0; + playwright.options.socksProxyPort = await socksProxy?.listen(0); + const metadata = (0, import_instrumentation.serverSideCallMetadata)(); const browser = await playwright[this._browserName].launch(metadata, { ...options, - ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined, + ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : void 0, ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs), - env: options.env ? envObjectToArray(options.env) : undefined - }, toProtocolLogger(options.logger)).catch(e => { - const log = _helper.helper.formatBrowserLogs(metadata.log); - (0, _stackTrace.rewriteErrorMessage)(e, `${e.message} Failed to launch browser.${log}`); + env: options.env ? envObjectToArray(options.env) : void 0 + }, toProtocolLogger(options.logger)).catch((e) => { + const log = import_helper.helper.formatBrowserLogs(metadata.log); + (0, import_stackTrace.rewriteErrorMessage)(e, `${e.message} Failed to launch browser.${log}`); throw e; }); - const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _crypto.createGuid)()}`; - - // 2. Start the server - const server = new _playwrightServer.PlaywrightServer({ - mode: 'launchServer', - path, - maxConnections: Infinity, - preLaunchedBrowser: browser, - preLaunchedSocksProxy: socksProxy - }); + const path = options.wsPath ? options.wsPath.startsWith("/") ? options.wsPath : `/${options.wsPath}` : `/${(0, import_crypto.createGuid)()}`; + const server = new import_playwrightServer.PlaywrightServer({ mode: "launchServer", path, maxConnections: Infinity, preLaunchedBrowser: browser, preLaunchedSocksProxy: socksProxy }); const wsEndpoint = await server.listen(options.port, options.host); - - // 3. Return the BrowserServer interface - const browserServer = new _utilsBundle.ws.EventEmitter(); + const browserServer = new import_utilsBundle.ws.EventEmitter(); browserServer.process = () => browser.options.browserProcess.process; browserServer.wsEndpoint = () => wsEndpoint; browserServer.close = () => browser.options.browserProcess.close(); @@ -76,26 +60,29 @@ class BrowserServerLauncherImpl { browserServer._disconnectForTest = () => server.close(); browserServer._userDataDirForTest = browser._userDataDirForTest; browser.options.browserProcess.onclose = (exitCode, signal) => { - socksProxy === null || socksProxy === void 0 || socksProxy.close().catch(() => {}); + socksProxy?.close().catch(() => { + }); server.close(); - browserServer.emit('close', exitCode, signal); + browserServer.emit("close", exitCode, signal); }; return browserServer; } } -exports.BrowserServerLauncherImpl = BrowserServerLauncherImpl; function toProtocolLogger(logger) { return logger ? (direction, message) => { - if (logger.isEnabled('protocol', 'verbose')) logger.log('protocol', 'verbose', (direction === 'send' ? 'SEND ► ' : '◀ RECV ') + JSON.stringify(message), [], {}); - } : undefined; + if (logger.isEnabled("protocol", "verbose")) + logger.log("protocol", "verbose", (direction === "send" ? "SEND \u25BA " : "\u25C0 RECV ") + JSON.stringify(message), [], {}); + } : void 0; } function envObjectToArray(env) { const result = []; for (const name in env) { - if (!Object.is(env[name], undefined)) result.push({ - name, - value: String(env[name]) - }); + if (!Object.is(env[name], void 0)) + result.push({ name, value: String(env[name]) }); } return result; -} \ No newline at end of file +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + BrowserServerLauncherImpl +}); diff --git a/tvapp2/node_modules/playwright-core/lib/cli/driver.js b/tvapp2/node_modules/playwright-core/lib/cli/driver.js index 37572259..a389e152 100755 --- a/tvapp2/node_modules/playwright-core/lib/cli/driver.js +++ b/tvapp2/node_modules/playwright-core/lib/cli/driver.js @@ -1,95 +1,97 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var driver_exports = {}; +__export(driver_exports, { + launchBrowserServer: () => launchBrowserServer, + printApiJson: () => printApiJson, + runDriver: () => runDriver, + runServer: () => runServer }); -exports.launchBrowserServer = launchBrowserServer; -exports.printApiJson = printApiJson; -exports.runDriver = runDriver; -exports.runServer = runServer; -var _fs = _interopRequireDefault(require("fs")); -var playwright = _interopRequireWildcard(require("../..")); -var _pipeTransport = require("../server/utils/pipeTransport"); -var _playwrightServer = require("../remote/playwrightServer"); -var _server = require("../server"); -var _processLauncher = require("../server/utils/processLauncher"); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the 'License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* eslint-disable no-console */ - +module.exports = __toCommonJS(driver_exports); +var import_fs = __toESM(require("fs")); +var playwright = __toESM(require("../..")); +var import_pipeTransport = require("../server/utils/pipeTransport"); +var import_playwrightServer = require("../remote/playwrightServer"); +var import_server = require("../server"); +var import_processLauncher = require("../server/utils/processLauncher"); function printApiJson() { - // Note: this file is generated by build-playwright-driver.sh - console.log(JSON.stringify(require('../../api.json'))); + console.log(JSON.stringify(require("../../api.json"))); } function runDriver() { - const dispatcherConnection = new _server.DispatcherConnection(); - new _server.RootDispatcher(dispatcherConnection, async (rootScope, { - sdkLanguage - }) => { - const playwright = (0, _server.createPlaywright)({ - sdkLanguage - }); - return new _server.PlaywrightDispatcher(rootScope, playwright); + const dispatcherConnection = new import_server.DispatcherConnection(); + new import_server.RootDispatcher(dispatcherConnection, async (rootScope, { sdkLanguage }) => { + const playwright2 = (0, import_server.createPlaywright)({ sdkLanguage }); + return new import_server.PlaywrightDispatcher(rootScope, playwright2); }); - const transport = new _pipeTransport.PipeTransport(process.stdout, process.stdin); - transport.onmessage = message => dispatcherConnection.dispatch(JSON.parse(message)); - // Certain Language Binding JSON parsers (e.g. .NET) do not like strings with lone surrogates. - const isJavaScriptLanguageBinding = !process.env.PW_LANG_NAME || process.env.PW_LANG_NAME === 'javascript'; + const transport = new import_pipeTransport.PipeTransport(process.stdout, process.stdin); + transport.onmessage = (message) => dispatcherConnection.dispatch(JSON.parse(message)); + const isJavaScriptLanguageBinding = !process.env.PW_LANG_NAME || process.env.PW_LANG_NAME === "javascript"; const replacer = !isJavaScriptLanguageBinding && String.prototype.toWellFormed ? (key, value) => { - if (typeof value === 'string') return value.toWellFormed(); + if (typeof value === "string") + return value.toWellFormed(); return value; - } : undefined; - dispatcherConnection.onmessage = message => transport.send(JSON.stringify(message, replacer)); + } : void 0; + dispatcherConnection.onmessage = (message) => transport.send(JSON.stringify(message, replacer)); transport.onclose = () => { - // Drop any messages during shutdown on the floor. - dispatcherConnection.onmessage = () => {}; - (0, _processLauncher.gracefullyProcessExitDoNotHang)(0); + dispatcherConnection.onmessage = () => { + }; + (0, import_processLauncher.gracefullyProcessExitDoNotHang)(0); }; - // Ignore the SIGINT signal in the driver process so the parent can gracefully close the connection. - // We still will destruct everything (close browsers and exit) when the transport pipe closes. - process.on('SIGINT', () => { - // Keep the process running. + process.on("SIGINT", () => { }); } async function runServer(options) { const { port, host, - path = '/', + path = "/", maxConnections = Infinity, extension } = options; - const server = new _playwrightServer.PlaywrightServer({ - mode: extension ? 'extension' : 'default', - path, - maxConnections - }); + const server = new import_playwrightServer.PlaywrightServer({ mode: extension ? "extension" : "default", path, maxConnections }); const wsEndpoint = await server.listen(port, host); - process.on('exit', () => server.close().catch(console.error)); - console.log('Listening on ' + wsEndpoint); - process.stdin.on('close', () => (0, _processLauncher.gracefullyProcessExitDoNotHang)(0)); + process.on("exit", () => server.close().catch(console.error)); + console.log("Listening on " + wsEndpoint); + process.stdin.on("close", () => (0, import_processLauncher.gracefullyProcessExitDoNotHang)(0)); } async function launchBrowserServer(browserName, configFile) { let options = {}; - if (configFile) options = JSON.parse(_fs.default.readFileSync(configFile).toString()); + if (configFile) + options = JSON.parse(import_fs.default.readFileSync(configFile).toString()); const browserType = playwright[browserName]; const server = await browserType.launchServer(options); console.log(server.wsEndpoint()); -} \ No newline at end of file +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + launchBrowserServer, + printApiJson, + runDriver, + runServer +}); diff --git a/tvapp2/node_modules/playwright-core/lib/cli/program.js b/tvapp2/node_modules/playwright-core/lib/cli/program.js index 465dbd75..48ccc635 100755 --- a/tvapp2/node_modules/playwright-core/lib/cli/program.js +++ b/tvapp2/node_modules/playwright-core/lib/cli/program.js @@ -1,134 +1,173 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "program", { - enumerable: true, - get: function () { - return _utilsBundle.program; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var program_exports = {}; +__export(program_exports, { + program: () => import_utilsBundle2.program }); -var _fs = _interopRequireDefault(require("fs")); -var _os = _interopRequireDefault(require("os")); -var _path = _interopRequireDefault(require("path")); -var playwright = _interopRequireWildcard(require("../..")); -var _driver = require("./driver"); -var _server = require("../server"); -var _utils = require("../utils"); -var _traceViewer = require("../server/trace/viewer/traceViewer"); -var _ascii = require("../server/utils/ascii"); -var _utilsBundle = require("../utilsBundle"); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* eslint-disable no-console */ - -const packageJSON = require('../../package.json'); -_utilsBundle.program.version('Version ' + (process.env.PW_CLI_DISPLAY_VERSION || packageJSON.version)).name(buildBasePlaywrightCLICommand(process.env.PW_LANG_NAME)); -_utilsBundle.program.command('mark-docker-image [dockerImageNameTemplate]', { - hidden: true -}).description('mark docker image').allowUnknownOption(true).action(function (dockerImageNameTemplate) { - (0, _utils.assert)(dockerImageNameTemplate, 'dockerImageNameTemplate is required'); - (0, _server.writeDockerVersion)(dockerImageNameTemplate).catch(logErrorAndExit); +module.exports = __toCommonJS(program_exports); +var import_fs = __toESM(require("fs")); +var import_os = __toESM(require("os")); +var import_path = __toESM(require("path")); +var playwright = __toESM(require("../..")); +var import_driver = require("./driver"); +var import_server = require("../server"); +var import_utils = require("../utils"); +var import_traceViewer = require("../server/trace/viewer/traceViewer"); +var import_utils2 = require("../utils"); +var import_ascii = require("../server/utils/ascii"); +var import_utilsBundle = require("../utilsBundle"); +var import_utilsBundle2 = require("../utilsBundle"); +const packageJSON = require("../../package.json"); +import_utilsBundle.program.version("Version " + (process.env.PW_CLI_DISPLAY_VERSION || packageJSON.version)).name(buildBasePlaywrightCLICommand(process.env.PW_LANG_NAME)); +import_utilsBundle.program.command("mark-docker-image [dockerImageNameTemplate]", { hidden: true }).description("mark docker image").allowUnknownOption(true).action(function(dockerImageNameTemplate) { + (0, import_utils2.assert)(dockerImageNameTemplate, "dockerImageNameTemplate is required"); + (0, import_server.writeDockerVersion)(dockerImageNameTemplate).catch(logErrorAndExit); }); -commandWithOpenOptions('open [url]', 'open page in browser specified via -b, --browser', []).action(function (url, options) { +commandWithOpenOptions("open [url]", "open page in browser specified via -b, --browser", []).action(function(url, options) { open(options, url, codegenId()).catch(logErrorAndExit); -}).addHelpText('afterAll', ` +}).addHelpText("afterAll", ` Examples: $ open $ open -b webkit https://example.com`); -commandWithOpenOptions('codegen [url]', 'open page and generate code for user actions', [['-o, --output ', 'saves the generated script to a file'], ['--target ', `language to generate, one of javascript, playwright-test, python, python-async, python-pytest, csharp, csharp-mstest, csharp-nunit, java, java-junit`, codegenId()], ['--test-id-attribute ', 'use the specified attribute to generate data test ID selectors']]).action(function (url, options) { +commandWithOpenOptions( + "codegen [url]", + "open page and generate code for user actions", + [ + ["-o, --output ", "saves the generated script to a file"], + ["--target ", `language to generate, one of javascript, playwright-test, python, python-async, python-pytest, csharp, csharp-mstest, csharp-nunit, java, java-junit`, codegenId()], + ["--test-id-attribute ", "use the specified attribute to generate data test ID selectors"] + ] +).action(function(url, options) { codegen(options, url).catch(logErrorAndExit); -}).addHelpText('afterAll', ` +}).addHelpText("afterAll", ` Examples: $ codegen $ codegen --target=python $ codegen -b webkit https://example.com`); function suggestedBrowsersToInstall() { - return _server.registry.executables().filter(e => e.installType !== 'none' && e.type !== 'tool').map(e => e.name).join(', '); + return import_server.registry.executables().filter((e) => e.installType !== "none" && e.type !== "tool").map((e) => e.name).join(", "); } function defaultBrowsersToInstall(options) { - let executables = _server.registry.defaultExecutables(); - if (options.noShell) executables = executables.filter(e => e.name !== 'chromium-headless-shell'); - if (options.onlyShell) executables = executables.filter(e => e.name !== 'chromium'); + let executables = import_server.registry.defaultExecutables(); + if (options.noShell) + executables = executables.filter((e) => e.name !== "chromium-headless-shell"); + if (options.onlyShell) + executables = executables.filter((e) => e.name !== "chromium"); return executables; } function checkBrowsersToInstall(args, options) { - if (options.noShell && options.onlyShell) throw new Error(`Only one of --no-shell and --only-shell can be specified`); + if (options.noShell && options.onlyShell) + throw new Error(`Only one of --no-shell and --only-shell can be specified`); const faultyArguments = []; const executables = []; - const handleArgument = arg => { - const executable = _server.registry.findExecutable(arg); - if (!executable || executable.installType === 'none') faultyArguments.push(arg);else executables.push(executable); - if ((executable === null || executable === void 0 ? void 0 : executable.browserName) === 'chromium') executables.push(_server.registry.findExecutable('ffmpeg')); + const handleArgument = (arg) => { + const executable = import_server.registry.findExecutable(arg); + if (!executable || executable.installType === "none") + faultyArguments.push(arg); + else + executables.push(executable); + if (executable?.browserName === "chromium") + executables.push(import_server.registry.findExecutable("ffmpeg")); }; for (const arg of args) { - if (arg === 'chromium') { - if (!options.onlyShell) handleArgument('chromium'); - if (!options.noShell) handleArgument('chromium-headless-shell'); + if (arg === "chromium") { + if (!options.onlyShell) + handleArgument("chromium"); + if (!options.noShell) + handleArgument("chromium-headless-shell"); } else { handleArgument(arg); } } - if (process.platform === 'win32') executables.push(_server.registry.findExecutable('winldd')); - if (faultyArguments.length) throw new Error(`Invalid installation targets: ${faultyArguments.map(name => `'${name}'`).join(', ')}. Expecting one of: ${suggestedBrowsersToInstall()}`); + if (process.platform === "win32") + executables.push(import_server.registry.findExecutable("winldd")); + if (faultyArguments.length) + throw new Error(`Invalid installation targets: ${faultyArguments.map((name) => `'${name}'`).join(", ")}. Expecting one of: ${suggestedBrowsersToInstall()}`); return executables; } -_utilsBundle.program.command('install [browser...]').description('ensure browsers necessary for this version of Playwright are installed').option('--with-deps', 'install system dependencies for browsers').option('--dry-run', 'do not execute installation, only print information').option('--force', 'force reinstall of stable browser channels').option('--only-shell', 'only install headless shell when installing chromium').option('--no-shell', 'do not install chromium headless shell').action(async function (args, options) { - // For '--no-shell' option, commander sets `shell: false` instead. - if (options.shell === false) options.noShell = true; - if ((0, _utils.isLikelyNpxGlobal)()) { - console.error((0, _ascii.wrapInASCIIBox)([`WARNING: It looks like you are running 'npx playwright install' without first`, `installing your project's dependencies.`, ``, `To avoid unexpected behavior, please install your dependencies first, and`, `then run Playwright's install command:`, ``, ` npm install`, ` npx playwright install`, ``, `If your project does not yet depend on Playwright, first install the`, `applicable npm package (most commonly @playwright/test), and`, `then run Playwright's install command to download the browsers:`, ``, ` npm install @playwright/test`, ` npx playwright install`, ``].join('\n'), 1)); +import_utilsBundle.program.command("install [browser...]").description("ensure browsers necessary for this version of Playwright are installed").option("--with-deps", "install system dependencies for browsers").option("--dry-run", "do not execute installation, only print information").option("--force", "force reinstall of stable browser channels").option("--only-shell", "only install headless shell when installing chromium").option("--no-shell", "do not install chromium headless shell").action(async function(args, options) { + if (options.shell === false) + options.noShell = true; + if ((0, import_utils.isLikelyNpxGlobal)()) { + console.error((0, import_ascii.wrapInASCIIBox)([ + `WARNING: It looks like you are running 'npx playwright install' without first`, + `installing your project's dependencies.`, + ``, + `To avoid unexpected behavior, please install your dependencies first, and`, + `then run Playwright's install command:`, + ``, + ` npm install`, + ` npx playwright install`, + ``, + `If your project does not yet depend on Playwright, first install the`, + `applicable npm package (most commonly @playwright/test), and`, + `then run Playwright's install command to download the browsers:`, + ``, + ` npm install @playwright/test`, + ` npx playwright install`, + `` + ].join("\n"), 1)); } try { const hasNoArguments = !args.length; const executables = hasNoArguments ? defaultBrowsersToInstall(options) : checkBrowsersToInstall(args, options); - if (options.withDeps) await _server.registry.installDeps(executables, !!options.dryRun); + if (options.withDeps) + await import_server.registry.installDeps(executables, !!options.dryRun); if (options.dryRun) { for (const executable of executables) { - var _executable$directory, _executable$downloadU; - const version = executable.browserVersion ? `version ` + executable.browserVersion : ''; - console.log(`browser: ${executable.name}${version ? ' ' + version : ''}`); - console.log(` Install location: ${(_executable$directory = executable.directory) !== null && _executable$directory !== void 0 ? _executable$directory : ''}`); - if ((_executable$downloadU = executable.downloadURLs) !== null && _executable$downloadU !== void 0 && _executable$downloadU.length) { + const version = executable.browserVersion ? `version ` + executable.browserVersion : ""; + console.log(`browser: ${executable.name}${version ? " " + version : ""}`); + console.log(` Install location: ${executable.directory ?? ""}`); + if (executable.downloadURLs?.length) { const [url, ...fallbacks] = executable.downloadURLs; console.log(` Download url: ${url}`); - for (let i = 0; i < fallbacks.length; ++i) console.log(` Download fallback ${i + 1}: ${fallbacks[i]}`); + for (let i = 0; i < fallbacks.length; ++i) + console.log(` Download fallback ${i + 1}: ${fallbacks[i]}`); } console.log(``); } } else { const forceReinstall = hasNoArguments ? false : !!options.force; - await _server.registry.install(executables, forceReinstall); - await _server.registry.validateHostRequirementsForExecutablesIfNeeded(executables, process.env.PW_LANG_NAME || 'javascript').catch(e => { - e.name = 'Playwright Host validation warning'; + await import_server.registry.install(executables, forceReinstall); + await import_server.registry.validateHostRequirementsForExecutablesIfNeeded(executables, process.env.PW_LANG_NAME || "javascript").catch((e) => { + e.name = "Playwright Host validation warning"; console.error(e); }); } } catch (e) { - console.log(`Failed to install browsers\n${e}`); - (0, _utils.gracefullyProcessExitDoNotHang)(1); + console.log(`Failed to install browsers +${e}`); + (0, import_utils.gracefullyProcessExitDoNotHang)(1); } -}).addHelpText('afterAll', ` +}).addHelpText("afterAll", ` Examples: - $ install @@ -136,106 +175,110 @@ Examples: - $ install chrome firefox Install custom browsers, supports ${suggestedBrowsersToInstall()}.`); -_utilsBundle.program.command('uninstall').description('Removes browsers used by this installation of Playwright from the system (chromium, firefox, webkit, ffmpeg). This does not include branded channels.').option('--all', 'Removes all browsers used by any Playwright installation from the system.').action(async options => { +import_utilsBundle.program.command("uninstall").description("Removes browsers used by this installation of Playwright from the system (chromium, firefox, webkit, ffmpeg). This does not include branded channels.").option("--all", "Removes all browsers used by any Playwright installation from the system.").action(async (options) => { delete process.env.PLAYWRIGHT_SKIP_BROWSER_GC; - await _server.registry.uninstall(!!options.all).then(({ - numberOfBrowsersLeft - }) => { + await import_server.registry.uninstall(!!options.all).then(({ numberOfBrowsersLeft }) => { if (!options.all && numberOfBrowsersLeft > 0) { - console.log('Successfully uninstalled Playwright browsers for the current Playwright installation.'); - console.log(`There are still ${numberOfBrowsersLeft} browsers left, used by other Playwright installations.\nTo uninstall Playwright browsers for all installations, re-run with --all flag.`); + console.log("Successfully uninstalled Playwright browsers for the current Playwright installation."); + console.log(`There are still ${numberOfBrowsersLeft} browsers left, used by other Playwright installations. +To uninstall Playwright browsers for all installations, re-run with --all flag.`); } }).catch(logErrorAndExit); }); -_utilsBundle.program.command('install-deps [browser...]').description('install dependencies necessary to run browsers (will ask for sudo permissions)').option('--dry-run', 'Do not execute installation commands, only print them').action(async function (args, options) { +import_utilsBundle.program.command("install-deps [browser...]").description("install dependencies necessary to run browsers (will ask for sudo permissions)").option("--dry-run", "Do not execute installation commands, only print them").action(async function(args, options) { try { - if (!args.length) await _server.registry.installDeps(defaultBrowsersToInstall({}), !!options.dryRun);else await _server.registry.installDeps(checkBrowsersToInstall(args, {}), !!options.dryRun); + if (!args.length) + await import_server.registry.installDeps(defaultBrowsersToInstall({}), !!options.dryRun); + else + await import_server.registry.installDeps(checkBrowsersToInstall(args, {}), !!options.dryRun); } catch (e) { - console.log(`Failed to install browser dependencies\n${e}`); - (0, _utils.gracefullyProcessExitDoNotHang)(1); + console.log(`Failed to install browser dependencies +${e}`); + (0, import_utils.gracefullyProcessExitDoNotHang)(1); } -}).addHelpText('afterAll', ` +}).addHelpText("afterAll", ` Examples: - $ install-deps Install dependencies for default browsers. - $ install-deps chrome firefox Install dependencies for specific browsers, supports ${suggestedBrowsersToInstall()}.`); -const browsers = [{ - alias: 'cr', - name: 'Chromium', - type: 'chromium' -}, { - alias: 'ff', - name: 'Firefox', - type: 'firefox' -}, { - alias: 'wk', - name: 'WebKit', - type: 'webkit' -}]; -for (const { - alias, - name, - type -} of browsers) { - commandWithOpenOptions(`${alias} [url]`, `open page in ${name}`, []).action(function (url, options) { - open({ - ...options, - browser: type - }, url, options.target).catch(logErrorAndExit); - }).addHelpText('afterAll', ` +const browsers = [ + { alias: "cr", name: "Chromium", type: "chromium" }, + { alias: "ff", name: "Firefox", type: "firefox" }, + { alias: "wk", name: "WebKit", type: "webkit" } +]; +for (const { alias, name, type } of browsers) { + commandWithOpenOptions(`${alias} [url]`, `open page in ${name}`, []).action(function(url, options) { + open({ ...options, browser: type }, url, options.target).catch(logErrorAndExit); + }).addHelpText("afterAll", ` Examples: $ ${alias} https://example.com`); } -commandWithOpenOptions('screenshot ', 'capture a page screenshot', [['--wait-for-selector ', 'wait for selector before taking a screenshot'], ['--wait-for-timeout ', 'wait for timeout in milliseconds before taking a screenshot'], ['--full-page', 'whether to take a full page screenshot (entire scrollable area)']]).action(function (url, filename, command) { +commandWithOpenOptions( + "screenshot ", + "capture a page screenshot", + [ + ["--wait-for-selector ", "wait for selector before taking a screenshot"], + ["--wait-for-timeout ", "wait for timeout in milliseconds before taking a screenshot"], + ["--full-page", "whether to take a full page screenshot (entire scrollable area)"] + ] +).action(function(url, filename, command) { screenshot(command, command, url, filename).catch(logErrorAndExit); -}).addHelpText('afterAll', ` +}).addHelpText("afterAll", ` Examples: $ screenshot -b webkit https://example.com example.png`); -commandWithOpenOptions('pdf ', 'save page as pdf', [['--wait-for-selector ', 'wait for given selector before saving as pdf'], ['--wait-for-timeout ', 'wait for given timeout in milliseconds before saving as pdf']]).action(function (url, filename, options) { +commandWithOpenOptions( + "pdf ", + "save page as pdf", + [ + ["--paper-format ", "paper format: Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6"], + ["--wait-for-selector ", "wait for given selector before saving as pdf"], + ["--wait-for-timeout ", "wait for given timeout in milliseconds before saving as pdf"] + ] +).action(function(url, filename, options) { pdf(options, options, url, filename).catch(logErrorAndExit); -}).addHelpText('afterAll', ` +}).addHelpText("afterAll", ` Examples: $ pdf https://example.com example.pdf`); -_utilsBundle.program.command('run-driver', { - hidden: true -}).action(function (options) { - (0, _driver.runDriver)(); +import_utilsBundle.program.command("run-driver", { hidden: true }).action(function(options) { + (0, import_driver.runDriver)(); }); -_utilsBundle.program.command('run-server').option('--port ', 'Server port').option('--host ', 'Server host').option('--path ', 'Endpoint Path', '/').option('--max-clients ', 'Maximum clients').option('--mode ', 'Server mode, either "default" or "extension"').action(function (options) { - (0, _driver.runServer)({ - port: options.port ? +options.port : undefined, +import_utilsBundle.program.command("run-server").option("--port ", "Server port").option("--host ", "Server host").option("--path ", "Endpoint Path", "/").option("--max-clients ", "Maximum clients").option("--mode ", 'Server mode, either "default" or "extension"').action(function(options) { + (0, import_driver.runServer)({ + port: options.port ? +options.port : void 0, host: options.host, path: options.path, maxConnections: options.maxClients ? +options.maxClients : Infinity, - extension: options.mode === 'extension' || !!process.env.PW_EXTENSION_MODE + extension: options.mode === "extension" || !!process.env.PW_EXTENSION_MODE }).catch(logErrorAndExit); }); -_utilsBundle.program.command('print-api-json', { - hidden: true -}).action(function (options) { - (0, _driver.printApiJson)(); +import_utilsBundle.program.command("print-api-json", { hidden: true }).action(function(options) { + (0, import_driver.printApiJson)(); }); -_utilsBundle.program.command('launch-server', { - hidden: true -}).requiredOption('--browser ', 'Browser name, one of "chromium", "firefox" or "webkit"').option('--config ', 'JSON file with launchServer options').action(function (options) { - (0, _driver.launchBrowserServer)(options.browser, options.config); +import_utilsBundle.program.command("launch-server", { hidden: true }).requiredOption("--browser ", 'Browser name, one of "chromium", "firefox" or "webkit"').option("--config ", "JSON file with launchServer options").action(function(options) { + (0, import_driver.launchBrowserServer)(options.browser, options.config); }); -_utilsBundle.program.command('show-trace [trace...]').option('-b, --browser ', 'browser to use, one of cr, chromium, ff, firefox, wk, webkit', 'chromium').option('-h, --host ', 'Host to serve trace on; specifying this option opens trace in a browser tab').option('-p, --port ', 'Port to serve trace on, 0 for any free port; specifying this option opens trace in a browser tab').option('--stdin', 'Accept trace URLs over stdin to update the viewer').description('show trace viewer').action(function (traces, options) { - if (options.browser === 'cr') options.browser = 'chromium'; - if (options.browser === 'ff') options.browser = 'firefox'; - if (options.browser === 'wk') options.browser = 'webkit'; +import_utilsBundle.program.command("show-trace [trace...]").option("-b, --browser ", "browser to use, one of cr, chromium, ff, firefox, wk, webkit", "chromium").option("-h, --host ", "Host to serve trace on; specifying this option opens trace in a browser tab").option("-p, --port ", "Port to serve trace on, 0 for any free port; specifying this option opens trace in a browser tab").option("--stdin", "Accept trace URLs over stdin to update the viewer").description("show trace viewer").action(function(traces, options) { + if (options.browser === "cr") + options.browser = "chromium"; + if (options.browser === "ff") + options.browser = "firefox"; + if (options.browser === "wk") + options.browser = "webkit"; const openOptions = { host: options.host, port: +options.port, isServer: !!options.stdin }; - if (options.port !== undefined || options.host !== undefined) (0, _traceViewer.runTraceInBrowser)(traces, openOptions).catch(logErrorAndExit);else (0, _traceViewer.runTraceViewerApp)(traces, options.browser, openOptions, true).catch(logErrorAndExit); -}).addHelpText('afterAll', ` + if (options.port !== void 0 || options.host !== void 0) + (0, import_traceViewer.runTraceInBrowser)(traces, openOptions).catch(logErrorAndExit); + else + (0, import_traceViewer.runTraceViewerApp)(traces, options.browser, openOptions, true).catch(logErrorAndExit); +}).addHelpText("afterAll", ` Examples: $ show-trace https://example.com/trace.zip`); @@ -243,79 +286,67 @@ async function launchContext(options, extraOptions) { validateOptions(options); const browserType = lookupBrowserType(options); const launchOptions = extraOptions; - if (options.channel) launchOptions.channel = options.channel; + if (options.channel) + launchOptions.channel = options.channel; launchOptions.handleSIGINT = false; - const contextOptions = - // Copy the device descriptor since we have to compare and modify the options. - options.device ? { - ...playwright.devices[options.device] - } : {}; - - // In headful mode, use host device scale factor for things to look nice. - // In headless, keep things the way it works in Playwright by default. - // Assume high-dpi on MacOS. TODO: this is not perfect. - if (!extraOptions.headless) contextOptions.deviceScaleFactor = _os.default.platform() === 'darwin' ? 2 : 1; - - // Work around the WebKit GTK scrolling issue. - if (browserType.name() === 'webkit' && process.platform === 'linux') { + const contextOptions = ( + // Copy the device descriptor since we have to compare and modify the options. + options.device ? { ...playwright.devices[options.device] } : {} + ); + if (!extraOptions.headless) + contextOptions.deviceScaleFactor = import_os.default.platform() === "darwin" ? 2 : 1; + if (browserType.name() === "webkit" && process.platform === "linux") { delete contextOptions.hasTouch; delete contextOptions.isMobile; } - if (contextOptions.isMobile && browserType.name() === 'firefox') contextOptions.isMobile = undefined; - if (options.blockServiceWorkers) contextOptions.serviceWorkers = 'block'; - - // Proxy - + if (contextOptions.isMobile && browserType.name() === "firefox") + contextOptions.isMobile = void 0; + if (options.blockServiceWorkers) + contextOptions.serviceWorkers = "block"; if (options.proxyServer) { launchOptions.proxy = { server: options.proxyServer }; - if (options.proxyBypass) launchOptions.proxy.bypass = options.proxyBypass; + if (options.proxyBypass) + launchOptions.proxy.bypass = options.proxyBypass; } const browser = await browserType.launch(launchOptions); if (process.env.PWTEST_CLI_IS_UNDER_TEST) { - process._didSetSourcesForTest = text => { - process.stdout.write('\n-------------8<-------------\n'); + process._didSetSourcesForTest = (text) => { + process.stdout.write("\n-------------8<-------------\n"); process.stdout.write(text); - process.stdout.write('\n-------------8<-------------\n'); + process.stdout.write("\n-------------8<-------------\n"); const autoExitCondition = process.env.PWTEST_CLI_AUTO_EXIT_WHEN; - if (autoExitCondition && text.includes(autoExitCondition)) closeBrowser(); + if (autoExitCondition && text.includes(autoExitCondition)) + closeBrowser(); }; - // Make sure we exit abnormally when browser crashes. const logs = []; - require('playwright-core/lib/utilsBundle').debug.log = (...args) => { - const line = require('util').format(...args) + '\n'; + require("playwright-core/lib/utilsBundle").debug.log = (...args) => { + const line = require("util").format(...args) + "\n"; logs.push(line); process.stderr.write(line); }; - browser.on('disconnected', () => { - const hasCrashLine = logs.some(line => line.includes('process did exit:') && !line.includes('process did exit: exitCode=0, signal=null')); + browser.on("disconnected", () => { + const hasCrashLine = logs.some((line) => line.includes("process did exit:") && !line.includes("process did exit: exitCode=0, signal=null")); if (hasCrashLine) { - process.stderr.write('Detected browser crash.\n'); - (0, _utils.gracefullyProcessExitDoNotHang)(1); + process.stderr.write("Detected browser crash.\n"); + (0, import_utils.gracefullyProcessExitDoNotHang)(1); } }); } - - // Viewport size if (options.viewportSize) { try { - const [width, height] = options.viewportSize.split(',').map(n => +n); - if (isNaN(width) || isNaN(height)) throw new Error('bad values'); - contextOptions.viewport = { - width, - height - }; + const [width, height] = options.viewportSize.split(",").map((n) => +n); + if (isNaN(width) || isNaN(height)) + throw new Error("bad values"); + contextOptions.viewport = { width, height }; } catch (e) { throw new Error('Invalid viewport size format: use "width,height", for example --viewport-size="800,600"'); } } - - // Geolocation - if (options.geolocation) { try { - const [latitude, longitude] = options.geolocation.split(',').map(n => parseFloat(n.trim())); + const [latitude, longitude] = options.geolocation.split(",").map((n) => parseFloat(n.trim())); contextOptions.geolocation = { latitude, longitude @@ -323,94 +354,71 @@ async function launchContext(options, extraOptions) { } catch (e) { throw new Error('Invalid geolocation format, should be "lat,long". For example --geolocation="37.819722,-122.478611"'); } - contextOptions.permissions = ['geolocation']; + contextOptions.permissions = ["geolocation"]; } - - // User agent - - if (options.userAgent) contextOptions.userAgent = options.userAgent; - - // Lang - - if (options.lang) contextOptions.locale = options.lang; - - // Color scheme - - if (options.colorScheme) contextOptions.colorScheme = options.colorScheme; - - // Timezone - - if (options.timezone) contextOptions.timezoneId = options.timezone; - - // Storage - - if (options.loadStorage) contextOptions.storageState = options.loadStorage; - if (options.ignoreHttpsErrors) contextOptions.ignoreHTTPSErrors = true; - - // HAR - + if (options.userAgent) + contextOptions.userAgent = options.userAgent; + if (options.lang) + contextOptions.locale = options.lang; + if (options.colorScheme) + contextOptions.colorScheme = options.colorScheme; + if (options.timezone) + contextOptions.timezoneId = options.timezone; + if (options.loadStorage) + contextOptions.storageState = options.loadStorage; + if (options.ignoreHttpsErrors) + contextOptions.ignoreHTTPSErrors = true; if (options.saveHar) { - contextOptions.recordHar = { - path: _path.default.resolve(process.cwd(), options.saveHar), - mode: 'minimal' - }; - if (options.saveHarGlob) contextOptions.recordHar.urlFilter = options.saveHarGlob; - contextOptions.serviceWorkers = 'block'; + contextOptions.recordHar = { path: import_path.default.resolve(process.cwd(), options.saveHar), mode: "minimal" }; + if (options.saveHarGlob) + contextOptions.recordHar.urlFilter = options.saveHarGlob; + contextOptions.serviceWorkers = "block"; } - - // Close app when the last window closes. - const context = await browser.newContext(contextOptions); let closingBrowser = false; async function closeBrowser() { - // We can come here multiple times. For example, saving storage creates - // a temporary page and we call closeBrowser again when that page closes. - if (closingBrowser) return; + if (closingBrowser) + return; closingBrowser = true; - if (options.saveStorage) await context.storageState({ - path: options.saveStorage - }).catch(e => null); - if (options.saveHar) await context.close(); + if (options.saveStorage) + await context.storageState({ path: options.saveStorage }).catch((e) => null); + if (options.saveHar) + await context.close(); await browser.close(); } - context.on('page', page => { - page.on('dialog', () => {}); // Prevent dialogs from being automatically dismissed. - page.on('close', () => { - const hasPage = browser.contexts().some(context => context.pages().length > 0); - if (hasPage) return; - // Avoid the error when the last page is closed because the browser has been closed. - closeBrowser().catch(() => {}); + context.on("page", (page) => { + page.on("dialog", () => { + }); + page.on("close", () => { + const hasPage = browser.contexts().some((context2) => context2.pages().length > 0); + if (hasPage) + return; + closeBrowser().catch(() => { + }); }); }); - process.on('SIGINT', async () => { + process.on("SIGINT", async () => { await closeBrowser(); - (0, _utils.gracefullyProcessExitDoNotHang)(130); + (0, import_utils.gracefullyProcessExitDoNotHang)(130); }); const timeout = options.timeout ? parseInt(options.timeout, 10) : 0; context.setDefaultTimeout(timeout); context.setDefaultNavigationTimeout(timeout); - - // Omit options that we add automatically for presentation purpose. delete launchOptions.headless; delete launchOptions.executablePath; delete launchOptions.handleSIGINT; delete contextOptions.deviceScaleFactor; - return { - browser, - browserName: browserType.name(), - context, - contextOptions, - launchOptions - }; + return { browser, browserName: browserType.name(), context, contextOptions, launchOptions }; } async function openPage(context, url) { const page = await context.newPage(); if (url) { - if (_fs.default.existsSync(url)) url = 'file://' + _path.default.resolve(url);else if (!url.startsWith('http') && !url.startsWith('file://') && !url.startsWith('about:') && !url.startsWith('data:')) url = 'http://' + url; - await page.goto(url).catch(error => { + if (import_fs.default.existsSync(url)) + url = "file://" + import_path.default.resolve(url); + else if (!url.startsWith("http") && !url.startsWith("file://") && !url.startsWith("about:") && !url.startsWith("data:")) + url = "http://" + url; + await page.goto(url).catch((error) => { if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN) { - // Tests with PWTEST_CLI_AUTO_EXIT_WHEN might close page too fast, resulting - // in a stray navigation aborted error. We should ignore it. } else { throw error; } @@ -419,14 +427,7 @@ async function openPage(context, url) { return page; } async function open(options, url, language) { - const { - context, - launchOptions, - contextOptions - } = await launchContext(options, { - headless: !!process.env.PWTEST_CLI_HEADLESS, - executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH - }); + const { context, launchOptions, contextOptions } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH }); await context._enableRecorder({ language, launchOptions, @@ -438,33 +439,23 @@ async function open(options, url, language) { await openPage(context, url); } async function codegen(options, url) { - const { - target: language, - output: outputFile, - testIdAttribute: testIdAttributeName - } = options; - const tracesDir = _path.default.join(_os.default.tmpdir(), `playwright-recorder-trace-${Date.now()}`); - const { - context, - launchOptions, - contextOptions - } = await launchContext(options, { + const { target: language, output: outputFile, testIdAttribute: testIdAttributeName } = options; + const tracesDir = import_path.default.join(import_os.default.tmpdir(), `playwright-recorder-trace-${Date.now()}`); + const { context, launchOptions, contextOptions } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH, tracesDir }); - _utilsBundle.dotenv.config({ - path: 'playwright.env' - }); + import_utilsBundle.dotenv.config({ path: "playwright.env" }); await context._enableRecorder({ language, launchOptions, contextOptions, device: options.device, saveStorage: options.saveStorage, - mode: 'recording', + mode: "recording", testIdAttributeName, - outputFile: outputFile ? _path.default.resolve(outputFile) : undefined, + outputFile: outputFile ? import_path.default.resolve(outputFile) : void 0, handleSIGINT: false }); await openPage(context, url); @@ -479,41 +470,24 @@ async function waitForPage(page, captureOptions) { await page.waitForTimeout(parseInt(captureOptions.waitForTimeout, 10)); } } -async function screenshot(options, captureOptions, url, path) { - const { - context - } = await launchContext(options, { - headless: true - }); - console.log('Navigating to ' + url); +async function screenshot(options, captureOptions, url, path2) { + const { context } = await launchContext(options, { headless: true }); + console.log("Navigating to " + url); const page = await openPage(context, url); await waitForPage(page, captureOptions); - console.log('Capturing screenshot into ' + path); - await page.screenshot({ - path, - fullPage: !!captureOptions.fullPage - }); - // launchContext takes care of closing the browser. + console.log("Capturing screenshot into " + path2); + await page.screenshot({ path: path2, fullPage: !!captureOptions.fullPage }); await page.close(); } -async function pdf(options, captureOptions, url, path) { - if (options.browser !== 'chromium') throw new Error('PDF creation is only working with Chromium'); - const { - context - } = await launchContext({ - ...options, - browser: 'chromium' - }, { - headless: true - }); - console.log('Navigating to ' + url); +async function pdf(options, captureOptions, url, path2) { + if (options.browser !== "chromium") + throw new Error("PDF creation is only working with Chromium"); + const { context } = await launchContext({ ...options, browser: "chromium" }, { headless: true }); + console.log("Navigating to " + url); const page = await openPage(context, url); await waitForPage(page, captureOptions); - console.log('Saving as pdf into ' + path); - await page.pdf({ - path - }); - // launchContext takes care of closing the browser. + console.log("Saving as pdf into " + path2); + await page.pdf({ path: path2, format: captureOptions.paperFormat }); await page.close(); } function lookupBrowserType(options) { @@ -524,60 +498,70 @@ function lookupBrowserType(options) { } let browserType; switch (name) { - case 'chromium': + case "chromium": browserType = playwright.chromium; break; - case 'webkit': + case "webkit": browserType = playwright.webkit; break; - case 'firefox': + case "firefox": browserType = playwright.firefox; break; - case 'cr': + case "cr": browserType = playwright.chromium; break; - case 'wk': + case "wk": browserType = playwright.webkit; break; - case 'ff': + case "ff": browserType = playwright.firefox; break; } - if (browserType) return browserType; - _utilsBundle.program.help(); + if (browserType) + return browserType; + import_utilsBundle.program.help(); } function validateOptions(options) { if (options.device && !(options.device in playwright.devices)) { const lines = [`Device descriptor not found: '${options.device}', available devices are:`]; - for (const name in playwright.devices) lines.push(` "${name}"`); - throw new Error(lines.join('\n')); + for (const name in playwright.devices) + lines.push(` "${name}"`); + throw new Error(lines.join("\n")); } - if (options.colorScheme && !['light', 'dark'].includes(options.colorScheme)) throw new Error('Invalid color scheme, should be one of "light", "dark"'); + if (options.colorScheme && !["light", "dark"].includes(options.colorScheme)) + throw new Error('Invalid color scheme, should be one of "light", "dark"'); } function logErrorAndExit(e) { - if (process.env.PWDEBUGIMPL) console.error(e);else console.error(e.name + ': ' + e.message); - (0, _utils.gracefullyProcessExitDoNotHang)(1); + if (process.env.PWDEBUGIMPL) + console.error(e); + else + console.error(e.name + ": " + e.message); + (0, import_utils.gracefullyProcessExitDoNotHang)(1); } function codegenId() { - return process.env.PW_LANG_NAME || 'playwright-test'; + return process.env.PW_LANG_NAME || "playwright-test"; } function commandWithOpenOptions(command, description, options) { - let result = _utilsBundle.program.command(command).description(description); - for (const option of options) result = result.option(option[0], ...option.slice(1)); - return result.option('-b, --browser ', 'browser to use, one of cr, chromium, ff, firefox, wk, webkit', 'chromium').option('--block-service-workers', 'block service workers').option('--channel ', 'Chromium distribution channel, "chrome", "chrome-beta", "msedge-dev", etc').option('--color-scheme ', 'emulate preferred color scheme, "light" or "dark"').option('--device ', 'emulate device, for example "iPhone 11"').option('--geolocation ', 'specify geolocation coordinates, for example "37.819722,-122.478611"').option('--ignore-https-errors', 'ignore https errors').option('--load-storage ', 'load context storage state from the file, previously saved with --save-storage').option('--lang ', 'specify language / locale, for example "en-GB"').option('--proxy-server ', 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option('--proxy-bypass ', 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option('--save-har ', 'save HAR file with all network activity at the end').option('--save-har-glob ', 'filter entries in the HAR by matching url against this glob pattern').option('--save-storage ', 'save context storage state at the end, for later use with --load-storage').option('--timezone