mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(html): allow serving html report w/ traces off relative path (#9668)
Fixes #9652
This commit is contained in:
parent
962525b592
commit
f853176df3
@ -188,7 +188,7 @@ const TestResultView: React.FC<{
|
||||
|
||||
{!!traces.length && <Chip header='Traces'>
|
||||
{traces.map((a, i) => <div key={`trace-${i}`}>
|
||||
<a href={`trace/index.html?trace=${window.location.origin}/` + a.path}>
|
||||
<a href={`trace/index.html?trace=${new URL(a.path!, window.location.href)}`}>
|
||||
<img src='trace.png' style={{ width: 192, height: 117, marginLeft: 20 }} />
|
||||
</a>
|
||||
</div>)}
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="icon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="icon-16x16.png">
|
||||
<link rel="manifest" href="manifest.webmanifest">
|
||||
<title>Playwright Trace Viewer</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -23,9 +23,7 @@ import '../common.css';
|
||||
|
||||
(async () => {
|
||||
applyTheme();
|
||||
navigator.serviceWorker.register('/trace/sw.bundle.js', {
|
||||
scope: '/trace/'
|
||||
});
|
||||
navigator.serviceWorker.register('sw.bundle.js');
|
||||
if (!navigator.serviceWorker.controller) {
|
||||
await new Promise<void>(f => {
|
||||
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||
|
||||
@ -2,28 +2,27 @@
|
||||
"theme_color": "#000",
|
||||
"background_color": "#fff",
|
||||
"display": "browser",
|
||||
"scope": "/trace",
|
||||
"start_url": "/trace/index.html",
|
||||
"start_url": "index.html",
|
||||
"name": "Playwright Trace Viewer",
|
||||
"short_name": "Trace Viewer",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/trace/icon-192x192.png",
|
||||
"src": "icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/trace/icon-256x256.png",
|
||||
"src": "icon-256x256.png",
|
||||
"sizes": "256x256",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/trace/icon-384x384.png",
|
||||
"src": "icon-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/trace/icon-512x512.png",
|
||||
"src": "icon-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ export const Workbench: React.FunctionComponent<{
|
||||
React.useEffect(() => {
|
||||
(async () => {
|
||||
if (traceURL) {
|
||||
const contextEntry = (await fetch(`/trace/context?trace=${traceURL}`).then(response => response.json())) as ContextEntry;
|
||||
const contextEntry = (await fetch(`context?trace=${traceURL}`).then(response => response.json())) as ContextEntry;
|
||||
modelUtil.indexModel(contextEntry);
|
||||
setContextEntry(contextEntry);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user