mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(trace): add web manifest (#9482)
This commit is contained in:
parent
9135847950
commit
811d02dbe8
@ -37,7 +37,7 @@ export async function showTraceViewer(traceUrl: string, browserName: string, hea
|
|||||||
});
|
});
|
||||||
|
|
||||||
server.routePrefix('/', (request, response) => {
|
server.routePrefix('/', (request, response) => {
|
||||||
const relativePath = new URL('http://localhost' + request.url!).pathname;
|
const relativePath = new URL('http://localhost' + request.url!).pathname.slice('/trace'.length);
|
||||||
const absolutePath = path.join(__dirname, '..', '..', '..', 'webpack', 'traceViewer', ...relativePath.split('/'));
|
const absolutePath = path.join(__dirname, '..', '..', '..', 'webpack', 'traceViewer', ...relativePath.split('/'));
|
||||||
return server.serveFile(response, absolutePath);
|
return server.serveFile(response, absolutePath);
|
||||||
});
|
});
|
||||||
@ -77,6 +77,6 @@ export async function showTraceViewer(traceUrl: string, browserName: string, hea
|
|||||||
else
|
else
|
||||||
page.on('close', () => process.exit());
|
page.on('close', () => process.exit());
|
||||||
|
|
||||||
await page.mainFrame().goto(internalCallMetadata(), urlPrefix + `/index.html?trace=${traceUrl}`);
|
await page.mainFrame().goto(internalCallMetadata(), urlPrefix + `/trace/index.html?trace=${traceUrl}`);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/trace/icon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/trace/icon-16x16.png">
|
||||||
|
<link rel="manifest" href="/trace/manifest.webmanifest">
|
||||||
<title>Playwright Trace Viewer</title>
|
<title>Playwright Trace Viewer</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -23,7 +23,9 @@ import '../common.css';
|
|||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
applyTheme();
|
applyTheme();
|
||||||
navigator.serviceWorker.register('sw.bundle.js');
|
navigator.serviceWorker.register('/trace/sw.bundle.js', {
|
||||||
|
scope: '/trace/'
|
||||||
|
});
|
||||||
if (!navigator.serviceWorker.controller) {
|
if (!navigator.serviceWorker.controller) {
|
||||||
await new Promise<void>(f => {
|
await new Promise<void>(f => {
|
||||||
navigator.serviceWorker.oncontrollerchange = () => f();
|
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||||
|
@ -185,7 +185,8 @@ function snapshotScript() {
|
|||||||
iframe.setAttribute('src', 'data:text/html,<body style="background: #ddd"></body>');
|
iframe.setAttribute('src', 'data:text/html,<body style="background: #ddd"></body>');
|
||||||
} else {
|
} else {
|
||||||
// Append query parameters to inherit ?name= or ?time= values from parent.
|
// Append query parameters to inherit ?name= or ?time= values from parent.
|
||||||
iframe.setAttribute('src', new URL(src + window.location.search, window.location.href).toString());
|
const url = new URL('/trace' + src + window.location.search, window.location.href).toString();
|
||||||
|
iframe.setAttribute('src', url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 593 B |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"theme_color": "#000",
|
||||||
|
"background_color": "#fff",
|
||||||
|
"display": "browser",
|
||||||
|
"scope": "/trace",
|
||||||
|
"start_url": "/trace/index.html",
|
||||||
|
"name": "Playwright Trace Viewer",
|
||||||
|
"short_name": "Trace Viewer",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/trace/icon-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/trace/icon-256x256.png",
|
||||||
|
"sizes": "256x256",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/trace/icon-384x384.png",
|
||||||
|
"sizes": "384x384",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/trace/icon-512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -40,7 +40,7 @@ export const Workbench: React.FunctionComponent<{
|
|||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
if (traceURL) {
|
if (traceURL) {
|
||||||
const contextEntry = (await fetch(`context?trace=${traceURL}`).then(response => response.json())) as ContextEntry;
|
const contextEntry = (await fetch(`/trace/context?trace=${traceURL}`).then(response => response.json())) as ContextEntry;
|
||||||
modelUtil.indexModel(contextEntry);
|
modelUtil.indexModel(contextEntry);
|
||||||
setContextEntry(contextEntry);
|
setContextEntry(contextEntry);
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,6 +45,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, 'static'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
new HtmlWebPackPlugin({
|
new HtmlWebPackPlugin({
|
||||||
title: 'Playwright Trace Viewer',
|
title: 'Playwright Trace Viewer',
|
||||||
template: path.join(__dirname, 'index.html'),
|
template: path.join(__dirname, 'index.html'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user