@checkly/playwright-core 1.42.13 → 1.42.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/generated/consoleApiSource.js +1 -2
- package/lib/generated/injectedScriptSource.js +1 -2
- package/lib/generated/recorderSource.js +1 -2
- package/lib/generated/utilityScriptSource.js +1 -2
- package/lib/vite/recorder/assets/codeMirrorModule-Hs9-1ZG4.css +1 -0
- package/lib/vite/{traceViewer/assets/codeMirrorModule-75b0ca4f.js → recorder/assets/codeMirrorModule-I9ks4y7D.js} +14 -14
- package/lib/vite/recorder/assets/index-ljsTwXtJ.css +1 -0
- package/lib/vite/recorder/assets/index-yg8ypzl6.js +47 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/{codeMirrorModule-c1454a2e.js → codeMirrorModule-Vg1kIqMp.js} +10 -10
- package/lib/vite/traceViewer/assets/{codeMirrorModule-e5a15eec.js → codeMirrorModule-wLpsbIhd.js} +13 -13
- package/lib/vite/traceViewer/assets/wsPort-RIoVGhlT.js +69 -0
- package/lib/vite/traceViewer/assets/wsPort-f2dAQL4I.js +69 -0
- package/lib/vite/traceViewer/index.-_8-eHEE.js +2 -0
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/index.qOFdH9Ja.js +2 -0
- package/lib/vite/traceViewer/sw.bundle.js +4 -7403
- package/lib/vite/traceViewer/uiMode.9CwNsWc6.js +10 -0
- package/lib/vite/traceViewer/uiMode.html +4 -4
- package/lib/vite/traceViewer/uiMode.iNIhieBM.js +10 -0
- package/package.json +1 -1
- package/lib/checkly/sWatcher.js +0 -150
- package/lib/cli/cli.js +0 -62
- package/lib/common/debugLogger.js +0 -91
- package/lib/vite/recorder/assets/codeMirrorModule-XkYKvQWL.js +0 -15585
- package/lib/vite/recorder/assets/codeMirrorModule-svF_VrcJ.css +0 -344
- package/lib/vite/recorder/assets/index-Sgxgm22s.css +0 -2455
- package/lib/vite/recorder/assets/index-g7JXfYxX.js +0 -10429
- package/lib/vite/traceViewer/assets/codeMirrorModule-5nkjDDU_.js +0 -15578
- package/lib/vite/traceViewer/assets/codeMirrorModule-RVP_AMUu.js +0 -15585
- package/lib/vite/traceViewer/assets/codeMirrorModule-cc2329e4.js +0 -15593
- package/lib/vite/traceViewer/assets/codeMirrorModule-d725feea.js +0 -15586
- package/lib/vite/traceViewer/assets/codeMirrorModule-kT-uS7F4.js +0 -15592
- package/lib/vite/traceViewer/assets/codeMirrorModule-rcsC5no8.js +0 -15592
- package/lib/vite/traceViewer/assets/codeMirrorModule-ytMY1awF.js +0 -15585
- package/lib/vite/traceViewer/assets/wsPort-1-6TL4lc.js +0 -18540
- package/lib/vite/traceViewer/assets/wsPort-54626118.js +0 -18361
- package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-KEbz4l8i.js +0 -18540
- package/lib/vite/traceViewer/assets/wsPort-a88a6a12.js +0 -18361
- package/lib/vite/traceViewer/assets/wsPort-cb764cde.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-lTlmZhJd.js +0 -18564
- package/lib/vite/traceViewer/assets/wsPort-xpIMLVfx.js +0 -18540
- package/lib/vite/traceViewer/assets/wsPort-yM58htfg.js +0 -18360
- package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +0 -9
- package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +0 -6410
- package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +0 -1
- package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +0 -344
- package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
- package/lib/vite/traceViewer/index.1a1fe659.css +0 -1
- package/lib/vite/traceViewer/index.4a8ee36e.js +0 -2
- package/lib/vite/traceViewer/index.55e65778.js +0 -181
- package/lib/vite/traceViewer/index.742fd3e5.js +0 -181
- package/lib/vite/traceViewer/index.76e9f312.css +0 -124
- package/lib/vite/traceViewer/index.UNF4A0jZ.js +0 -180
- package/lib/vite/traceViewer/index.ZUjC4zt1.js +0 -180
- package/lib/vite/traceViewer/index.a265fbdb.js +0 -2
- package/lib/vite/traceViewer/index.decad628.js +0 -2
- package/lib/vite/traceViewer/index.ici1bqta.js +0 -180
- package/lib/vite/traceViewer/index.mxOcKqpu.js +0 -180
- package/lib/vite/traceViewer/index.zXVxM5ps.js +0 -180
- package/lib/vite/traceViewer/uiMode.08ab2d90.js +0 -4
- package/lib/vite/traceViewer/uiMode.0d0d667b.js +0 -4
- package/lib/vite/traceViewer/uiMode.216233d5.js +0 -1484
- package/lib/vite/traceViewer/uiMode.2c31018f.css +0 -1324
- package/lib/vite/traceViewer/uiMode.468b0309.js +0 -4
- package/lib/vite/traceViewer/uiMode.67C8Ij-c.js +0 -1490
- package/lib/vite/traceViewer/uiMode.8b41a49d.css +0 -1
- package/lib/vite/traceViewer/uiMode.F_k6a2aC.js +0 -1488
- package/lib/vite/traceViewer/uiMode.NjZAwD_B.js +0 -1485
- package/lib/vite/traceViewer/uiMode.YQRCZjm8.js +0 -1485
- package/lib/vite/traceViewer/uiMode.b2068d00.js +0 -1484
- package/lib/vite/traceViewer/uiMode.fEEgOxJh.js +0 -1490
- package/lib/vite/traceViewer/uiMode.kvEeWpo2.js +0 -1490
- package/lib/vite/traceViewer/uiMode.ljHA9Ynz.js +0 -1490
- package/lib/vite/traceViewer/uiMode.ybQP_6Xr.js +0 -10
- package/lib/vite/traceViewer/wsPort.997c92cf.css +0 -3513
- package/lib/vite/traceViewer/wsPort.9c9a6767.css +0 -1
- package/lib/vite/traceViewer/wsPort.Oa05jfrO.css +0 -3513
- package/lib/vite/traceViewer/xtermModule.125f4259.css +0 -191
- package/lib/vite/traceViewer/xtermModule.6428296b.css +0 -32
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { M as MultiTraceModel, r as reactExports, c as connect, j as jsxs, a as jsx, T as ToolbarButton, t as toggleTheme, W as Workbench, b as applyTheme, d as reactDomExports } from "./assets/wsPort-a88a6a12.js";
|
|
2
|
-
const workbenchLoader = "";
|
|
3
|
-
const WorkbenchLoader = () => {
|
|
4
|
-
const [isServer, setIsServer] = reactExports.useState(false);
|
|
5
|
-
const [traceURLs, setTraceURLs] = reactExports.useState([]);
|
|
6
|
-
const [uploadedTraceNames, setUploadedTraceNames] = reactExports.useState([]);
|
|
7
|
-
const [model, setModel] = reactExports.useState(emptyModel);
|
|
8
|
-
const [progress, setProgress] = reactExports.useState({ done: 0, total: 0 });
|
|
9
|
-
const [dragOver, setDragOver] = reactExports.useState(false);
|
|
10
|
-
const [processingErrorMessage, setProcessingErrorMessage] = reactExports.useState(null);
|
|
11
|
-
const [fileForLocalModeError, setFileForLocalModeError] = reactExports.useState(null);
|
|
12
|
-
const processTraceFiles = reactExports.useCallback((files) => {
|
|
13
|
-
const blobUrls = [];
|
|
14
|
-
const fileNames = [];
|
|
15
|
-
const url = new URL(window.location.href);
|
|
16
|
-
for (let i = 0; i < files.length; i++) {
|
|
17
|
-
const file = files.item(i);
|
|
18
|
-
if (!file)
|
|
19
|
-
continue;
|
|
20
|
-
const blobTraceURL = URL.createObjectURL(file);
|
|
21
|
-
blobUrls.push(blobTraceURL);
|
|
22
|
-
fileNames.push(file.name);
|
|
23
|
-
url.searchParams.append("trace", blobTraceURL);
|
|
24
|
-
url.searchParams.append("traceFileName", file.name);
|
|
25
|
-
}
|
|
26
|
-
const href = url.toString();
|
|
27
|
-
window.history.pushState({}, "", href);
|
|
28
|
-
setTraceURLs(blobUrls);
|
|
29
|
-
setUploadedTraceNames(fileNames);
|
|
30
|
-
setDragOver(false);
|
|
31
|
-
setProcessingErrorMessage(null);
|
|
32
|
-
}, []);
|
|
33
|
-
const handleDropEvent = reactExports.useCallback((event) => {
|
|
34
|
-
event.preventDefault();
|
|
35
|
-
processTraceFiles(event.dataTransfer.files);
|
|
36
|
-
}, [processTraceFiles]);
|
|
37
|
-
const handleFileInputChange = reactExports.useCallback((event) => {
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
if (!event.target.files)
|
|
40
|
-
return;
|
|
41
|
-
processTraceFiles(event.target.files);
|
|
42
|
-
}, [processTraceFiles]);
|
|
43
|
-
reactExports.useEffect(() => {
|
|
44
|
-
const params = new URL(window.location.href).searchParams;
|
|
45
|
-
const newTraceURLs = params.getAll("trace");
|
|
46
|
-
setIsServer(params.has("isServer"));
|
|
47
|
-
for (const url of newTraceURLs) {
|
|
48
|
-
if (url.startsWith("file:")) {
|
|
49
|
-
setFileForLocalModeError(url || null);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (params.has("isServer")) {
|
|
54
|
-
connect({
|
|
55
|
-
onEvent(method, params2) {
|
|
56
|
-
if (method === "loadTrace") {
|
|
57
|
-
setTraceURLs(params2.url ? [params2.url] : []);
|
|
58
|
-
setDragOver(false);
|
|
59
|
-
setProcessingErrorMessage(null);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
onClose() {
|
|
63
|
-
}
|
|
64
|
-
}).then((sendMessage) => {
|
|
65
|
-
sendMessage("ready");
|
|
66
|
-
});
|
|
67
|
-
} else if (!newTraceURLs.some((url) => url.startsWith("blob:"))) {
|
|
68
|
-
setTraceURLs(newTraceURLs);
|
|
69
|
-
}
|
|
70
|
-
}, []);
|
|
71
|
-
reactExports.useEffect(() => {
|
|
72
|
-
(async () => {
|
|
73
|
-
if (traceURLs.length) {
|
|
74
|
-
const swListener = (event) => {
|
|
75
|
-
if (event.data.method === "progress")
|
|
76
|
-
setProgress(event.data.params);
|
|
77
|
-
};
|
|
78
|
-
navigator.serviceWorker.addEventListener("message", swListener);
|
|
79
|
-
setProgress({ done: 0, total: 1 });
|
|
80
|
-
const contextEntries = [];
|
|
81
|
-
for (let i = 0; i < traceURLs.length; i++) {
|
|
82
|
-
const url = traceURLs[i];
|
|
83
|
-
const params = new URLSearchParams();
|
|
84
|
-
params.set("trace", url);
|
|
85
|
-
if (uploadedTraceNames.length)
|
|
86
|
-
params.set("traceFileName", uploadedTraceNames[i]);
|
|
87
|
-
const response = await fetch(`contexts?${params.toString()}`);
|
|
88
|
-
if (!response.ok) {
|
|
89
|
-
if (!isServer)
|
|
90
|
-
setTraceURLs([]);
|
|
91
|
-
setProcessingErrorMessage((await response.json()).error);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
contextEntries.push(...await response.json());
|
|
95
|
-
}
|
|
96
|
-
navigator.serviceWorker.removeEventListener("message", swListener);
|
|
97
|
-
const model2 = new MultiTraceModel(contextEntries);
|
|
98
|
-
setProgress({ done: 0, total: 0 });
|
|
99
|
-
setModel(model2);
|
|
100
|
-
} else {
|
|
101
|
-
setModel(emptyModel);
|
|
102
|
-
}
|
|
103
|
-
})();
|
|
104
|
-
}, [isServer, traceURLs, uploadedTraceNames]);
|
|
105
|
-
return /* @__PURE__ */ jsxs("div", { className: "vbox workbench-loader", onDragOver: (event) => {
|
|
106
|
-
event.preventDefault();
|
|
107
|
-
setDragOver(true);
|
|
108
|
-
}, children: [
|
|
109
|
-
/* @__PURE__ */ jsxs("div", { className: "hbox header", children: [
|
|
110
|
-
/* @__PURE__ */ jsx("div", { className: "logo", children: /* @__PURE__ */ jsx("img", { src: "playwright-logo.svg", alt: "Playwright logo" }) }),
|
|
111
|
-
/* @__PURE__ */ jsx("div", { className: "product", children: "Playwright" }),
|
|
112
|
-
model.title && /* @__PURE__ */ jsx("div", { className: "title", children: model.title }),
|
|
113
|
-
/* @__PURE__ */ jsx("div", { className: "spacer" }),
|
|
114
|
-
/* @__PURE__ */ jsx(ToolbarButton, { icon: "color-mode", title: "Toggle color mode", toggled: false, onClick: () => toggleTheme() })
|
|
115
|
-
] }),
|
|
116
|
-
/* @__PURE__ */ jsx("div", { className: "progress", children: /* @__PURE__ */ jsx("div", { className: "inner-progress", style: { width: progress.total ? 100 * progress.done / progress.total + "%" : 0 } }) }),
|
|
117
|
-
/* @__PURE__ */ jsx(Workbench, { model }),
|
|
118
|
-
fileForLocalModeError && /* @__PURE__ */ jsxs("div", { className: "drop-target", children: [
|
|
119
|
-
/* @__PURE__ */ jsx("div", { children: "Trace Viewer uses Service Workers to show traces. To view trace:" }),
|
|
120
|
-
/* @__PURE__ */ jsxs("div", { style: { paddingTop: 20 }, children: [
|
|
121
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
122
|
-
"1. Click ",
|
|
123
|
-
/* @__PURE__ */ jsx("a", { href: fileForLocalModeError, children: "here" }),
|
|
124
|
-
" to put your trace into the download shelf"
|
|
125
|
-
] }),
|
|
126
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
127
|
-
"2. Go to ",
|
|
128
|
-
/* @__PURE__ */ jsx("a", { href: "https://trace.playwright.dev", children: "trace.playwright.dev" })
|
|
129
|
-
] }),
|
|
130
|
-
/* @__PURE__ */ jsx("div", { children: "3. Drop the trace from the download shelf into the page" })
|
|
131
|
-
] })
|
|
132
|
-
] }),
|
|
133
|
-
!isServer && !dragOver && !fileForLocalModeError && (!traceURLs.length || processingErrorMessage) && /* @__PURE__ */ jsxs("div", { className: "drop-target", children: [
|
|
134
|
-
/* @__PURE__ */ jsx("div", { className: "processing-error", children: processingErrorMessage }),
|
|
135
|
-
/* @__PURE__ */ jsx("div", { className: "title", children: "Drop Playwright Trace to load" }),
|
|
136
|
-
/* @__PURE__ */ jsx("div", { children: "or" }),
|
|
137
|
-
/* @__PURE__ */ jsx("button", { onClick: () => {
|
|
138
|
-
const input = document.createElement("input");
|
|
139
|
-
input.type = "file";
|
|
140
|
-
input.multiple = true;
|
|
141
|
-
input.click();
|
|
142
|
-
input.addEventListener("change", (e) => handleFileInputChange(e));
|
|
143
|
-
}, children: "Select file(s)" }),
|
|
144
|
-
/* @__PURE__ */ jsx("div", { style: { maxWidth: 400 }, children: "Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally." })
|
|
145
|
-
] }),
|
|
146
|
-
isServer && !traceURLs.length && /* @__PURE__ */ jsx("div", { className: "drop-target", children: /* @__PURE__ */ jsx("div", { className: "title", children: "Select test to see the trace" }) }),
|
|
147
|
-
dragOver && /* @__PURE__ */ jsx(
|
|
148
|
-
"div",
|
|
149
|
-
{
|
|
150
|
-
className: "drop-target",
|
|
151
|
-
onDragLeave: () => {
|
|
152
|
-
setDragOver(false);
|
|
153
|
-
},
|
|
154
|
-
onDrop: (event) => handleDropEvent(event),
|
|
155
|
-
children: /* @__PURE__ */ jsx("div", { className: "title", children: "Release to analyse the Playwright Trace" })
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
] });
|
|
159
|
-
};
|
|
160
|
-
const emptyModel = new MultiTraceModel([]);
|
|
161
|
-
(async () => {
|
|
162
|
-
applyTheme();
|
|
163
|
-
if (window.location.protocol !== "file:") {
|
|
164
|
-
if (window.location.href.includes("isUnderTest=true"))
|
|
165
|
-
await new Promise((f) => setTimeout(f, 1e3));
|
|
166
|
-
if (!navigator.serviceWorker)
|
|
167
|
-
throw new Error(`Service workers are not supported.
|
|
168
|
-
Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
|
169
|
-
navigator.serviceWorker.register("sw.bundle.js");
|
|
170
|
-
if (!navigator.serviceWorker.controller) {
|
|
171
|
-
await new Promise((f) => {
|
|
172
|
-
navigator.serviceWorker.oncontrollerchange = () => f();
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
setInterval(function() {
|
|
176
|
-
fetch("ping");
|
|
177
|
-
}, 1e4);
|
|
178
|
-
}
|
|
179
|
-
reactDomExports.render(/* @__PURE__ */ jsx(WorkbenchLoader, {}), document.querySelector("#root"));
|
|
180
|
-
})();
|
|
181
|
-
//# sourceMappingURL=index.742fd3e5.js.map
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
.drop-target {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
flex: auto;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
background-color: var(--vscode-editor-background);
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 0;
|
|
26
|
-
right: 0;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
left: 0;
|
|
29
|
-
z-index: 100;
|
|
30
|
-
line-height: 24px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
body .drop-target {
|
|
34
|
-
background: rgba(255, 255, 255, 0.8);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
body.dark-mode .drop-target {
|
|
38
|
-
background: rgba(0, 0, 0, 0.8);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.drop-target .title {
|
|
42
|
-
font-size: 24px;
|
|
43
|
-
font-weight: bold;
|
|
44
|
-
margin-bottom: 30px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.drop-target .processing-error {
|
|
48
|
-
font-size: 24px;
|
|
49
|
-
color: #e74c3c;
|
|
50
|
-
font-weight: bold;
|
|
51
|
-
text-align: center;
|
|
52
|
-
margin: 30px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.drop-target input {
|
|
56
|
-
margin-top: 50px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.drop-target button {
|
|
60
|
-
color: rgb(255, 255, 255);
|
|
61
|
-
background-color: rgb(0, 122, 204);
|
|
62
|
-
padding: 8px 12px;
|
|
63
|
-
border: none;
|
|
64
|
-
margin: 30px 0;
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.progress {
|
|
69
|
-
flex: none;
|
|
70
|
-
width: 100%;
|
|
71
|
-
height: 3px;
|
|
72
|
-
margin-top: -3px;
|
|
73
|
-
z-index: 10;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.inner-progress {
|
|
77
|
-
background-color: var(--vscode-progressBar-background);
|
|
78
|
-
height: 100%;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.header {
|
|
82
|
-
display: flex;
|
|
83
|
-
background-color: #000;
|
|
84
|
-
flex: none;
|
|
85
|
-
flex-basis: 48px;
|
|
86
|
-
line-height: 48px;
|
|
87
|
-
font-size: 16px;
|
|
88
|
-
color: #cccccc;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.workbench-loader {
|
|
92
|
-
contain: size;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.workbench-loader .header .toolbar-button {
|
|
96
|
-
margin: 12px;
|
|
97
|
-
padding: 8px 4px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.workbench-loader .logo {
|
|
101
|
-
margin-left: 16px;
|
|
102
|
-
display: flex;
|
|
103
|
-
align-items: center;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.workbench-loader .logo img {
|
|
107
|
-
height: 32px;
|
|
108
|
-
width: 32px;
|
|
109
|
-
pointer-events: none;
|
|
110
|
-
flex: none;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.workbench-loader .product {
|
|
114
|
-
font-weight: 600;
|
|
115
|
-
margin-left: 16px;
|
|
116
|
-
flex: none;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.workbench-loader .header .title {
|
|
120
|
-
margin-left: 16px;
|
|
121
|
-
overflow: hidden;
|
|
122
|
-
text-overflow: ellipsis;
|
|
123
|
-
text-wrap: nowrap;
|
|
124
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { M as MultiTraceModel, r as reactExports, c as connect, j as jsxRuntimeExports, T as ToolbarButton, t as toggleTheme, W as Workbench, a as applyTheme, b as reactDomExports } from "./assets/wsPort-1-6TL4lc.js";
|
|
2
|
-
const WorkbenchLoader = () => {
|
|
3
|
-
const [isServer, setIsServer] = reactExports.useState(false);
|
|
4
|
-
const [traceURLs, setTraceURLs] = reactExports.useState([]);
|
|
5
|
-
const [uploadedTraceNames, setUploadedTraceNames] = reactExports.useState([]);
|
|
6
|
-
const [model, setModel] = reactExports.useState(emptyModel);
|
|
7
|
-
const [progress, setProgress] = reactExports.useState({ done: 0, total: 0 });
|
|
8
|
-
const [dragOver, setDragOver] = reactExports.useState(false);
|
|
9
|
-
const [processingErrorMessage, setProcessingErrorMessage] = reactExports.useState(null);
|
|
10
|
-
const [fileForLocalModeError, setFileForLocalModeError] = reactExports.useState(null);
|
|
11
|
-
const processTraceFiles = reactExports.useCallback((files) => {
|
|
12
|
-
const blobUrls = [];
|
|
13
|
-
const fileNames = [];
|
|
14
|
-
const url = new URL(window.location.href);
|
|
15
|
-
for (let i = 0; i < files.length; i++) {
|
|
16
|
-
const file = files.item(i);
|
|
17
|
-
if (!file)
|
|
18
|
-
continue;
|
|
19
|
-
const blobTraceURL = URL.createObjectURL(file);
|
|
20
|
-
blobUrls.push(blobTraceURL);
|
|
21
|
-
fileNames.push(file.name);
|
|
22
|
-
url.searchParams.append("trace", blobTraceURL);
|
|
23
|
-
url.searchParams.append("traceFileName", file.name);
|
|
24
|
-
}
|
|
25
|
-
const href = url.toString();
|
|
26
|
-
window.history.pushState({}, "", href);
|
|
27
|
-
setTraceURLs(blobUrls);
|
|
28
|
-
setUploadedTraceNames(fileNames);
|
|
29
|
-
setDragOver(false);
|
|
30
|
-
setProcessingErrorMessage(null);
|
|
31
|
-
}, []);
|
|
32
|
-
const handleDropEvent = reactExports.useCallback((event) => {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
processTraceFiles(event.dataTransfer.files);
|
|
35
|
-
}, [processTraceFiles]);
|
|
36
|
-
const handleFileInputChange = reactExports.useCallback((event) => {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
if (!event.target.files)
|
|
39
|
-
return;
|
|
40
|
-
processTraceFiles(event.target.files);
|
|
41
|
-
}, [processTraceFiles]);
|
|
42
|
-
reactExports.useEffect(() => {
|
|
43
|
-
const params = new URL(window.location.href).searchParams;
|
|
44
|
-
const newTraceURLs = params.getAll("trace");
|
|
45
|
-
setIsServer(params.has("isServer"));
|
|
46
|
-
for (const url of newTraceURLs) {
|
|
47
|
-
if (url.startsWith("file:")) {
|
|
48
|
-
setFileForLocalModeError(url || null);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (params.has("isServer")) {
|
|
53
|
-
connect({
|
|
54
|
-
onEvent(method, params2) {
|
|
55
|
-
if (method === "loadTrace") {
|
|
56
|
-
setTraceURLs(params2.url ? [params2.url] : []);
|
|
57
|
-
setDragOver(false);
|
|
58
|
-
setProcessingErrorMessage(null);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
onClose() {
|
|
62
|
-
}
|
|
63
|
-
}).then((sendMessage) => {
|
|
64
|
-
sendMessage("ready");
|
|
65
|
-
});
|
|
66
|
-
} else if (!newTraceURLs.some((url) => url.startsWith("blob:"))) {
|
|
67
|
-
setTraceURLs(newTraceURLs);
|
|
68
|
-
}
|
|
69
|
-
}, []);
|
|
70
|
-
reactExports.useEffect(() => {
|
|
71
|
-
(async () => {
|
|
72
|
-
if (traceURLs.length) {
|
|
73
|
-
const swListener = (event) => {
|
|
74
|
-
if (event.data.method === "progress")
|
|
75
|
-
setProgress(event.data.params);
|
|
76
|
-
};
|
|
77
|
-
navigator.serviceWorker.addEventListener("message", swListener);
|
|
78
|
-
setProgress({ done: 0, total: 1 });
|
|
79
|
-
const contextEntries = [];
|
|
80
|
-
for (let i = 0; i < traceURLs.length; i++) {
|
|
81
|
-
const url = traceURLs[i];
|
|
82
|
-
const params = new URLSearchParams();
|
|
83
|
-
params.set("trace", url);
|
|
84
|
-
if (uploadedTraceNames.length)
|
|
85
|
-
params.set("traceFileName", uploadedTraceNames[i]);
|
|
86
|
-
const response = await fetch(`contexts?${params.toString()}`);
|
|
87
|
-
if (!response.ok) {
|
|
88
|
-
if (!isServer)
|
|
89
|
-
setTraceURLs([]);
|
|
90
|
-
setProcessingErrorMessage((await response.json()).error);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
contextEntries.push(...await response.json());
|
|
94
|
-
}
|
|
95
|
-
navigator.serviceWorker.removeEventListener("message", swListener);
|
|
96
|
-
const model2 = new MultiTraceModel(contextEntries);
|
|
97
|
-
setProgress({ done: 0, total: 0 });
|
|
98
|
-
setModel(model2);
|
|
99
|
-
} else {
|
|
100
|
-
setModel(emptyModel);
|
|
101
|
-
}
|
|
102
|
-
})();
|
|
103
|
-
}, [isServer, traceURLs, uploadedTraceNames]);
|
|
104
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vbox workbench-loader", onDragOver: (event) => {
|
|
105
|
-
event.preventDefault();
|
|
106
|
-
setDragOver(true);
|
|
107
|
-
}, children: [
|
|
108
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hbox header", children: [
|
|
109
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "logo", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: "playwright-logo.svg", alt: "Playwright logo" }) }),
|
|
110
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "product", children: "Playwright" }),
|
|
111
|
-
model.title && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: model.title }),
|
|
112
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spacer" }),
|
|
113
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "color-mode", title: "Toggle color mode", toggled: false, onClick: () => toggleTheme() })
|
|
114
|
-
] }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "progress", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "inner-progress", style: { width: progress.total ? 100 * progress.done / progress.total + "%" : 0 } }) }),
|
|
116
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Workbench, { model }),
|
|
117
|
-
fileForLocalModeError && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "drop-target", children: [
|
|
118
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Trace Viewer uses Service Workers to show traces. To view trace:" }),
|
|
119
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { paddingTop: 20 }, children: [
|
|
120
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
121
|
-
"1. Click ",
|
|
122
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: fileForLocalModeError, children: "here" }),
|
|
123
|
-
" to put your trace into the download shelf"
|
|
124
|
-
] }),
|
|
125
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
126
|
-
"2. Go to ",
|
|
127
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://trace.playwright.dev", children: "trace.playwright.dev" })
|
|
128
|
-
] }),
|
|
129
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "3. Drop the trace from the download shelf into the page" })
|
|
130
|
-
] })
|
|
131
|
-
] }),
|
|
132
|
-
!isServer && !dragOver && !fileForLocalModeError && (!traceURLs.length || processingErrorMessage) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "drop-target", children: [
|
|
133
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "processing-error", children: processingErrorMessage }),
|
|
134
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: "Drop Playwright Trace to load" }),
|
|
135
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "or" }),
|
|
136
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: () => {
|
|
137
|
-
const input = document.createElement("input");
|
|
138
|
-
input.type = "file";
|
|
139
|
-
input.multiple = true;
|
|
140
|
-
input.click();
|
|
141
|
-
input.addEventListener("change", (e) => handleFileInputChange(e));
|
|
142
|
-
}, children: "Select file(s)" }),
|
|
143
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { maxWidth: 400 }, children: "Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally." })
|
|
144
|
-
] }),
|
|
145
|
-
isServer && !traceURLs.length && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "drop-target", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: "Select test to see the trace" }) }),
|
|
146
|
-
dragOver && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147
|
-
"div",
|
|
148
|
-
{
|
|
149
|
-
className: "drop-target",
|
|
150
|
-
onDragLeave: () => {
|
|
151
|
-
setDragOver(false);
|
|
152
|
-
},
|
|
153
|
-
onDrop: (event) => handleDropEvent(event),
|
|
154
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: "Release to analyse the Playwright Trace" })
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] });
|
|
158
|
-
};
|
|
159
|
-
const emptyModel = new MultiTraceModel([]);
|
|
160
|
-
(async () => {
|
|
161
|
-
applyTheme();
|
|
162
|
-
if (window.location.protocol !== "file:") {
|
|
163
|
-
if (window.location.href.includes("isUnderTest=true"))
|
|
164
|
-
await new Promise((f) => setTimeout(f, 1e3));
|
|
165
|
-
if (!navigator.serviceWorker)
|
|
166
|
-
throw new Error(`Service workers are not supported.
|
|
167
|
-
Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
|
168
|
-
navigator.serviceWorker.register("sw.bundle.js");
|
|
169
|
-
if (!navigator.serviceWorker.controller) {
|
|
170
|
-
await new Promise((f) => {
|
|
171
|
-
navigator.serviceWorker.oncontrollerchange = () => f();
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
setInterval(function() {
|
|
175
|
-
fetch("ping");
|
|
176
|
-
}, 1e4);
|
|
177
|
-
}
|
|
178
|
-
reactDomExports.render(/* @__PURE__ */ jsxRuntimeExports.jsx(WorkbenchLoader, {}), document.querySelector("#root"));
|
|
179
|
-
})();
|
|
180
|
-
//# sourceMappingURL=index.UNF4A0jZ.js.map
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { M as MultiTraceModel, r as reactExports, c as connect, j as jsxRuntimeExports, T as ToolbarButton, t as toggleTheme, W as Workbench, a as applyTheme, b as reactDomExports } from "./assets/wsPort-KEbz4l8i.js";
|
|
2
|
-
const WorkbenchLoader = () => {
|
|
3
|
-
const [isServer, setIsServer] = reactExports.useState(false);
|
|
4
|
-
const [traceURLs, setTraceURLs] = reactExports.useState([]);
|
|
5
|
-
const [uploadedTraceNames, setUploadedTraceNames] = reactExports.useState([]);
|
|
6
|
-
const [model, setModel] = reactExports.useState(emptyModel);
|
|
7
|
-
const [progress, setProgress] = reactExports.useState({ done: 0, total: 0 });
|
|
8
|
-
const [dragOver, setDragOver] = reactExports.useState(false);
|
|
9
|
-
const [processingErrorMessage, setProcessingErrorMessage] = reactExports.useState(null);
|
|
10
|
-
const [fileForLocalModeError, setFileForLocalModeError] = reactExports.useState(null);
|
|
11
|
-
const processTraceFiles = reactExports.useCallback((files) => {
|
|
12
|
-
const blobUrls = [];
|
|
13
|
-
const fileNames = [];
|
|
14
|
-
const url = new URL(window.location.href);
|
|
15
|
-
for (let i = 0; i < files.length; i++) {
|
|
16
|
-
const file = files.item(i);
|
|
17
|
-
if (!file)
|
|
18
|
-
continue;
|
|
19
|
-
const blobTraceURL = URL.createObjectURL(file);
|
|
20
|
-
blobUrls.push(blobTraceURL);
|
|
21
|
-
fileNames.push(file.name);
|
|
22
|
-
url.searchParams.append("trace", blobTraceURL);
|
|
23
|
-
url.searchParams.append("traceFileName", file.name);
|
|
24
|
-
}
|
|
25
|
-
const href = url.toString();
|
|
26
|
-
window.history.pushState({}, "", href);
|
|
27
|
-
setTraceURLs(blobUrls);
|
|
28
|
-
setUploadedTraceNames(fileNames);
|
|
29
|
-
setDragOver(false);
|
|
30
|
-
setProcessingErrorMessage(null);
|
|
31
|
-
}, []);
|
|
32
|
-
const handleDropEvent = reactExports.useCallback((event) => {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
processTraceFiles(event.dataTransfer.files);
|
|
35
|
-
}, [processTraceFiles]);
|
|
36
|
-
const handleFileInputChange = reactExports.useCallback((event) => {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
if (!event.target.files)
|
|
39
|
-
return;
|
|
40
|
-
processTraceFiles(event.target.files);
|
|
41
|
-
}, [processTraceFiles]);
|
|
42
|
-
reactExports.useEffect(() => {
|
|
43
|
-
const params = new URL(window.location.href).searchParams;
|
|
44
|
-
const newTraceURLs = params.getAll("trace");
|
|
45
|
-
setIsServer(params.has("isServer"));
|
|
46
|
-
for (const url of newTraceURLs) {
|
|
47
|
-
if (url.startsWith("file:")) {
|
|
48
|
-
setFileForLocalModeError(url || null);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (params.has("isServer")) {
|
|
53
|
-
connect({
|
|
54
|
-
onEvent(method, params2) {
|
|
55
|
-
if (method === "loadTrace") {
|
|
56
|
-
setTraceURLs(params2.url ? [params2.url] : []);
|
|
57
|
-
setDragOver(false);
|
|
58
|
-
setProcessingErrorMessage(null);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
onClose() {
|
|
62
|
-
}
|
|
63
|
-
}).then((sendMessage) => {
|
|
64
|
-
sendMessage("ready");
|
|
65
|
-
});
|
|
66
|
-
} else if (!newTraceURLs.some((url) => url.startsWith("blob:"))) {
|
|
67
|
-
setTraceURLs(newTraceURLs);
|
|
68
|
-
}
|
|
69
|
-
}, []);
|
|
70
|
-
reactExports.useEffect(() => {
|
|
71
|
-
(async () => {
|
|
72
|
-
if (traceURLs.length) {
|
|
73
|
-
const swListener = (event) => {
|
|
74
|
-
if (event.data.method === "progress")
|
|
75
|
-
setProgress(event.data.params);
|
|
76
|
-
};
|
|
77
|
-
navigator.serviceWorker.addEventListener("message", swListener);
|
|
78
|
-
setProgress({ done: 0, total: 1 });
|
|
79
|
-
const contextEntries = [];
|
|
80
|
-
for (let i = 0; i < traceURLs.length; i++) {
|
|
81
|
-
const url = traceURLs[i];
|
|
82
|
-
const params = new URLSearchParams();
|
|
83
|
-
params.set("trace", url);
|
|
84
|
-
if (uploadedTraceNames.length)
|
|
85
|
-
params.set("traceFileName", uploadedTraceNames[i]);
|
|
86
|
-
const response = await fetch(`contexts?${params.toString()}`);
|
|
87
|
-
if (!response.ok) {
|
|
88
|
-
if (!isServer)
|
|
89
|
-
setTraceURLs([]);
|
|
90
|
-
setProcessingErrorMessage((await response.json()).error);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
contextEntries.push(...await response.json());
|
|
94
|
-
}
|
|
95
|
-
navigator.serviceWorker.removeEventListener("message", swListener);
|
|
96
|
-
const model2 = new MultiTraceModel(contextEntries);
|
|
97
|
-
setProgress({ done: 0, total: 0 });
|
|
98
|
-
setModel(model2);
|
|
99
|
-
} else {
|
|
100
|
-
setModel(emptyModel);
|
|
101
|
-
}
|
|
102
|
-
})();
|
|
103
|
-
}, [isServer, traceURLs, uploadedTraceNames]);
|
|
104
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vbox workbench-loader", onDragOver: (event) => {
|
|
105
|
-
event.preventDefault();
|
|
106
|
-
setDragOver(true);
|
|
107
|
-
}, children: [
|
|
108
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "hbox header", children: [
|
|
109
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "logo", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: "playwright-logo.svg", alt: "Playwright logo" }) }),
|
|
110
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "product", children: "Playwright" }),
|
|
111
|
-
model.title && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: model.title }),
|
|
112
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "spacer" }),
|
|
113
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "color-mode", title: "Toggle color mode", toggled: false, onClick: () => toggleTheme() })
|
|
114
|
-
] }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "progress", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "inner-progress", style: { width: progress.total ? 100 * progress.done / progress.total + "%" : 0 } }) }),
|
|
116
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Workbench, { model }),
|
|
117
|
-
fileForLocalModeError && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "drop-target", children: [
|
|
118
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Trace Viewer uses Service Workers to show traces. To view trace:" }),
|
|
119
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { paddingTop: 20 }, children: [
|
|
120
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
121
|
-
"1. Click ",
|
|
122
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: fileForLocalModeError, children: "here" }),
|
|
123
|
-
" to put your trace into the download shelf"
|
|
124
|
-
] }),
|
|
125
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
126
|
-
"2. Go to ",
|
|
127
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://trace.playwright.dev", children: "trace.playwright.dev" })
|
|
128
|
-
] }),
|
|
129
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "3. Drop the trace from the download shelf into the page" })
|
|
130
|
-
] })
|
|
131
|
-
] }),
|
|
132
|
-
!isServer && !dragOver && !fileForLocalModeError && (!traceURLs.length || processingErrorMessage) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "drop-target", children: [
|
|
133
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "processing-error", children: processingErrorMessage }),
|
|
134
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: "Drop Playwright Trace to load" }),
|
|
135
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "or" }),
|
|
136
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: () => {
|
|
137
|
-
const input = document.createElement("input");
|
|
138
|
-
input.type = "file";
|
|
139
|
-
input.multiple = true;
|
|
140
|
-
input.click();
|
|
141
|
-
input.addEventListener("change", (e) => handleFileInputChange(e));
|
|
142
|
-
}, children: "Select file(s)" }),
|
|
143
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { maxWidth: 400 }, children: "Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally." })
|
|
144
|
-
] }),
|
|
145
|
-
isServer && !traceURLs.length && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "drop-target", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: "Select test to see the trace" }) }),
|
|
146
|
-
dragOver && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147
|
-
"div",
|
|
148
|
-
{
|
|
149
|
-
className: "drop-target",
|
|
150
|
-
onDragLeave: () => {
|
|
151
|
-
setDragOver(false);
|
|
152
|
-
},
|
|
153
|
-
onDrop: (event) => handleDropEvent(event),
|
|
154
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: "Release to analyse the Playwright Trace" })
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] });
|
|
158
|
-
};
|
|
159
|
-
const emptyModel = new MultiTraceModel([]);
|
|
160
|
-
(async () => {
|
|
161
|
-
applyTheme();
|
|
162
|
-
if (window.location.protocol !== "file:") {
|
|
163
|
-
if (window.location.href.includes("isUnderTest=true"))
|
|
164
|
-
await new Promise((f) => setTimeout(f, 1e3));
|
|
165
|
-
if (!navigator.serviceWorker)
|
|
166
|
-
throw new Error(`Service workers are not supported.
|
|
167
|
-
Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);
|
|
168
|
-
navigator.serviceWorker.register("sw.bundle.js");
|
|
169
|
-
if (!navigator.serviceWorker.controller) {
|
|
170
|
-
await new Promise((f) => {
|
|
171
|
-
navigator.serviceWorker.oncontrollerchange = () => f();
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
setInterval(function() {
|
|
175
|
-
fetch("ping");
|
|
176
|
-
}, 1e4);
|
|
177
|
-
}
|
|
178
|
-
reactDomExports.render(/* @__PURE__ */ jsxRuntimeExports.jsx(WorkbenchLoader, {}), document.querySelector("#root"));
|
|
179
|
-
})();
|
|
180
|
-
//# sourceMappingURL=index.ZUjC4zt1.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{M as E,r as s,c as R,j as c,a as r,T as x,t as C,W as j,b as F,d as O}from"./assets/wsPort-98e00a94.js";const I=()=>{const[l,P]=s.useState(!1),[d,h]=s.useState([]),[p,W]=s.useState([]),[v,S]=s.useState(L),[f,m]=s.useState({done:0,total:0}),[b,g]=s.useState(!1),[k,w]=s.useState(null),[T,U]=s.useState(null),u=s.useCallback(e=>{const o=[],a=[],t=new URL(window.location.href);for(let i=0;i<e.length;i++){const n=e.item(i);if(!n)continue;const N=URL.createObjectURL(n);o.push(N),a.push(n.name),t.searchParams.append("trace",N),t.searchParams.append("traceFileName",n.name)}const y=t.toString();window.history.pushState({},"",y),h(o),W(a),g(!1),w(null)},[]),D=s.useCallback(e=>{e.preventDefault(),u(e.dataTransfer.files)},[u]),M=s.useCallback(e=>{e.preventDefault(),e.target.files&&u(e.target.files)},[u]);return s.useEffect(()=>{const e=new URL(window.location.href).searchParams,o=e.getAll("trace");P(e.has("isServer"));for(const a of o)if(a.startsWith("file:")){U(a||null);return}e.has("isServer")?R({onEvent(a,t){a==="loadTrace"&&(h(t.url?[t.url]:[]),g(!1),w(null))},onClose(){}}).then(a=>{a("ready")}):o.some(a=>a.startsWith("blob:"))||h(o)},[]),s.useEffect(()=>{(async()=>{if(d.length){const e=t=>{t.data.method==="progress"&&m(t.data.params)};navigator.serviceWorker.addEventListener("message",e),m({done:0,total:1});const o=[];for(let t=0;t<d.length;t++){const y=d[t],i=new URLSearchParams;i.set("trace",y),p.length&&i.set("traceFileName",p[t]);const n=await fetch(`contexts?${i.toString()}`);if(!n.ok){l||h([]),w((await n.json()).error);return}o.push(...await n.json())}navigator.serviceWorker.removeEventListener("message",e);const a=new E(o);m({done:0,total:0}),S(a)}else S(L)})()},[l,d,p]),c("div",{className:"vbox workbench-loader",onDragOver:e=>{e.preventDefault(),g(!0)},children:[c("div",{className:"hbox header",children:[r("div",{className:"logo",children:r("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),r("div",{className:"product",children:"Playwright"}),v.title&&r("div",{className:"title",children:v.title}),r("div",{className:"spacer"}),r(x,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>C()})]}),r("div",{className:"progress",children:r("div",{className:"inner-progress",style:{width:f.total?100*f.done/f.total+"%":0}})}),r(j,{model:v}),T&&c("div",{className:"drop-target",children:[r("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),c("div",{style:{paddingTop:20},children:[c("div",{children:["1. Click ",r("a",{href:T,children:"here"})," to put your trace into the download shelf"]}),c("div",{children:["2. Go to ",r("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),r("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),!l&&!b&&!T&&(!d.length||k)&&c("div",{className:"drop-target",children:[r("div",{className:"processing-error",children:k}),r("div",{className:"title",children:"Drop Playwright Trace to load"}),r("div",{children:"or"}),r("button",{onClick:()=>{const e=document.createElement("input");e.type="file",e.multiple=!0,e.click(),e.addEventListener("change",o=>M(o))},children:"Select file(s)"}),r("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),l&&!d.length&&r("div",{className:"drop-target",children:r("div",{className:"title",children:"Select test to see the trace"})}),b&&r("div",{className:"drop-target",onDragLeave:()=>{g(!1)},onDrop:e=>D(e),children:r("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},L=new E([]);(async()=>{if(F(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(l=>setTimeout(l,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
2
|
-
Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(l=>{navigator.serviceWorker.oncontrollerchange=()=>l()}),setInterval(function(){fetch("ping")},1e4)}O.render(r(I,{}),document.querySelector("#root"))})();
|