Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: make trace viewer work over http (#23531)
Pavel Feldmaneacfff812772
diff --git a/packages/playwright-core/ThirdPartyNotices.txt b/packages/playwright-core/ThirdPartyNotices.txtindex 90d4d0135f..a4d0c4a588 100644--- a/packages/playwright-core/ThirdPartyNotices.txt+++ b/packages/playwright-core/ThirdPartyNotices.txt@@ -15,6 +15,7 @@ This project incorporates components from the projects listed below. The origina- [email protected] (https://github.com/tj/commander.js)- [email protected] (https://github.com/substack/node-concat-map)- [email protected] (https://github.com/debug-js/debug)+- [email protected] (https://github.com/sindresorhus/define-lazy-prop)- [email protected] (https://github.com/mafintosh/end-of-stream)- [email protected] (https://github.com/sindresorhus/escape-string-regexp)- [email protected] (https://github.com/maxogden/extract-zip)@@ -27,11 +28,14 @@ This project incorporates components from the projects listed below. The origina- [email protected] (https://github.com/npm/inflight)- [email protected] (https://github.com/isaacs/inherits)- [email protected] (https://github.com/indutny/node-ip)+- [email protected] (https://github.com/sindresorhus/is-docker)+- [email protected] (https://github.com/sindresorhus/is-wsl)- [email protected] (https://github.com/eugeneware/jpeg-js)- [email protected] (https://github.com/broofa/mime)- [email protected] (https://github.com/isaacs/minimatch)- [email protected] (https://github.com/zeit/ms)- [email protected] (https://github.com/isaacs/once)+- [email protected] (https://github.com/sindresorhus/open)- [email protected] (https://github.com/sindresorhus/path-is-absolute)- [email protected] (https://github.com/andrewrk/node-pend)- [email protected] (https://github.com/lukeapage/pngjs)@@ -458,6 +462,20 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.=========================================END OF [email protected] AND INFORMATION+%% [email protected] NOTICES AND INFORMATION BEGIN HERE+=========================================+MIT License++Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)++Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+=========================================+END OF [email protected] AND INFORMATION+%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================The MIT License (MIT)@@ -937,6 +955,34 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.=========================================END OF [email protected] AND INFORMATION+%% [email protected] NOTICES AND INFORMATION BEGIN HERE+=========================================+MIT License++Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)++Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+=========================================+END OF [email protected] AND INFORMATION++%% [email protected] NOTICES AND INFORMATION BEGIN HERE+=========================================+MIT License++Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)++Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+=========================================+END OF [email protected] AND INFORMATION+%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================Copyright (c) 2014, Eugene Ware@@ -1059,6 +1105,20 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.=========================================END OF [email protected] AND INFORMATION+%% [email protected] NOTICES AND INFORMATION BEGIN HERE+=========================================+MIT License++Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)++Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+=========================================+END OF [email protected] AND INFORMATION+%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================The MIT License (MIT)@@ -1614,6 +1674,6 @@ END OF [email protected] AND INFORMATIONSUMMARY BEGIN HERE=========================================-Total Packages: 45+Total Packages: 49=========================================END OF SUMMARY\ No newline at end of filediff --git a/packages/playwright-core/bundles/utils/package-lock.json b/packages/playwright-core/bundles/utils/package-lock.jsonindex 15b97625db..c4ddbc0a29 100644--- a/packages/playwright-core/bundles/utils/package-lock.json+++ b/packages/playwright-core/bundles/utils/package-lock.json@@ -17,6 +17,7 @@"jpeg-js": "0.4.4","mime": "^3.0.0","minimatch": "^3.1.2",+ "open": "8.4.0","pngjs": "6.0.0","progress": "2.0.3","proxy-from-env": "1.1.0",@@ -213,6 +214,14 @@}}},+ "node_modules/define-lazy-prop": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",+ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",+ "engines": {+ "node": ">=8"+ }+ },"node_modules/escape-string-regexp": {"version": "2.0.0","resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",@@ -281,6 +290,31 @@"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz","integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ=="},+ "node_modules/is-docker": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",+ "bin": {+ "is-docker": "cli.js"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-wsl": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",+ "dependencies": {+ "is-docker": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/jpeg-js": {"version": "0.4.4","resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",@@ -321,6 +355,22 @@"wrappy": "1"}},+ "node_modules/open": {+ "version": "8.4.0",+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",+ "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",+ "dependencies": {+ "define-lazy-prop": "^2.0.0",+ "is-docker": "^2.1.1",+ "is-wsl": "^2.2.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/path-is-absolute": {"version": "1.0.1","resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",@@ -605,6 +655,11 @@"ms": "2.1.2"}},+ "define-lazy-prop": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",+ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og=="+ },"escape-string-regexp": {"version": "2.0.0","resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",@@ -661,6 +716,19 @@"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz","integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ=="},+ "is-docker": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="+ },+ "is-wsl": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",+ "requires": {+ "is-docker": "^2.0.0"+ }+ },"jpeg-js": {"version": "0.4.4","resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",@@ -692,6 +760,16 @@"wrappy": "1"}},+ "open": {+ "version": "8.4.0",+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",+ "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",+ "requires": {+ "define-lazy-prop": "^2.0.0",+ "is-docker": "^2.1.1",+ "is-wsl": "^2.2.0"+ }+ },"path-is-absolute": {"version": "1.0.1","resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",diff --git a/packages/playwright-core/bundles/utils/package.json b/packages/playwright-core/bundles/utils/package.jsonindex 402ac64739..d8216841ea 100644--- a/packages/playwright-core/bundles/utils/package.json+++ b/packages/playwright-core/bundles/utils/package.json@@ -18,6 +18,7 @@"jpeg-js": "0.4.4","mime": "^3.0.0","minimatch": "^3.1.2",+ "open": "8.4.0","pngjs": "6.0.0","progress": "2.0.3","proxy-from-env": "1.1.0",diff --git a/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts b/packages/playwright-core/bundles/utils/src/utilsBundleImpl.tsindex ee081796f6..91209c8c87 100644--- a/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts+++ b/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts@@ -36,6 +36,9 @@ export const mime = mimeLibrary;import minimatchLibrary from 'minimatch';export const minimatch = minimatchLibrary;+import openLibrary from 'open';+export const open = openLibrary;+export { PNG } from 'pngjs';export { program } from 'commander';diff --git a/packages/playwright-core/src/cli/program.ts b/packages/playwright-core/src/cli/program.tsindex 2f97e4b6da..0f362ead08 100644--- a/packages/playwright-core/src/cli/program.ts+++ b/packages/playwright-core/src/cli/program.ts@@ -287,6 +287,7 @@ program.option('-b, --browser <browserType>', 'browser to use, one of cr, chromium, ff, firefox, wk, webkit', 'chromium').option('-h, --host <host>', 'Host to serve trace on', 'localhost').option('-p, --port <port>', 'Port to serve trace on', '9322')+ .option('--web', 'Open trace viewer as a PWA in a browser tab').option('--stdin', 'Accept trace URLs over stdin to update the viewer').description('show trace viewer').action(function(traces, options) {@@ -297,7 +298,8 @@ programif (options.browser === 'wk')options.browser = 'webkit';- showTraceViewer(traces, options.browser, { headless: false, host: options.host, port: +options.port, isServer: !!options.stdin }).catch(logErrorAndExit);+ const openOptions = { headless: false, host: options.host, port: +options.port, isServer: !!options.stdin, openInBrowser: !!options.web };+ showTraceViewer(traces, options.browser, openOptions).catch(logErrorAndExit);}).addHelpText('afterAll', `Examples:diff --git a/packages/playwright-core/src/server/index.ts b/packages/playwright-core/src/server/index.tsindex 3c65e01ab5..05b4c4e590 100644--- a/packages/playwright-core/src/server/index.ts+++ b/packages/playwright-core/src/server/index.ts@@ -29,5 +29,5 @@ export { createPlaywright } from './playwright';export type { DispatcherScope } from './dispatchers/dispatcher';export type { Playwright } from './playwright';-export { showTraceViewer } from './trace/viewer/traceViewer';+export { showTraceViewer, openTraceViewerApp } from './trace/viewer/traceViewer';export { serverSideCallMetadata } from './instrumentation';\ No newline at end of filediff --git a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts b/packages/playwright-core/src/server/trace/viewer/traceViewer.tsindex e2d35d4a88..5a85732807 100644--- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts+++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts@@ -23,14 +23,20 @@ import { installAppIcon, syncLocalStorageWithSettings } from '../../chromium/crAimport { serverSideCallMetadata } from '../../instrumentation';import { createPlaywright } from '../../playwright';import { ProgressController } from '../../progress';+import { open } from 'playwright-core/lib/utilsBundle';import type { Page } from '../../page';-type Options = { app?: string, headless?: boolean, host?: string, port?: number, isServer?: boolean };+type Options = { app?: string, headless?: boolean, host?: string, port?: number, isServer?: boolean, openInBrowser?: boolean };-export async function showTraceViewer(traceUrls: string[], browserName: string, options?: Options): Promise<Page> {- const stdinServer = options?.isServer ? new StdinServer() : undefined;+export async function showTraceViewer(traceUrls: string[], browserName: string, options?: Options): Promise<void> {+ if (options?.openInBrowser) {+ await openTraceInBrowser(traceUrls, options);+ return;+ }+ await openTraceViewerApp(traceUrls, browserName, options);+}- const { headless = false, host, port, app } = options || {};+async function startTraceViewerServer(traceUrls: string[], options?: Options): Promise<{ server: HttpServer, url: string }> {for (const traceUrl of traceUrls) {let traceFile = traceUrl;// If .json is requested, we'll synthesize it.@@ -72,8 +78,23 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,return server.serveFile(request, response, absolutePath);});+ const params = traceUrls.map(t => `trace=${t}`);+ if (options?.isServer)+ params.push('isServer');+ if (isUnderTest())+ params.push('isUnderTest=true');++ const { host, port } = options || {};const urlPrefix = await server.start({ preferredPort: port, host });+ const { app } = options || {};+ const searchQuery = params.length ? '?' + params.join('&') : '';+ const url = urlPrefix + `/trace/${app || 'index.html'}${searchQuery}`;+ return { server, url };+}+export async function openTraceViewerApp(traceUrls: string[], browserName: string, options?: Options): Promise<Page> {+ const stdinServer = options?.isServer ? new StdinServer() : undefined;+ const { url } = await startTraceViewerServer(traceUrls, options);const traceViewerPlaywright = createPlaywright({ sdkLanguage: 'javascript', isInternalPlaywright: true });const traceViewerBrowser = isUnderTest() ? 'chromium' : browserName;const args = traceViewerBrowser === 'chromium' ? [@@ -87,7 +108,7 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,channel: findChromiumChannel(traceViewerPlaywright.options.sdkLanguage),args,noDefaultViewport: true,- headless,+ headless: options?.headless,ignoreDefaultArgs: ['--enable-automation'],colorScheme: 'no-override',useWebSocket: isUnderTest(),@@ -107,22 +128,22 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,if (!isUnderTest())await syncLocalStorageWithSettings(page, 'traceviewer');- const params = traceUrls.map(t => `trace=${t}`);- if (isUnderTest()) {- params.push('isUnderTest=true');+ if (isUnderTest())page.on('close', () => context.close(serverSideCallMetadata()).catch(() => {}));- } else {+ elsepage.on('close', () => process.exit());- }- if (options?.isServer)- params.push('isServer');- const searchQuery = params.length ? '?' + params.join('&') : '';- await page.mainFrame().goto(serverSideCallMetadata(), urlPrefix + `/trace/${app || 'index.html'}${searchQuery}`);+ await page.mainFrame().goto(serverSideCallMetadata(), url);stdinServer?.setPage(page);return page;}+async function openTraceInBrowser(traceUrls: string[], options?: Options) {+ const { url } = await startTraceViewerServer(traceUrls, options);+ // eslint-disable-next-line no-console+ await open(url, { wait: true }).catch(() => console.log(`Failed to open browser on ${url}`));+}+class StdinServer {private _pollTimer: NodeJS.Timeout | undefined;private _traceUrl: string | undefined;diff --git a/packages/playwright-core/src/utils/httpServer.ts b/packages/playwright-core/src/utils/httpServer.tsindex a18989186e..32901eb3d4 100644--- a/packages/playwright-core/src/utils/httpServer.ts+++ b/packages/playwright-core/src/utils/httpServer.ts@@ -17,8 +17,7 @@import type http from 'http';import fs from 'fs';import path from 'path';-import { mime, wsServer } from '../utilsBundle';-import type { WebSocketServer } from '../utilsBundle';+import { mime } from '../utilsBundle';import { assert } from './debug';import { createHttpServer } from './network';import { ManualPromise } from './manualPromise';@@ -37,8 +36,8 @@ export class HttpServer {this._server = createHttpServer(this._onRequest.bind(this));}- createWebSocketServer(): WebSocketServer {- return new wsServer({ server: this._server });+ server() {+ return this._server;}routePrefix(prefix: string, handler: ServerRouteHandler) {diff --git a/packages/playwright-core/src/utilsBundle.ts b/packages/playwright-core/src/utilsBundle.tsindex 0d750c0593..5ecccbcbfd 100644--- a/packages/playwright-core/src/utilsBundle.ts+++ b/packages/playwright-core/src/utilsBundle.ts@@ -25,6 +25,7 @@ export const jpegjs: typeof import('../bundles/utils/node_modules/jpeg-js') = reexport const lockfile: typeof import('../bundles/utils/node_modules/@types/proper-lockfile') = require('./utilsBundleImpl').lockfile;export const mime: typeof import('../bundles/utils/node_modules/@types/mime') = require('./utilsBundleImpl').mime;export const minimatch: typeof import('../bundles/utils/node_modules/@types/minimatch') = require('./utilsBundleImpl').minimatch;+export const open: typeof import('../bundles/utils/node_modules/open') = require('./utilsBundleImpl').open;export const PNG: typeof import('../bundles/utils/node_modules/@types/pngjs').PNG = require('./utilsBundleImpl').PNG;export const program: typeof import('../bundles/utils/node_modules/commander').program = require('./utilsBundleImpl').program;export const progress: typeof import('../bundles/utils/node_modules/@types/progress') = require('./utilsBundleImpl').progress;diff --git a/packages/playwright-test/ThirdPartyNotices.txt b/packages/playwright-test/ThirdPartyNotices.txtindex 6af2b5fbb7..7719ecbe45 100644--- a/packages/playwright-test/ThirdPartyNotices.txt+++ b/packages/playwright-test/ThirdPartyNotices.txt@@ -99,7 +99,6 @@ This project incorporates components from the projects listed below. The origina- [email protected] (https://github.com/colorjs/color-name)- [email protected] (https://github.com/thlorenz/convert-source-map)- [email protected] (https://github.com/debug-js/debug)-- [email protected] (https://github.com/sindresorhus/define-lazy-prop)- [email protected] (https://github.com/facebook/jest)- [email protected] (https://github.com/kilian/electron-to-chromium)- [email protected] (https://github.com/enquirer/enquirer)@@ -115,11 +114,9 @@ This project incorporates components from the projects listed below. The origina- [email protected] (https://github.com/sindresorhus/has-flag)- [email protected] (https://github.com/sindresorhus/has-flag)- [email protected] (https://github.com/sindresorhus/is-binary-path)-- [email protected] (https://github.com/sindresorhus/is-docker)- [email protected] (https://github.com/jonschlinkert/is-extglob)- [email protected] (https://github.com/micromatch/is-glob)- [email protected] (https://github.com/jonschlinkert/is-number)-- [email protected] (https://github.com/sindresorhus/is-wsl)- [email protected] (https://github.com/facebook/jest)- [email protected] (https://github.com/facebook/jest)- [email protected] (https://github.com/facebook/jest)@@ -133,7 +130,6 @@ This project incorporates components from the projects listed below. The origina- [email protected] (https://github.com/zeit/ms)- [email protected] (https://github.com/chicoxyzzy/node-releases)- [email protected] (https://github.com/jonschlinkert/normalize-path)-- [email protected] (https://github.com/sindresorhus/open)- [email protected] (https://github.com/alexeyraspopov/picocolors)- [email protected] (https://github.com/micromatch/picomatch)- [email protected] (https://github.com/danez/pirates)@@ -3105,20 +3101,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.=========================================END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE-=========================================-MIT License--Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)--Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-=========================================-END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================MIT License@@ -3395,20 +3377,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI=========================================END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE-=========================================-MIT License--Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)--Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-=========================================-END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================The MIT License (MIT)@@ -3487,20 +3455,6 @@ THE SOFTWARE.=========================================END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE-=========================================-MIT License--Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)--Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-=========================================-END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================MIT License@@ -3834,20 +3788,6 @@ THE SOFTWARE.=========================================END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE-=========================================-MIT License--Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)--Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-=========================================-END OF [email protected] AND INFORMATION-%% [email protected] NOTICES AND INFORMATION BEGIN HERE=========================================ISC License@@ -4284,6 +4224,6 @@ END OF [email protected] AND INFORMATIONSUMMARY BEGIN HERE=========================================-Total Packages: 149+Total Packages: 145=========================================END OF SUMMARY\ No newline at end of filediff --git a/packages/playwright-test/bundles/utils/package-lock.json b/packages/playwright-test/bundles/utils/package-lock.jsonindex 31d62ac5dc..cd6db1534e 100644--- a/packages/playwright-test/bundles/utils/package-lock.json+++ b/packages/playwright-test/bundles/utils/package-lock.json@@ -11,7 +11,6 @@"chokidar": "3.5.3","enquirer": "2.3.6","json5": "2.2.3",- "open": "8.4.0","pirates": "4.0.4","source-map-support": "0.5.21","stoppable": "1.1.0"@@ -115,14 +114,6 @@"fsevents": "~2.3.2"}},- "node_modules/define-lazy-prop": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",- "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",- "engines": {- "node": ">=8"- }- },"node_modules/enquirer": {"version": "2.3.6","resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",@@ -180,20 +171,6 @@"node": ">=8"}},- "node_modules/is-docker": {- "version": "2.2.1",- "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",- "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",- "bin": {- "is-docker": "cli.js"- },- "engines": {- "node": ">=8"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"- }- },"node_modules/is-extglob": {"version": "2.1.1","resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",@@ -221,17 +198,6 @@"node": ">=0.12.0"}},- "node_modules/is-wsl": {- "version": "2.2.0",- "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",- "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",- "dependencies": {- "is-docker": "^2.0.0"- },- "engines": {- "node": ">=8"- }- },"node_modules/json5": {"version": "2.2.3","resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",@@ -251,22 +217,6 @@"node": ">=0.10.0"}},- "node_modules/open": {- "version": "8.4.0",- "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",- "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",- "dependencies": {- "define-lazy-prop": "^2.0.0",- "is-docker": "^2.1.1",- "is-wsl": "^2.2.0"- },- "engines": {- "node": ">=12"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"- }- },"node_modules/picomatch": {"version": "2.3.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",@@ -407,11 +357,6 @@"readdirp": "~3.6.0"}},- "define-lazy-prop": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",- "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og=="- },"enquirer": {"version": "2.3.6","resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",@@ -450,11 +395,6 @@"binary-extensions": "^2.0.0"}},- "is-docker": {- "version": "2.2.1",- "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",- "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="- },"is-extglob": {"version": "2.1.1","resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",@@ -473,14 +413,6 @@"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz","integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="},- "is-wsl": {- "version": "2.2.0",- "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",- "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",- "requires": {- "is-docker": "^2.0.0"- }- },"json5": {"version": "2.2.3","resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",@@ -491,16 +423,6 @@"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz","integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="},- "open": {- "version": "8.4.0",- "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",- "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",- "requires": {- "define-lazy-prop": "^2.0.0",- "is-docker": "^2.1.1",- "is-wsl": "^2.2.0"- }- },"picomatch": {"version": "2.3.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",diff --git a/packages/playwright-test/bundles/utils/package.json b/packages/playwright-test/bundles/utils/package.jsonindex 58a00bb70a..d660138349 100644--- a/packages/playwright-test/bundles/utils/package.json+++ b/packages/playwright-test/bundles/utils/package.json@@ -12,7 +12,6 @@"chokidar": "3.5.3","enquirer": "2.3.6","json5": "2.2.3",- "open": "8.4.0","pirates": "4.0.4","source-map-support": "0.5.21","stoppable": "1.1.0"diff --git a/packages/playwright-test/bundles/utils/src/utilsBundleImpl.ts b/packages/playwright-test/bundles/utils/src/utilsBundleImpl.tsindex f934bdf137..7c29c301a8 100644--- a/packages/playwright-test/bundles/utils/src/utilsBundleImpl.ts+++ b/packages/playwright-test/bundles/utils/src/utilsBundleImpl.ts@@ -17,9 +17,6 @@import json5Library from 'json5';export const json5 = json5Library;-import openLibrary from 'open';-export const open = openLibrary;-import * as piratesLibrary from 'pirates';export const pirates = piratesLibrary;diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.tsindex f58b13ba35..0e146e8a74 100644--- a/packages/playwright-test/src/reporters/html.ts+++ b/packages/playwright-test/src/reporters/html.ts@@ -14,9 +14,8 @@* limitations under the License.*/-import { colors } from 'playwright-core/lib/utilsBundle';+import { colors, open } from 'playwright-core/lib/utilsBundle';import fs from 'fs';-import { open } from '../utilsBundle';import path from 'path';import type { TransformCallback } from 'stream';import { Transform } from 'stream';diff --git a/packages/playwright-test/src/runner/uiMode.ts b/packages/playwright-test/src/runner/uiMode.tsindex 10b7a02a98..0dd8681051 100644--- a/packages/playwright-test/src/runner/uiMode.ts+++ b/packages/playwright-test/src/runner/uiMode.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { showTraceViewer } from 'playwright-core/lib/server';+import { openTraceViewerApp } from 'playwright-core/lib/server';import type { Page } from 'playwright-core/lib/server/page';import { isUnderTest, ManualPromise } from 'playwright-core/lib/utils';import type { FullResult } from '../../reporter';@@ -26,7 +26,7 @@ import { createReporters } from './reporters';import { TestRun, createTaskRunnerForList, createTaskRunnerForWatch, createTaskRunnerForWatchSetup } from './tasks';import { chokidar } from '../utilsBundle';import type { FSWatcher } from 'chokidar';-import { open } from '../utilsBundle';+import { open } from 'playwright-core/lib/utilsBundle';import ListReporter from '../reporters/list';class UIMode {@@ -82,7 +82,7 @@ class UIMode {}async showUI() {- this._page = await showTraceViewer([], 'chromium', { app: 'uiMode.html', headless: isUnderTest() && process.env.PWTEST_HEADED_FOR_TEST !== '1' });+ this._page = await openTraceViewerApp([], 'chromium', { app: 'uiMode.html', headless: isUnderTest() && process.env.PWTEST_HEADED_FOR_TEST !== '1' });if (!process.env.PWTEST_DEBUG) {process.stdout.write = (chunk: string | Buffer) => {this._dispatchEvent({ method: 'stdio', params: chunkToPayload('stdout', chunk) });diff --git a/packages/playwright-test/src/utilsBundle.ts b/packages/playwright-test/src/utilsBundle.tsindex dac8bc1d3f..072e16bb03 100644--- a/packages/playwright-test/src/utilsBundle.ts+++ b/packages/playwright-test/src/utilsBundle.ts@@ -15,7 +15,6 @@*/export const json5: typeof import('../bundles/utils/node_modules/json5/lib') = require('./utilsBundleImpl').json5;-export const open: typeof import('../bundles/utils/node_modules/open') = require('./utilsBundleImpl').open;export const pirates: typeof import('../bundles/utils/node_modules/pirates') = require('./utilsBundleImpl').pirates;export const sourceMapSupport: typeof import('../bundles/utils/node_modules/@types/source-map-support') = require('./utilsBundleImpl').sourceMapSupport;export const stoppable: typeof import('../bundles/utils/node_modules/@types/stoppable') = require('./utilsBundleImpl').stoppable;diff --git a/tests/config/traceViewerFixtures.ts b/tests/config/traceViewerFixtures.tsindex 8dc9bbaa1b..fc51c5106d 100644--- a/tests/config/traceViewerFixtures.ts+++ b/tests/config/traceViewerFixtures.ts@@ -16,7 +16,7 @@import type { Fixtures, FrameLocator, Locator, Page, Browser, BrowserContext } from '@playwright/test';import { step } from './baseTest';-import { showTraceViewer } from '../../packages/playwright-core/lib/server';+import { openTraceViewerApp } from '../../packages/playwright-core/lib/server';type BaseTestFixtures = {context: BrowserContext;@@ -111,7 +111,7 @@ export const traceViewerFixtures: Fixtures<TraceViewerFixtures, {}, BaseTestFixtconst browsers: Browser[] = [];const contextImpls: any[] = [];await use(async (traces: string[], { host, port } = {}) => {- const pageImpl = await showTraceViewer(traces, browserName, { headless, host, port });+ const pageImpl = await openTraceViewerApp(traces, browserName, { headless, host, port });const contextImpl = pageImpl.context();const browser = await playwright.chromium.connectOverCDP(contextImpl._browser.options.wsEndpoint);browsers.push(browser);