chore: make trace viewer work over http (#23531)

This commit is contained in:
Pavel Feldman 2023-06-05 16:30:30 -07:00 committed by GitHub
parent 6b687b6d69
commit eacfff8127
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 194 additions and 173 deletions

View file

@ -15,6 +15,7 @@ This project incorporates components from the projects listed below. The origina
- commander@8.3.0 (https://github.com/tj/commander.js) - commander@8.3.0 (https://github.com/tj/commander.js)
- concat-map@0.0.1 (https://github.com/substack/node-concat-map) - concat-map@0.0.1 (https://github.com/substack/node-concat-map)
- debug@4.3.4 (https://github.com/debug-js/debug) - debug@4.3.4 (https://github.com/debug-js/debug)
- define-lazy-prop@2.0.0 (https://github.com/sindresorhus/define-lazy-prop)
- end-of-stream@1.4.4 (https://github.com/mafintosh/end-of-stream) - end-of-stream@1.4.4 (https://github.com/mafintosh/end-of-stream)
- escape-string-regexp@2.0.0 (https://github.com/sindresorhus/escape-string-regexp) - escape-string-regexp@2.0.0 (https://github.com/sindresorhus/escape-string-regexp)
- extract-zip@2.0.1 (https://github.com/maxogden/extract-zip) - extract-zip@2.0.1 (https://github.com/maxogden/extract-zip)
@ -27,11 +28,14 @@ This project incorporates components from the projects listed below. The origina
- inflight@1.0.6 (https://github.com/npm/inflight) - inflight@1.0.6 (https://github.com/npm/inflight)
- inherits@2.0.4 (https://github.com/isaacs/inherits) - inherits@2.0.4 (https://github.com/isaacs/inherits)
- ip@2.0.0 (https://github.com/indutny/node-ip) - ip@2.0.0 (https://github.com/indutny/node-ip)
- is-docker@2.2.1 (https://github.com/sindresorhus/is-docker)
- is-wsl@2.2.0 (https://github.com/sindresorhus/is-wsl)
- jpeg-js@0.4.4 (https://github.com/eugeneware/jpeg-js) - jpeg-js@0.4.4 (https://github.com/eugeneware/jpeg-js)
- mime@3.0.0 (https://github.com/broofa/mime) - mime@3.0.0 (https://github.com/broofa/mime)
- minimatch@3.1.2 (https://github.com/isaacs/minimatch) - minimatch@3.1.2 (https://github.com/isaacs/minimatch)
- ms@2.1.2 (https://github.com/zeit/ms) - ms@2.1.2 (https://github.com/zeit/ms)
- once@1.4.0 (https://github.com/isaacs/once) - once@1.4.0 (https://github.com/isaacs/once)
- open@8.4.0 (https://github.com/sindresorhus/open)
- path-is-absolute@1.0.1 (https://github.com/sindresorhus/path-is-absolute) - path-is-absolute@1.0.1 (https://github.com/sindresorhus/path-is-absolute)
- pend@1.2.0 (https://github.com/andrewrk/node-pend) - pend@1.2.0 (https://github.com/andrewrk/node-pend)
- pngjs@6.0.0 (https://github.com/lukeapage/pngjs) - pngjs@6.0.0 (https://github.com/lukeapage/pngjs)
@ -458,6 +462,20 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
========================================= =========================================
END OF debug@4.3.4 AND INFORMATION END OF debug@4.3.4 AND INFORMATION
%% define-lazy-prop@2.0.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 define-lazy-prop@2.0.0 AND INFORMATION
%% end-of-stream@1.4.4 NOTICES AND INFORMATION BEGIN HERE %% end-of-stream@1.4.4 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
The MIT License (MIT) The MIT License (MIT)
@ -937,6 +955,34 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
========================================= =========================================
END OF ip@2.0.0 AND INFORMATION END OF ip@2.0.0 AND INFORMATION
%% is-docker@2.2.1 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 is-docker@2.2.1 AND INFORMATION
%% is-wsl@2.2.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 is-wsl@2.2.0 AND INFORMATION
%% jpeg-js@0.4.4 NOTICES AND INFORMATION BEGIN HERE %% jpeg-js@0.4.4 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
Copyright (c) 2014, Eugene Ware Copyright (c) 2014, Eugene Ware
@ -1059,6 +1105,20 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
========================================= =========================================
END OF once@1.4.0 AND INFORMATION END OF once@1.4.0 AND INFORMATION
%% open@8.4.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 open@8.4.0 AND INFORMATION
%% path-is-absolute@1.0.1 NOTICES AND INFORMATION BEGIN HERE %% path-is-absolute@1.0.1 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
The MIT License (MIT) The MIT License (MIT)
@ -1614,6 +1674,6 @@ END OF yazl@2.5.1 AND INFORMATION
SUMMARY BEGIN HERE SUMMARY BEGIN HERE
========================================= =========================================
Total Packages: 45 Total Packages: 49
========================================= =========================================
END OF SUMMARY END OF SUMMARY

View file

@ -17,6 +17,7 @@
"jpeg-js": "0.4.4", "jpeg-js": "0.4.4",
"mime": "^3.0.0", "mime": "^3.0.0",
"minimatch": "^3.1.2", "minimatch": "^3.1.2",
"open": "8.4.0",
"pngjs": "6.0.0", "pngjs": "6.0.0",
"progress": "2.0.3", "progress": "2.0.3",
"proxy-from-env": "1.1.0", "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": { "node_modules/escape-string-regexp": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "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", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" "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": { "node_modules/jpeg-js": {
"version": "0.4.4", "version": "0.4.4",
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",
@ -321,6 +355,22 @@
"wrappy": "1" "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": { "node_modules/path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@ -605,6 +655,11 @@
"ms": "2.1.2" "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": { "escape-string-regexp": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "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", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" "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": { "jpeg-js": {
"version": "0.4.4", "version": "0.4.4",
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",
@ -692,6 +760,16 @@
"wrappy": "1" "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": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",

View file

@ -18,6 +18,7 @@
"jpeg-js": "0.4.4", "jpeg-js": "0.4.4",
"mime": "^3.0.0", "mime": "^3.0.0",
"minimatch": "^3.1.2", "minimatch": "^3.1.2",
"open": "8.4.0",
"pngjs": "6.0.0", "pngjs": "6.0.0",
"progress": "2.0.3", "progress": "2.0.3",
"proxy-from-env": "1.1.0", "proxy-from-env": "1.1.0",

View file

@ -36,6 +36,9 @@ export const mime = mimeLibrary;
import minimatchLibrary from 'minimatch'; import minimatchLibrary from 'minimatch';
export const minimatch = minimatchLibrary; export const minimatch = minimatchLibrary;
import openLibrary from 'open';
export const open = openLibrary;
export { PNG } from 'pngjs'; export { PNG } from 'pngjs';
export { program } from 'commander'; export { program } from 'commander';

View file

@ -287,6 +287,7 @@ program
.option('-b, --browser <browserType>', 'browser to use, one of cr, chromium, ff, firefox, wk, webkit', 'chromium') .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('-h, --host <host>', 'Host to serve trace on', 'localhost')
.option('-p, --port <port>', 'Port to serve trace on', '9322') .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') .option('--stdin', 'Accept trace URLs over stdin to update the viewer')
.description('show trace viewer') .description('show trace viewer')
.action(function(traces, options) { .action(function(traces, options) {
@ -297,7 +298,8 @@ program
if (options.browser === 'wk') if (options.browser === 'wk')
options.browser = 'webkit'; 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', ` }).addHelpText('afterAll', `
Examples: Examples:

View file

@ -29,5 +29,5 @@ export { createPlaywright } from './playwright';
export type { DispatcherScope } from './dispatchers/dispatcher'; export type { DispatcherScope } from './dispatchers/dispatcher';
export type { Playwright } from './playwright'; export type { Playwright } from './playwright';
export { showTraceViewer } from './trace/viewer/traceViewer'; export { showTraceViewer, openTraceViewerApp } from './trace/viewer/traceViewer';
export { serverSideCallMetadata } from './instrumentation'; export { serverSideCallMetadata } from './instrumentation';

View file

@ -23,14 +23,20 @@ import { installAppIcon, syncLocalStorageWithSettings } from '../../chromium/crA
import { serverSideCallMetadata } from '../../instrumentation'; import { serverSideCallMetadata } from '../../instrumentation';
import { createPlaywright } from '../../playwright'; import { createPlaywright } from '../../playwright';
import { ProgressController } from '../../progress'; import { ProgressController } from '../../progress';
import { open } from 'playwright-core/lib/utilsBundle';
import type { Page } from '../../page'; 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> { export async function showTraceViewer(traceUrls: string[], browserName: string, options?: Options): Promise<void> {
const stdinServer = options?.isServer ? new StdinServer() : undefined; 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) { for (const traceUrl of traceUrls) {
let traceFile = traceUrl; let traceFile = traceUrl;
// If .json is requested, we'll synthesize it. // 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); return server.serveFile(request, response, absolutePath);
}); });
const urlPrefix = await server.start({ preferredPort: port, host }); 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 traceViewerPlaywright = createPlaywright({ sdkLanguage: 'javascript', isInternalPlaywright: true });
const traceViewerBrowser = isUnderTest() ? 'chromium' : browserName; const traceViewerBrowser = isUnderTest() ? 'chromium' : browserName;
const args = traceViewerBrowser === 'chromium' ? [ const args = traceViewerBrowser === 'chromium' ? [
@ -87,7 +108,7 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,
channel: findChromiumChannel(traceViewerPlaywright.options.sdkLanguage), channel: findChromiumChannel(traceViewerPlaywright.options.sdkLanguage),
args, args,
noDefaultViewport: true, noDefaultViewport: true,
headless, headless: options?.headless,
ignoreDefaultArgs: ['--enable-automation'], ignoreDefaultArgs: ['--enable-automation'],
colorScheme: 'no-override', colorScheme: 'no-override',
useWebSocket: isUnderTest(), useWebSocket: isUnderTest(),
@ -107,22 +128,22 @@ export async function showTraceViewer(traceUrls: string[], browserName: string,
if (!isUnderTest()) if (!isUnderTest())
await syncLocalStorageWithSettings(page, 'traceviewer'); await syncLocalStorageWithSettings(page, 'traceviewer');
const params = traceUrls.map(t => `trace=${t}`); if (isUnderTest())
if (isUnderTest()) {
params.push('isUnderTest=true');
page.on('close', () => context.close(serverSideCallMetadata()).catch(() => {})); page.on('close', () => context.close(serverSideCallMetadata()).catch(() => {}));
} else { else
page.on('close', () => process.exit()); page.on('close', () => process.exit());
}
if (options?.isServer) await page.mainFrame().goto(serverSideCallMetadata(), url);
params.push('isServer');
const searchQuery = params.length ? '?' + params.join('&') : '';
await page.mainFrame().goto(serverSideCallMetadata(), urlPrefix + `/trace/${app || 'index.html'}${searchQuery}`);
stdinServer?.setPage(page); stdinServer?.setPage(page);
return 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 { class StdinServer {
private _pollTimer: NodeJS.Timeout | undefined; private _pollTimer: NodeJS.Timeout | undefined;
private _traceUrl: string | undefined; private _traceUrl: string | undefined;

View file

@ -17,8 +17,7 @@
import type http from 'http'; import type http from 'http';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { mime, wsServer } from '../utilsBundle'; import { mime } from '../utilsBundle';
import type { WebSocketServer } from '../utilsBundle';
import { assert } from './debug'; import { assert } from './debug';
import { createHttpServer } from './network'; import { createHttpServer } from './network';
import { ManualPromise } from './manualPromise'; import { ManualPromise } from './manualPromise';
@ -37,8 +36,8 @@ export class HttpServer {
this._server = createHttpServer(this._onRequest.bind(this)); this._server = createHttpServer(this._onRequest.bind(this));
} }
createWebSocketServer(): WebSocketServer { server() {
return new wsServer({ server: this._server }); return this._server;
} }
routePrefix(prefix: string, handler: ServerRouteHandler) { routePrefix(prefix: string, handler: ServerRouteHandler) {

View file

@ -25,6 +25,7 @@ export const jpegjs: typeof import('../bundles/utils/node_modules/jpeg-js') = re
export const lockfile: typeof import('../bundles/utils/node_modules/@types/proper-lockfile') = require('./utilsBundleImpl').lockfile; export 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 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 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 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 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; export const progress: typeof import('../bundles/utils/node_modules/@types/progress') = require('./utilsBundleImpl').progress;

View file

@ -99,7 +99,6 @@ This project incorporates components from the projects listed below. The origina
- color-name@1.1.4 (https://github.com/colorjs/color-name) - color-name@1.1.4 (https://github.com/colorjs/color-name)
- convert-source-map@1.8.0 (https://github.com/thlorenz/convert-source-map) - convert-source-map@1.8.0 (https://github.com/thlorenz/convert-source-map)
- debug@4.3.4 (https://github.com/debug-js/debug) - debug@4.3.4 (https://github.com/debug-js/debug)
- define-lazy-prop@2.0.0 (https://github.com/sindresorhus/define-lazy-prop)
- diff-sequences@27.5.1 (https://github.com/facebook/jest) - diff-sequences@27.5.1 (https://github.com/facebook/jest)
- electron-to-chromium@1.4.337 (https://github.com/kilian/electron-to-chromium) - electron-to-chromium@1.4.337 (https://github.com/kilian/electron-to-chromium)
- enquirer@2.3.6 (https://github.com/enquirer/enquirer) - enquirer@2.3.6 (https://github.com/enquirer/enquirer)
@ -115,11 +114,9 @@ This project incorporates components from the projects listed below. The origina
- has-flag@3.0.0 (https://github.com/sindresorhus/has-flag) - has-flag@3.0.0 (https://github.com/sindresorhus/has-flag)
- has-flag@4.0.0 (https://github.com/sindresorhus/has-flag) - has-flag@4.0.0 (https://github.com/sindresorhus/has-flag)
- is-binary-path@2.1.0 (https://github.com/sindresorhus/is-binary-path) - is-binary-path@2.1.0 (https://github.com/sindresorhus/is-binary-path)
- is-docker@2.2.1 (https://github.com/sindresorhus/is-docker)
- is-extglob@2.1.1 (https://github.com/jonschlinkert/is-extglob) - is-extglob@2.1.1 (https://github.com/jonschlinkert/is-extglob)
- is-glob@4.0.3 (https://github.com/micromatch/is-glob) - is-glob@4.0.3 (https://github.com/micromatch/is-glob)
- is-number@7.0.0 (https://github.com/jonschlinkert/is-number) - is-number@7.0.0 (https://github.com/jonschlinkert/is-number)
- is-wsl@2.2.0 (https://github.com/sindresorhus/is-wsl)
- jest-diff@27.5.1 (https://github.com/facebook/jest) - jest-diff@27.5.1 (https://github.com/facebook/jest)
- jest-get-type@27.5.1 (https://github.com/facebook/jest) - jest-get-type@27.5.1 (https://github.com/facebook/jest)
- jest-matcher-utils@27.2.5 (https://github.com/facebook/jest) - jest-matcher-utils@27.2.5 (https://github.com/facebook/jest)
@ -133,7 +130,6 @@ This project incorporates components from the projects listed below. The origina
- ms@2.1.2 (https://github.com/zeit/ms) - ms@2.1.2 (https://github.com/zeit/ms)
- node-releases@2.0.10 (https://github.com/chicoxyzzy/node-releases) - node-releases@2.0.10 (https://github.com/chicoxyzzy/node-releases)
- normalize-path@3.0.0 (https://github.com/jonschlinkert/normalize-path) - normalize-path@3.0.0 (https://github.com/jonschlinkert/normalize-path)
- open@8.4.0 (https://github.com/sindresorhus/open)
- picocolors@1.0.0 (https://github.com/alexeyraspopov/picocolors) - picocolors@1.0.0 (https://github.com/alexeyraspopov/picocolors)
- picomatch@2.3.1 (https://github.com/micromatch/picomatch) - picomatch@2.3.1 (https://github.com/micromatch/picomatch)
- pirates@4.0.4 (https://github.com/danez/pirates) - pirates@4.0.4 (https://github.com/danez/pirates)
@ -3105,20 +3101,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
========================================= =========================================
END OF debug@4.3.4 AND INFORMATION END OF debug@4.3.4 AND INFORMATION
%% define-lazy-prop@2.0.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 define-lazy-prop@2.0.0 AND INFORMATION
%% diff-sequences@27.5.1 NOTICES AND INFORMATION BEGIN HERE %% diff-sequences@27.5.1 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
MIT License MIT License
@ -3395,20 +3377,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
========================================= =========================================
END OF is-binary-path@2.1.0 AND INFORMATION END OF is-binary-path@2.1.0 AND INFORMATION
%% is-docker@2.2.1 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 is-docker@2.2.1 AND INFORMATION
%% is-extglob@2.1.1 NOTICES AND INFORMATION BEGIN HERE %% is-extglob@2.1.1 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
The MIT License (MIT) The MIT License (MIT)
@ -3487,20 +3455,6 @@ THE SOFTWARE.
========================================= =========================================
END OF is-number@7.0.0 AND INFORMATION END OF is-number@7.0.0 AND INFORMATION
%% is-wsl@2.2.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 is-wsl@2.2.0 AND INFORMATION
%% jest-diff@27.5.1 NOTICES AND INFORMATION BEGIN HERE %% jest-diff@27.5.1 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
MIT License MIT License
@ -3834,20 +3788,6 @@ THE SOFTWARE.
========================================= =========================================
END OF normalize-path@3.0.0 AND INFORMATION END OF normalize-path@3.0.0 AND INFORMATION
%% open@8.4.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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 open@8.4.0 AND INFORMATION
%% picocolors@1.0.0 NOTICES AND INFORMATION BEGIN HERE %% picocolors@1.0.0 NOTICES AND INFORMATION BEGIN HERE
========================================= =========================================
ISC License ISC License
@ -4284,6 +4224,6 @@ END OF yallist@3.1.1 AND INFORMATION
SUMMARY BEGIN HERE SUMMARY BEGIN HERE
========================================= =========================================
Total Packages: 149 Total Packages: 145
========================================= =========================================
END OF SUMMARY END OF SUMMARY

View file

@ -11,7 +11,6 @@
"chokidar": "3.5.3", "chokidar": "3.5.3",
"enquirer": "2.3.6", "enquirer": "2.3.6",
"json5": "2.2.3", "json5": "2.2.3",
"open": "8.4.0",
"pirates": "4.0.4", "pirates": "4.0.4",
"source-map-support": "0.5.21", "source-map-support": "0.5.21",
"stoppable": "1.1.0" "stoppable": "1.1.0"
@ -115,14 +114,6 @@
"fsevents": "~2.3.2" "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": { "node_modules/enquirer": {
"version": "2.3.6", "version": "2.3.6",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
@ -180,20 +171,6 @@
"node": ">=8" "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": { "node_modules/is-extglob": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@ -221,17 +198,6 @@
"node": ">=0.12.0" "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": { "node_modules/json5": {
"version": "2.2.3", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
@ -251,22 +217,6 @@
"node": ">=0.10.0" "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": { "node_modules/picomatch": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
@ -407,11 +357,6 @@
"readdirp": "~3.6.0" "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": { "enquirer": {
"version": "2.3.6", "version": "2.3.6",
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
@ -450,11 +395,6 @@
"binary-extensions": "^2.0.0" "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": { "is-extglob": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "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", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" "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": { "json5": {
"version": "2.2.3", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "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", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" "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": { "picomatch": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",

View file

@ -12,7 +12,6 @@
"chokidar": "3.5.3", "chokidar": "3.5.3",
"enquirer": "2.3.6", "enquirer": "2.3.6",
"json5": "2.2.3", "json5": "2.2.3",
"open": "8.4.0",
"pirates": "4.0.4", "pirates": "4.0.4",
"source-map-support": "0.5.21", "source-map-support": "0.5.21",
"stoppable": "1.1.0" "stoppable": "1.1.0"

View file

@ -17,9 +17,6 @@
import json5Library from 'json5'; import json5Library from 'json5';
export const json5 = json5Library; export const json5 = json5Library;
import openLibrary from 'open';
export const open = openLibrary;
import * as piratesLibrary from 'pirates'; import * as piratesLibrary from 'pirates';
export const pirates = piratesLibrary; export const pirates = piratesLibrary;

View file

@ -14,9 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { colors } from 'playwright-core/lib/utilsBundle'; import { colors, open } from 'playwright-core/lib/utilsBundle';
import fs from 'fs'; import fs from 'fs';
import { open } from '../utilsBundle';
import path from 'path'; import path from 'path';
import type { TransformCallback } from 'stream'; import type { TransformCallback } from 'stream';
import { Transform } from 'stream'; import { Transform } from 'stream';

View file

@ -14,7 +14,7 @@
* limitations under the License. * 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 type { Page } from 'playwright-core/lib/server/page';
import { isUnderTest, ManualPromise } from 'playwright-core/lib/utils'; import { isUnderTest, ManualPromise } from 'playwright-core/lib/utils';
import type { FullResult } from '../../reporter'; import type { FullResult } from '../../reporter';
@ -26,7 +26,7 @@ import { createReporters } from './reporters';
import { TestRun, createTaskRunnerForList, createTaskRunnerForWatch, createTaskRunnerForWatchSetup } from './tasks'; import { TestRun, createTaskRunnerForList, createTaskRunnerForWatch, createTaskRunnerForWatchSetup } from './tasks';
import { chokidar } from '../utilsBundle'; import { chokidar } from '../utilsBundle';
import type { FSWatcher } from 'chokidar'; import type { FSWatcher } from 'chokidar';
import { open } from '../utilsBundle'; import { open } from 'playwright-core/lib/utilsBundle';
import ListReporter from '../reporters/list'; import ListReporter from '../reporters/list';
class UIMode { class UIMode {
@ -82,7 +82,7 @@ class UIMode {
} }
async showUI() { 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) { if (!process.env.PWTEST_DEBUG) {
process.stdout.write = (chunk: string | Buffer) => { process.stdout.write = (chunk: string | Buffer) => {
this._dispatchEvent({ method: 'stdio', params: chunkToPayload('stdout', chunk) }); this._dispatchEvent({ method: 'stdio', params: chunkToPayload('stdout', chunk) });

View file

@ -15,7 +15,6 @@
*/ */
export const json5: typeof import('../bundles/utils/node_modules/json5/lib') = require('./utilsBundleImpl').json5; 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 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 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; export const stoppable: typeof import('../bundles/utils/node_modules/@types/stoppable') = require('./utilsBundleImpl').stoppable;

View file

@ -16,7 +16,7 @@
import type { Fixtures, FrameLocator, Locator, Page, Browser, BrowserContext } from '@playwright/test'; import type { Fixtures, FrameLocator, Locator, Page, Browser, BrowserContext } from '@playwright/test';
import { step } from './baseTest'; import { step } from './baseTest';
import { showTraceViewer } from '../../packages/playwright-core/lib/server'; import { openTraceViewerApp } from '../../packages/playwright-core/lib/server';
type BaseTestFixtures = { type BaseTestFixtures = {
context: BrowserContext; context: BrowserContext;
@ -111,7 +111,7 @@ export const traceViewerFixtures: Fixtures<TraceViewerFixtures, {}, BaseTestFixt
const browsers: Browser[] = []; const browsers: Browser[] = [];
const contextImpls: any[] = []; const contextImpls: any[] = [];
await use(async (traces: string[], { host, port } = {}) => { 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 contextImpl = pageImpl.context();
const browser = await playwright.chromium.connectOverCDP(contextImpl._browser.options.wsEndpoint); const browser = await playwright.chromium.connectOverCDP(contextImpl._browser.options.wsEndpoint);
browsers.push(browser); browsers.push(browser);