@checkly/playwright-core 1.42.12 → 1.42.14
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/checkly/sWatcher.js +150 -0
- package/lib/cli/cli.js +62 -0
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/fetch.js +9 -5
- package/lib/common/debugLogger.js +91 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-I9ks4y7D.js → codeMirrorModule-W69B4LBB.js} +10 -10
- package/lib/vite/recorder/assets/{index-yg8ypzl6.js → index-Ly3PcVUb.js} +2 -2
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/{codeMirrorModule-Vg1kIqMp.js → codeMirrorModule-0bpaqixv.js} +10 -10
- package/lib/vite/traceViewer/assets/codeMirrorModule-5nkjDDU_.js +15578 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-75b0ca4f.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-RVP_AMUu.js +15585 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-c1454a2e.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-cc2329e4.js +15593 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-d725feea.js +15586 -0
- package/lib/vite/traceViewer/assets/{codeMirrorModule-wLpsbIhd.js → codeMirrorModule-e5a15eec.js} +13 -13
- package/lib/vite/traceViewer/assets/codeMirrorModule-kT-uS7F4.js +15592 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-rcsC5no8.js +15592 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-yboVpgC0.js +15592 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-ytMY1awF.js +15585 -0
- package/lib/vite/traceViewer/assets/wsPort-1-6TL4lc.js +18540 -0
- package/lib/vite/traceViewer/assets/wsPort-54626118.js +18361 -0
- package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +64 -0
- package/lib/vite/traceViewer/assets/wsPort-CAXygIGt.js +18540 -0
- package/lib/vite/traceViewer/assets/wsPort-KEbz4l8i.js +18540 -0
- package/lib/vite/traceViewer/assets/{wsPort-RIoVGhlT.js → wsPort-_JBDEilC.js} +2 -2
- package/lib/vite/traceViewer/assets/wsPort-a88a6a12.js +18361 -0
- package/lib/vite/traceViewer/assets/wsPort-cb764cde.js +64 -0
- package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +64 -0
- package/lib/vite/traceViewer/assets/wsPort-lTlmZhJd.js +18564 -0
- package/lib/vite/traceViewer/assets/wsPort-xpIMLVfx.js +18540 -0
- package/lib/vite/traceViewer/assets/wsPort-yM58htfg.js +18360 -0
- package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +9 -0
- package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +6410 -0
- package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +1 -0
- package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +344 -0
- package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
- package/lib/vite/traceViewer/index.1a1fe659.css +1 -0
- package/lib/vite/traceViewer/index.4a8ee36e.js +2 -0
- package/lib/vite/traceViewer/index.55e65778.js +181 -0
- package/lib/vite/traceViewer/index.5nqVcfiC.js +180 -0
- package/lib/vite/traceViewer/index.742fd3e5.js +181 -0
- package/lib/vite/traceViewer/index.76e9f312.css +124 -0
- package/lib/vite/traceViewer/index.UNF4A0jZ.js +180 -0
- package/lib/vite/traceViewer/index.ZUjC4zt1.js +180 -0
- package/lib/vite/traceViewer/index.a265fbdb.js +2 -0
- package/lib/vite/traceViewer/index.decad628.js +2 -0
- package/lib/vite/traceViewer/index.html +2 -2
- package/lib/vite/traceViewer/index.ici1bqta.js +180 -0
- package/lib/vite/traceViewer/index.mxOcKqpu.js +180 -0
- package/lib/vite/traceViewer/{index.-_8-eHEE.js → index.u51inEcm.js} +1 -1
- package/lib/vite/traceViewer/index.zXVxM5ps.js +180 -0
- package/lib/vite/traceViewer/uiMode.08ab2d90.js +4 -0
- package/lib/vite/traceViewer/uiMode.0d0d667b.js +4 -0
- package/lib/vite/traceViewer/uiMode.216233d5.js +1484 -0
- package/lib/vite/traceViewer/uiMode.2c31018f.css +1324 -0
- package/lib/vite/traceViewer/uiMode.468b0309.js +4 -0
- package/lib/vite/traceViewer/uiMode.67C8Ij-c.js +1490 -0
- package/lib/vite/traceViewer/uiMode.8b41a49d.css +1 -0
- package/lib/vite/traceViewer/uiMode.F_k6a2aC.js +1488 -0
- package/lib/vite/traceViewer/{uiMode.9CwNsWc6.js → uiMode.Fb0bNA4H.js} +1 -1
- package/lib/vite/traceViewer/uiMode.NjZAwD_B.js +1485 -0
- package/lib/vite/traceViewer/uiMode.YQRCZjm8.js +1485 -0
- package/lib/vite/traceViewer/uiMode.b2068d00.js +1484 -0
- package/lib/vite/traceViewer/uiMode.e-PLonGl.js +1490 -0
- package/lib/vite/traceViewer/uiMode.fEEgOxJh.js +1490 -0
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/lib/vite/traceViewer/uiMode.kvEeWpo2.js +1490 -0
- package/lib/vite/traceViewer/uiMode.ljHA9Ynz.js +1490 -0
- package/lib/vite/traceViewer/uiMode.ybQP_6Xr.js +10 -0
- package/lib/vite/traceViewer/wsPort.997c92cf.css +3513 -0
- package/lib/vite/traceViewer/wsPort.9c9a6767.css +1 -0
- package/lib/vite/traceViewer/wsPort.Oa05jfrO.css +3513 -0
- package/lib/vite/traceViewer/xtermModule.125f4259.css +191 -0
- package/lib/vite/traceViewer/xtermModule.6428296b.css +32 -0
- package/package.json +1 -1
- package/lib/vite/traceViewer/assets/wsPort-f2dAQL4I.js +0 -69
- package/lib/vite/traceViewer/index.qOFdH9Ja.js +0 -2
- package/lib/vite/traceViewer/uiMode.iNIhieBM.js +0 -10
|
@@ -0,0 +1,180 @@
|
|
|
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-yM58htfg.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.zXVxM5ps.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{u as Mt,r as K,e as Bt,_ as Nt,f as Rt,g as Pt,a as h,j as _,R as f,h as Dt,c as Lt,s as vt,S as Ft,i as tt,T as B,t as It,m as Wt,k as Ot,l as ht,W as jt,M as At,n as zt,b as Vt,d as Kt}from"./assets/wsPort-98e00a94.js";class ft{constructor(){this._stringCache=new Map}internString(t){let e=this._stringCache.get(t);return e||(this._stringCache.set(t,t),e=t),e}}class pt{constructor(t,e,s,i){this._tests=new Map,this._listOnly=!1,this._clearPreviousResultsWhenTestBegins=!1,this._stringPool=new ft,this._rootSuite=new j("","root"),this._pathSeparator=t,this._reporter=e,this._reuseTestCases=s,this._reportConfig=i}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_setClearPreviousResultsWhenTestBegins(){this._clearPreviousResultsWhenTestBegins=!0}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._listOnly=t.listOnly,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._rootSuite.suites.find(i=>i.project().__projectId===t.id);e||(e=new j(t.name,"project"),this._rootSuite.suites.push(e),e.parent=this._rootSuite);const s=this._parseProject(t);if(e.project=()=>s,this._mergeSuitesInto(t.suites,e),this._listOnly){const i=new Set,r=c=>{c.tests.map(a=>a.testId).forEach(a=>i.add(a)),c.suites.forEach(r)};t.suites.forEach(r);const o=c=>{c.tests=c.tests.filter(a=>i.has(a.id)),c.suites.forEach(o)};o(e)}}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var r,o;const s=this._tests.get(t);this._clearPreviousResultsWhenTestBegins&&s._clearResults();const i=s._createTestResult(e.id);i.retry=e.retry,i.workerIndex=e.workerIndex,i.parallelIndex=e.parallelIndex,i.setStartTimeNumber(e.startTime),i.statusEx="running",(o=(r=this._reporter).onTestBegin)==null||o.call(r,s,i)}_onTestEnd(t,e){var r,o,c;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.resultsMap.get(e.id);i.duration=e.duration,i.status=e.status,i.statusEx=e.status,i.errors=e.errors,i.error=(r=i.errors)==null?void 0:r[0],i.attachments=this._parseAttachments(e.attachments),(c=(o=this._reporter).onTestEnd)==null||c.call(o,s,i),i.stepMap=new Map}_onStepBegin(t,e,s){var p,d;const i=this._tests.get(t),r=i.resultsMap.get(e),o=s.parentStepId?r.stepMap.get(s.parentStepId):void 0,c=this._absoluteLocation(s.location),a=new Ht(s,o,c);o?o.steps.push(a):r.steps.push(a),r.stepMap.set(s.id,a),(d=(p=this._reporter).onStepBegin)==null||d.call(p,i,r,a)}_onStepEnd(t,e,s){var c,a;const i=this._tests.get(t),r=i.resultsMap.get(e),o=r.stepMap.get(s.id);o.duration=s.duration,o.error=s.error,(a=(c=this._reporter).onStepEnd)==null||a.call(c,i,r,o)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,r){var p,d,b,g;const o=r?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,c=e?this._tests.get(e):void 0,a=c&&s?c.resultsMap.get(s):void 0;t==="stdout"?(a==null||a.stdout.push(o),(d=(p=this._reporter).onStdOut)==null||d.call(p,o,c,a)):(a==null||a.stderr.push(o),(g=(b=this._reporter).onStdErr)==null||g.call(b,o,c,a))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.duration}))}_onExit(){var t,e;return this._stringPool=new ft,(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...bt,...t};return this._reportConfig&&(e.configFile=this._reportConfig.configFile,e.reportSlowTests=this._reportConfig.reportSlowTests,e.quiet=this._reportConfig.quiet,e.reporter=[...this._reportConfig.reporter]),e}_parseProject(t){return{__projectId:t.id,metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:G(t.testIgnore),testMatch:G(t.testMatch),timeout:t.timeout,grep:G(t.grep),grepInvert:G(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:{}}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuitesInto(t,e){for(const s of t){let i=e.suites.find(r=>r.title===s.title);i||(i=new j(s.title,s.type),i.parent=e,e.suites.push(i)),i.location=this._absoluteLocation(s.location),i._fileId=s.fileId,i._parallelMode=s.parallelMode,this._mergeSuitesInto(s.suites,i),this._mergeTestsInto(s.tests,i)}}_mergeTestsInto(t,e){for(const s of t){let i=this._reuseTestCases?e.tests.find(r=>r.title===s.title):void 0;i||(i=new Ut(s.testId,s.title,this._absoluteLocation(s.location)),i.parent=e,e.tests.push(i),this._tests.set(i.id,i)),this._updateTest(s,i)}}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){return t&&this._stringPool.internString(this._rootDir+this._pathSeparator+t)}}class j{constructor(t,e){this._requireFile="",this.suites=[],this.tests=[],this._parallelMode="none",this.title=t,this._type=e}allTests(){const t=[],e=s=>{for(const i of[...s.suites,...s.tests])i instanceof j?e(i):t.push(i)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){}}class Ut{constructor(t,e,s){this.fn=()=>{},this.results=[],this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.repeatEachIndex=0,this.resultsMap=new Map,this.id=t,this.title=e,this.location=s}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){var s,i;const t=[...this.results];for(;((s=t[0])==null?void 0:s.status)==="skipped"||((i=t[0])==null?void 0:i.status)==="interrupted";)t.shift();if(!t.length)return"skipped";const e=t.filter(r=>r.status!=="skipped"&&r.status!=="interrupted"&&r.status!==this.expectedStatus);return e.length?e.length===t.length?"unexpected":"flaky":"expected"}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_clearResults(){this.results=[],this.resultsMap.clear()}_createTestResult(t){const e=new $t(this.results.length);return this.results.push(e),this.resultsMap.set(t,e),e}}class Ht{constructor(t,e,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}class $t{constructor(t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this.stepMap=new Map,this.statusEx="scheduled",this._startTime=0,this.retry=t}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const bt={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[{}.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function G(n){return n.map(t=>t.s?t.s:new RegExp(t.r.source,t.r.flags))}const qt=({source:n})=>{const[t,e]=Mt(),[s,i]=K.useState(Bt()),[r]=K.useState(Nt(()=>import("./assets/xtermModule-443332e6.js"),["./assets/xtermModule-443332e6.js","./xtermModule.6428296b.css"],import.meta.url).then(c=>c.default)),o=K.useRef(null);return K.useEffect(()=>(Rt(i),()=>Pt(i)),[]),K.useEffect(()=>{const c=n.write,a=n.clear;return(async()=>{const{Terminal:p,FitAddon:d}=await r,b=e.current;if(!b)return;const g=s==="dark-mode"?Xt:Yt;if(o.current&&o.current.terminal.options.theme===g)return;o.current&&(b.textContent="");const l=new p({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:g}),m=new d;l.loadAddon(m);for(const v of n.pending)l.write(v);n.write=v=>{n.pending.push(v),l.write(v)},n.clear=()=>{n.pending=[],l.clear()},l.open(b),m.fit(),o.current={terminal:l,fitAddon:m}})(),()=>{n.clear=a,n.write=c}},[r,o,e,n,s]),K.useEffect(()=>{setTimeout(()=>{o.current&&(o.current.fitAddon.fit(),n.resize(o.current.terminal.cols,o.current.terminal.rows))},250)},[t,n]),h("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},Yt={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},Xt={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"};const Jt=({title:n,children:t,setExpanded:e,expanded:s,expandOnTitleClick:i})=>_("div",{className:"expandable"+(s?" expanded":""),children:[_("div",{className:"expandable-title",onClick:()=>i&&e(!s),children:[h("div",{className:"codicon codicon-"+(s?"chevron-down":"chevron-right"),style:{cursor:"pointer",color:"var(--vscode-foreground)",marginLeft:"5px"},onClick:()=>!i&&e(!s)}),n]}),s&&h("div",{style:{marginLeft:25},children:t})]});function Qt(n){return`.playwright-artifacts-${n}`}let at=()=>{},_t=n=>{},St={cols:80,rows:24},O=async()=>{};const A={pending:[],clear:()=>{},write:n=>A.pending.push(n),resize:(n,t)=>{St={cols:n,rows:t},Y("resizeTerminal",{cols:n,rows:t})}},Zt=({})=>{var dt;const[n,t]=f.useState(""),[e,s]=f.useState(!1),[i,r]=f.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[o,c]=f.useState(new Map),[a,p]=f.useState({config:void 0,rootSuite:void 0,loadErrors:[]}),[d,b]=f.useState(),[g,l]=f.useState({}),[m,v]=f.useState(new Set),[E,N]=f.useState(!1),[S,D]=f.useState(),[R,J]=Dt("watch-all",!1),[st,z]=f.useState({value:new Set}),u=f.useRef(Promise.resolve()),k=f.useRef(new Set),[w,T]=f.useState(0),[C,y]=f.useState(!1),[Q,ut]=f.useState(!0),Et=f.useRef(null),it=f.useCallback(()=>{N(!0),z({value:new Set}),at(bt,new j("","root"),[],void 0),Tt(!0).then(async()=>{N(!1);const{hasBrowsers:x}=await O("checkBrowsers");ut(x)})},[]);f.useEffect(()=>{var x;(x=Et.current)==null||x.focus(),N(!0),Lt({onEvent:ie,onClose:()=>y(!0)}).then(M=>{O=async(L,F)=>{const P=window.__logForTest;P==null||P({method:L,params:F}),await M(L,F)},it()})},[it]),at=f.useCallback((x,M,L,F)=>{const P=x.configFile?vt.getObject(x.configFile+":projects",void 0):void 0;for(const I of o.keys())M.suites.find(Z=>Z.title===I)||o.delete(I);for(const I of M.suites)o.has(I.title)||o.set(I.title,!!(P!=null&&P.includes(I.title)));!P&&o.size&&![...o.values()].includes(!0)&&o.set(o.entries().next().value[0],!0),p({config:x,rootSuite:M,loadErrors:L}),c(new Map(o)),S&&F?b(F):F||b(void 0)},[o,S]);const nt=f.useCallback((x,M)=>{x==="bounce-if-busy"&&S||(k.current=new Set([...k.current,...M]),u.current=u.current.then(async()=>{var P,I,Z;const L=k.current;if(k.current=new Set,!L.size)return;{for(const W of((P=a.rootSuite)==null?void 0:P.allTests())||[])L.has(W.id)&&(W._clearResults(),W._createTestResult("pending"));p({...a})}const F=" ["+new Date().toLocaleTimeString()+"]";A.write("\x1B[2m—".repeat(Math.max(0,St.cols-F.length))+F+"\x1B[22m"),b({total:0,passed:0,failed:0,skipped:0}),D({testIds:L}),await O("run",{testIds:[...L],projects:[...o].filter(([W,yt])=>yt).map(([W])=>W)});for(const W of((I=a.rootSuite)==null?void 0:I.allTests())||[])((Z=W.results[0])==null?void 0:Z.duration)===-1&&W._clearResults();p({...a}),D(void 0)}))},[o,S,a]),V=!!S,ot=f.useRef(null),Ct=f.useCallback(x=>{var M;x.preventDefault(),x.stopPropagation(),(M=ot.current)==null||M.showModal()},[]),rt=f.useCallback(x=>{var M;x.preventDefault(),x.stopPropagation(),(M=ot.current)==null||M.close()},[]),xt=f.useCallback(x=>{rt(x),s(!0),O("installBrowsers").then(async()=>{s(!1);const{hasBrowsers:M}=await O("checkBrowsers");ut(M)})},[rt]);return _("div",{className:"vbox ui-mode",children:[!Q&&_("dialog",{ref:ot,children:[_("div",{className:"title",children:[h("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),_("div",{className:"body",children:["Playwright did not find installed browsers.",h("br",{}),"Would you like to run `playwright install`?",h("br",{}),h("button",{className:"button",onClick:xt,children:"Install"}),h("button",{className:"button secondary",onClick:rt,children:"Dismiss"})]})]}),C&&_("div",{className:"disconnected",children:[h("div",{className:"title",children:"UI Mode disconnected"}),_("div",{children:[h("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),_(Ft,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",children:[_("div",{className:"vbox",children:[_("div",{className:"vbox"+(e?"":" hidden"),children:[_(tt,{children:[h("div",{className:"section-title",style:{flex:"none"},children:"Output"}),h(B,{icon:"circle-slash",title:"Clear output",onClick:()=>A.clear()}),h("div",{className:"spacer"}),h(B,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),h(qt,{source:A})]}),h("div",{className:"vbox"+(e?" hidden":""),children:h(se,{item:g,rootDir:(dt=a.config)==null?void 0:dt.rootDir})})]}),_("div",{className:"vbox ui-mode-sidebar",children:[_(tt,{noShadow:!0,noMinHeight:!0,children:[h("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),h("div",{className:"section-title",children:"Playwright"}),h(B,{icon:"color-mode",title:"Toggle color mode",onClick:()=>It()}),h(B,{icon:"refresh",title:"Reload",onClick:()=>it(),disabled:V||E}),h(B,{icon:"terminal",title:"Toggle output",toggled:e,onClick:()=>{s(!e)}}),!Q&&h(B,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Ct})]}),h(Gt,{filterText:n,setFilterText:t,statusFilters:i,setStatusFilters:r,projectFilters:o,setProjectFilters:c,testModel:a,runTests:()=>nt("bounce-if-busy",m)}),_(tt,{noMinHeight:!0,children:[!V&&!d&&h("div",{className:"section-title",children:"Tests"}),!V&&d&&h("div",{"data-testid":"status-line",className:"status-line",children:_("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),V&&d&&h("div",{"data-testid":"status-line",className:"status-line",children:_("div",{children:["Running ",d.passed,"/",S.testIds.size," passed (",d.passed/S.testIds.size*100|0,"%)"]})}),h(B,{icon:"play",title:"Run all",onClick:()=>nt("bounce-if-busy",m),disabled:V||E}),h(B,{icon:"debug-stop",title:"Stop",onClick:()=>Y("stop"),disabled:!V||E}),h(B,{icon:"eye",title:"Watch all",toggled:R,onClick:()=>{z({value:new Set}),J(!R)}}),h(B,{icon:"collapse-all",title:"Collapse all",onClick:()=>{T(w+1)}})]}),h(ee,{statusFilters:i,projectFilters:o,filterText:n,testModel:a,runningState:S,runTests:nt,onItemSelected:l,setVisibleTestIds:v,watchAll:R,watchedTreeIds:st,setWatchedTreeIds:z,isLoading:E,requestedCollapseAllCount:w})]})]})]})},Gt=({filterText:n,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:r,testModel:o,runTests:c})=>{const[a,p]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{var l;(l=d.current)==null||l.focus()},[]);const b=[...e.entries()].filter(([l,m])=>m).map(([l])=>l).join(" ")||"all",g=[...i.entries()].filter(([l,m])=>m).map(([l])=>l).join(" ")||"all";return _("div",{className:"filters",children:[h(Jt,{expanded:a,setExpanded:p,title:h("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:n,onChange:l=>{t(l.target.value)},onKeyDown:l=>{l.key==="Enter"&&c()}})}),_("div",{className:"filter-summary",title:"Status: "+b+`
|
|
2
|
+
Projects: `+g,onClick:()=>p(!a),children:[h("span",{className:"filter-label",children:"Status:"})," ",b,h("span",{className:"filter-label",children:"Projects:"})," ",g]}),a&&_("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[h("div",{className:"filter-list",children:[...e.entries()].map(([l,m])=>h("div",{className:"filter-entry",children:_("label",{children:[h("input",{type:"checkbox",checked:m,onClick:()=>{const v=new Map(e);v.set(l,!v.get(l)),s(v)}}),h("div",{children:l})]})}))}),h("div",{className:"filter-list",children:[...i.entries()].map(([l,m])=>h("div",{className:"filter-entry",children:_("label",{children:[h("input",{type:"checkbox",checked:m,onClick:()=>{var N;const v=new Map(i);v.set(l,!v.get(l)),r(v);const E=(N=o==null?void 0:o.config)==null?void 0:N.configFile;E&&vt.setObject(E+":projects",[...v.entries()].filter(([S,D])=>D).map(([S])=>S))}}),h("div",{children:l||"untitled"})]})}))})]})]})},te=zt,ee=({statusFilters:n,projectFilters:t,filterText:e,testModel:s,runTests:i,runningState:r,watchAll:o,watchedTreeIds:c,setWatchedTreeIds:a,isLoading:p,onItemSelected:d,setVisibleTestIds:b,requestedCollapseAllCount:g})=>{const[l,m]=f.useState({expandedItems:new Map}),[v,E]=f.useState(),[N,S]=f.useState(g),{rootItem:D,treeItemMap:R,fileNames:J}=f.useMemo(()=>{let u=re(s.rootSuite,s.loadErrors,t);le(u,e,n,r==null?void 0:r.testIds),kt(u),u=ae(u),ce(u);const k=new Map,w=new Set,T=new Set,C=y=>{y.kind==="group"&&y.location.file&&T.add(y.location.file),y.kind==="case"&&y.tests.forEach(Q=>w.add(Q.id)),y.children.forEach(C),k.set(y.id,y)};return C(u),b(w),{rootItem:u,treeItemMap:k,fileNames:T}},[e,s,n,t,b,r]);f.useEffect(()=>{if(N!==g){l.expandedItems.clear();for(const w of R.keys())l.expandedItems.set(w,!1);S(g),E(void 0),m({...l});return}if(!r||r.itemSelectedByUser)return;let u;const k=w=>{var T;w.children.forEach(k),!u&&w.status==="failed"&&(w.kind==="test"&&r.testIds.has(w.test.id)||w.kind==="case"&&r.testIds.has((T=w.tests[0])==null?void 0:T.id))&&(u=w)};k(D),u&&E(u.id)},[r,E,D,N,S,g,l,m,R]);const{selectedTreeItem:st}=f.useMemo(()=>{const u=v?R.get(v):void 0;let k;u&&(k={file:u.location.file,line:u.location.line,source:{errors:s.loadErrors.filter(T=>{var C;return((C=T.location)==null?void 0:C.file)===u.location.file}).map(T=>({line:T.location.line,message:T.message})),content:void 0}});let w;return(u==null?void 0:u.kind)==="test"?w=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(w=u.tests[0]),d({treeItem:u,testCase:w,testFile:k}),{selectedTreeItem:u}},[d,v,s,R]);f.useEffect(()=>{if(!p)if(o)Y("watch",{fileNames:[...J]});else{const u=new Set;for(const k of c.value){const w=R.get(k),T=w==null?void 0:w.location.file;T&&u.add(T)}Y("watch",{fileNames:[...u]})}},[p,D,J,o,c,R]);const z=u=>{E(u.id),i("bounce-if-busy",lt(u))};return _t=u=>{const k=[],w=new Set(u);if(o){const T=C=>{const y=C.location.file;y&&w.has(y)&&k.push(...lt(C)),C.kind==="group"&&C.subKind==="folder"&&C.children.forEach(T)};T(D)}else for(const T of c.value){const C=R.get(T),y=C==null?void 0:C.location.file;y&&w.has(y)&&k.push(...lt(C))}i("queue-if-busy",new Set(k))},h(te,{name:"tests",treeState:l,setTreeState:m,rootItem:D,dataTestId:"test-tree",render:u=>_("div",{className:"hbox ui-mode-list-item",children:[h("div",{className:"ui-mode-list-item-title",title:u.title,children:u.title}),!!u.duration&&u.status!=="skipped"&&h("div",{className:"ui-mode-list-item-time",children:Wt(u.duration)}),_(tt,{noMinHeight:!0,noShadow:!0,children:[h(B,{icon:"play",title:"Run",onClick:()=>z(u),disabled:!!r}),h(B,{icon:"go-to-file",title:"Open in VS Code",onClick:()=>Y("open",{location:oe(u)}),style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!o&&h(B,{icon:"eye",title:"Watch",onClick:()=>{c.value.has(u.id)?c.value.delete(u.id):c.value.add(u.id),a({...c})},toggled:c.value.has(u.id)})]})]}),icon:u=>Ot(u.status),selectedItem:st,onAccepted:z,onSelected:u=>{r&&(r.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:e?5:1,noItemsMessage:p?"Loading…":"No tests"})},se=({item:n,rootDir:t})=>{var g;const[e,s]=f.useState(),[i,r]=f.useState(0),o=f.useRef(null),{outputDir:c}=f.useMemo(()=>({outputDir:n.testCase?ne(n.testCase):void 0}),[n]),[a,p]=f.useState(),d=f.useCallback(l=>p(ht(l)),[p]),b=a?e==null?void 0:e.model.actions.find(l=>ht(l)===a):void 0;return f.useEffect(()=>{var E,N;o.current&&clearTimeout(o.current);const l=(E=n.testCase)==null?void 0:E.results[0];if(!l){s(void 0);return}const m=l&&l.duration>=0&&l.attachments.find(S=>S.name==="trace");if(m&&m.path){wt(m.path).then(S=>s({model:S,isLive:!1}));return}if(!c){s(void 0);return}const v=`${c}/${Qt(l.workerIndex)}/traces/${(N=n.testCase)==null?void 0:N.id}.json`;return o.current=setTimeout(async()=>{try{const S=await wt(v);s({model:S,isLive:!0})}catch{s(void 0)}finally{r(i+1)}},500),()=>{o.current&&clearTimeout(o.current)}},[c,n,s,i,r]),h(jt,{model:e==null?void 0:e.model,hideStackFrames:!0,showSourcesFirst:!0,rootDir:t,initialSelection:b,onSelectionChanged:d,fallbackLocation:n.testFile,isLive:e==null?void 0:e.isLive,status:(g=n.treeItem)==null?void 0:g.status},"workbench")};let $,q,gt,et,H;const mt=()=>{clearTimeout(et),et=void 0,at(H.config,H.rootSuite,H.loadErrors,H.progress)},U=(n,t,e,s,i=!1)=>{H={config:n,rootSuite:t,loadErrors:e,progress:s},i?mt():et||(et=setTimeout(mt,250))},Tt=n=>{if(!n)return O("list",{});let t;const e=[],s={total:0,passed:0,failed:0,skipped:0};let i;return $=new pt(X,{version:()=>"v2",onConfigure:r=>{i=r,q=new pt(X,{onBegin:o=>{gt=o.allTests().length,q=void 0}},!1)},onBegin:r=>{t||(t=r),s.total=gt,s.passed=0,s.failed=0,s.skipped=0,U(i,t,e,s,!0)},onEnd:()=>{U(i,t,e,s,!0)},onTestBegin:()=>{U(i,t,e,s)},onTestEnd:r=>{r.outcome()==="skipped"?++s.skipped:r.outcome()==="unexpected"?++s.failed:++s.passed,U(i,t,e,s)},onError:r=>{A.write((r.stack||r.value||"")+`
|
|
3
|
+
`),e.push(r),U(i,t??new j("","root"),e,s)},printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}},!0),$._setClearPreviousResultsWhenTestBegins(),O("list",{})},Y=(n,t)=>{if(window._overrideProtocolForTest){window._overrideProtocolForTest({method:n,params:t}).catch(()=>{});return}O(n,t).catch(e=>{console.error(e)})},ie=(n,t)=>{var e,s;if(n==="listChanged"){Tt(!1).catch(()=>{});return}if(n==="testFilesChanged"){_t(t.testFileNames);return}if(n==="stdio"){if(t.buffer){const i=atob(t.buffer);A.write(i)}else A.write(t.text);return}(e=q==null?void 0:q.dispatch({method:n,params:t}))==null||e.catch(()=>{}),(s=$==null?void 0:$.dispatch({method:n,params:t}))==null||s.catch(()=>{})},ne=n=>{var t;for(let e=n.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir},oe=n=>{if(n)return n.location.file+":"+n.location.line},lt=n=>{const t=new Set;if(!n)return t;const e=s=>{var i;s.kind==="case"?s.tests.map(r=>r.id).forEach(r=>t.add(r)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(n),t};function ct(n,t,e,s){if(t.length===0)return n;const i=t.join(X),r=s.get(i);if(r)return r;const o=ct(n,t.slice(0,t.length-1),!1,s),c={kind:"group",subKind:e?"file":"folder",id:i,title:t[t.length-1],location:{file:i,line:0,column:0},duration:0,parent:o,children:[],status:"none",hasLoadErrors:!1};return o.children.push(c),s.set(i,c),c}function re(n,t,e){const s=[...e.values()].some(Boolean),i={kind:"group",subKind:"folder",id:"root",title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},r=(c,a,p)=>{for(const d of a.suites){const b=d.title||"<anonymous>";let g=p.children.find(l=>l.kind==="group"&&l.title===b);g||(g={kind:"group",subKind:"describe",id:"suite:"+a.titlePath().join("")+""+b,title:b,location:d.location,duration:0,parent:p,children:[],status:"none",hasLoadErrors:!1},p.children.push(g)),r(c,d,g)}for(const d of a.tests){const b=d.title;let g=p.children.find(v=>v.kind!=="group"&&v.title===b);g||(g={kind:"case",id:"test:"+d.titlePath().join(""),title:b,parent:p,children:[],tests:[],location:d.location,duration:0,status:"none"},p.children.push(g));const l=d.results[0];let m="none";(l==null?void 0:l.statusEx)==="scheduled"?m="scheduled":(l==null?void 0:l.statusEx)==="running"?m="running":(l==null?void 0:l.status)==="skipped"?m="skipped":(l==null?void 0:l.status)==="interrupted"?m="none":l&&d.outcome()!=="expected"?m="failed":l&&d.outcome()==="expected"&&(m="passed"),g.tests.push(d),g.children.push({kind:"test",id:d.id,title:c,location:d.location,test:d,parent:g,children:[],status:m,duration:d.results.length?Math.max(0,d.results[0].duration):0,project:c}),g.duration=g.children.reduce((v,E)=>v+E.duration,0)}},o=new Map;for(const c of(n==null?void 0:n.suites)||[])if(!(s&&!e.get(c.title)))for(const a of c.suites){const p=ct(i,a.location.file.split(X),!0,o);r(c.title,a,p)}for(const c of t){if(!c.location)continue;const a=ct(i,c.location.file.split(X),!0,o);a.hasLoadErrors=!0}return i}function le(n,t,e,s){const i=t.trim().toLowerCase().split(" "),r=[...e.values()].some(Boolean),o=a=>{const p=a.tests[0].titlePath().join(" ").toLowerCase();return!i.every(d=>p.includes(d))&&!a.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(a.children=a.children.filter(d=>!r||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),a.tests=a.children.map(d=>d.test),!!a.children.length)},c=a=>{const p=[];for(const d of a.children)d.kind==="case"?o(d)&&p.push(d):(c(d),(d.children.length||d.hasLoadErrors)&&p.push(d));a.children=p};c(n)}function kt(n){for(const o of n.children)kt(o);n.kind==="group"&&n.children.sort((o,c)=>o.location.file.localeCompare(c.location.file)||o.location.line-c.location.line);let t=n.children.length>0,e=n.children.length>0,s=!1,i=!1,r=!1;for(const o of n.children)e=e&&o.status==="skipped",t=t&&(o.status==="passed"||o.status==="skipped"),s=s||o.status==="failed",i=i||o.status==="running",r=r||o.status==="scheduled";i?n.status="running":r?n.status="scheduled":s?n.status="failed":e?n.status="skipped":t&&(n.status="passed")}function ae(n){let t=n;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];return t.location=n.location,t}function ce(n){const t=e=>{e.kind==="case"&&e.children.length===1?e.children=[]:e.children.forEach(t)};t(n)}async function wt(n){const t=new URLSearchParams;t.set("trace",n);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new At(s)}const X=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";(async()=>{if(Vt(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(n=>setTimeout(n,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
4
|
+
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(n=>{navigator.serviceWorker.oncontrollerchange=()=>n()}),setInterval(function(){fetch("ping")},1e4)}Kt.render(h(Zt,{}),document.querySelector("#root"))})();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{u as Mt,r as K,e as Bt,_ as Nt,f as Rt,g as Pt,a as h,j as _,R as f,h as Dt,c as Lt,s as vt,S as Ft,i as tt,T as B,t as It,m as Wt,k as Ot,l as ht,W as jt,M as At,n as zt,b as Vt,d as Kt}from"./assets/wsPort-ee2830d7.js";class ft{constructor(){this._stringCache=new Map}internString(t){let e=this._stringCache.get(t);return e||(this._stringCache.set(t,t),e=t),e}}class pt{constructor(t,e,s,i){this._tests=new Map,this._listOnly=!1,this._clearPreviousResultsWhenTestBegins=!1,this._stringPool=new ft,this._rootSuite=new j("","root"),this._pathSeparator=t,this._reporter=e,this._reuseTestCases=s,this._reportConfig=i}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_setClearPreviousResultsWhenTestBegins(){this._clearPreviousResultsWhenTestBegins=!0}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._listOnly=t.listOnly,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._rootSuite.suites.find(i=>i.project().__projectId===t.id);e||(e=new j(t.name,"project"),this._rootSuite.suites.push(e),e.parent=this._rootSuite);const s=this._parseProject(t);if(e.project=()=>s,this._mergeSuitesInto(t.suites,e),this._listOnly){const i=new Set,r=c=>{c.tests.map(a=>a.testId).forEach(a=>i.add(a)),c.suites.forEach(r)};t.suites.forEach(r);const o=c=>{c.tests=c.tests.filter(a=>i.has(a.id)),c.suites.forEach(o)};o(e)}}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var r,o;const s=this._tests.get(t);this._clearPreviousResultsWhenTestBegins&&s._clearResults();const i=s._createTestResult(e.id);i.retry=e.retry,i.workerIndex=e.workerIndex,i.parallelIndex=e.parallelIndex,i.setStartTimeNumber(e.startTime),i.statusEx="running",(o=(r=this._reporter).onTestBegin)==null||o.call(r,s,i)}_onTestEnd(t,e){var r,o,c;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus,s.annotations=t.annotations;const i=s.resultsMap.get(e.id);i.duration=e.duration,i.status=e.status,i.statusEx=e.status,i.errors=e.errors,i.error=(r=i.errors)==null?void 0:r[0],i.attachments=this._parseAttachments(e.attachments),(c=(o=this._reporter).onTestEnd)==null||c.call(o,s,i),i.stepMap=new Map}_onStepBegin(t,e,s){var p,d;const i=this._tests.get(t),r=i.resultsMap.get(e),o=s.parentStepId?r.stepMap.get(s.parentStepId):void 0,c=this._absoluteLocation(s.location),a=new Ht(s,o,c);o?o.steps.push(a):r.steps.push(a),r.stepMap.set(s.id,a),(d=(p=this._reporter).onStepBegin)==null||d.call(p,i,r,a)}_onStepEnd(t,e,s){var c,a;const i=this._tests.get(t),r=i.resultsMap.get(e),o=r.stepMap.get(s.id);o.duration=s.duration,o.error=s.error,(a=(c=this._reporter).onStepEnd)==null||a.call(c,i,r,o)}_onError(t){var e,s;(s=(e=this._reporter).onError)==null||s.call(e,t)}_onStdIO(t,e,s,i,r){var p,d,b,g;const o=r?globalThis.Buffer?Buffer.from(i,"base64"):atob(i):i,c=e?this._tests.get(e):void 0,a=c&&s?c.resultsMap.get(s):void 0;t==="stdout"?(a==null||a.stdout.push(o),(d=(p=this._reporter).onStdOut)==null||d.call(p,o,c,a)):(a==null||a.stderr.push(o),(g=(b=this._reporter).onStdErr)==null||g.call(b,o,c,a))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,{status:t.status,startTime:new Date(t.startTime),duration:t.duration}))}_onExit(){var t,e;return this._stringPool=new ft,(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e={...bt,...t};return this._reportConfig&&(e.configFile=this._reportConfig.configFile,e.reportSlowTests=this._reportConfig.reportSlowTests,e.quiet=this._reportConfig.quiet,e.reporter=[...this._reportConfig.reporter]),e}_parseProject(t){return{__projectId:t.id,metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:G(t.testIgnore),testMatch:G(t.testMatch),timeout:t.timeout,grep:G(t.grep),grepInvert:G(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),use:{}}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuitesInto(t,e){for(const s of t){let i=e.suites.find(r=>r.title===s.title);i||(i=new j(s.title,s.type),i.parent=e,e.suites.push(i)),i.location=this._absoluteLocation(s.location),i._fileId=s.fileId,i._parallelMode=s.parallelMode,this._mergeSuitesInto(s.suites,i),this._mergeTestsInto(s.tests,i)}}_mergeTestsInto(t,e){for(const s of t){let i=this._reuseTestCases?e.tests.find(r=>r.title===s.title):void 0;i||(i=new Ut(s.testId,s.title,this._absoluteLocation(s.location)),i.parent=e,e.tests.push(i),this._tests.set(i.id,i)),this._updateTest(s,i)}}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){return t&&this._stringPool.internString(this._rootDir+this._pathSeparator+t)}}class j{constructor(t,e){this._requireFile="",this.suites=[],this.tests=[],this._parallelMode="none",this.title=t,this._type=e}allTests(){const t=[],e=s=>{for(const i of[...s.suites,...s.tests])i instanceof j?e(i):t.push(i)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){}}class Ut{constructor(t,e,s){this.fn=()=>{},this.results=[],this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.repeatEachIndex=0,this.resultsMap=new Map,this.id=t,this.title=e,this.location=s}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){var s,i;const t=[...this.results];for(;((s=t[0])==null?void 0:s.status)==="skipped"||((i=t[0])==null?void 0:i.status)==="interrupted";)t.shift();if(!t.length)return"skipped";const e=t.filter(r=>r.status!=="skipped"&&r.status!=="interrupted"&&r.status!==this.expectedStatus);return e.length?e.length===t.length?"unexpected":"flaky":"expected"}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_clearResults(){this.results=[],this.resultsMap.clear()}_createTestResult(t){const e=new $t(this.results.length);return this.results.push(e),this.resultsMap.set(t,e),e}}class Ht{constructor(t,e,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}class $t{constructor(t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this.stepMap=new Map,this.statusEx="scheduled",this._startTime=0,this.retry=t}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const bt={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[{}.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function G(n){return n.map(t=>t.s?t.s:new RegExp(t.r.source,t.r.flags))}const qt=({source:n})=>{const[t,e]=Mt(),[s,i]=K.useState(Bt()),[r]=K.useState(Nt(()=>import("./assets/xtermModule-443332e6.js"),["./assets/xtermModule-443332e6.js","./xtermModule.6428296b.css"],import.meta.url).then(c=>c.default)),o=K.useRef(null);return K.useEffect(()=>(Rt(i),()=>Pt(i)),[]),K.useEffect(()=>{const c=n.write,a=n.clear;return(async()=>{const{Terminal:p,FitAddon:d}=await r,b=e.current;if(!b)return;const g=s==="dark-mode"?Xt:Yt;if(o.current&&o.current.terminal.options.theme===g)return;o.current&&(b.textContent="");const l=new p({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:g}),m=new d;l.loadAddon(m);for(const v of n.pending)l.write(v);n.write=v=>{n.pending.push(v),l.write(v)},n.clear=()=>{n.pending=[],l.clear()},l.open(b),m.fit(),o.current={terminal:l,fitAddon:m}})(),()=>{n.clear=a,n.write=c}},[r,o,e,n,s]),K.useEffect(()=>{setTimeout(()=>{o.current&&(o.current.fitAddon.fit(),n.resize(o.current.terminal.cols,o.current.terminal.rows))},250)},[t,n]),h("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},Yt={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},Xt={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"};const Jt=({title:n,children:t,setExpanded:e,expanded:s,expandOnTitleClick:i})=>_("div",{className:"expandable"+(s?" expanded":""),children:[_("div",{className:"expandable-title",onClick:()=>i&&e(!s),children:[h("div",{className:"codicon codicon-"+(s?"chevron-down":"chevron-right"),style:{cursor:"pointer",color:"var(--vscode-foreground)",marginLeft:"5px"},onClick:()=>!i&&e(!s)}),n]}),s&&h("div",{style:{marginLeft:25},children:t})]});function Qt(n){return`.playwright-artifacts-${n}`}let at=()=>{},_t=n=>{},St={cols:80,rows:24},O=async()=>{};const A={pending:[],clear:()=>{},write:n=>A.pending.push(n),resize:(n,t)=>{St={cols:n,rows:t},Y("resizeTerminal",{cols:n,rows:t})}},Zt=({})=>{var dt;const[n,t]=f.useState(""),[e,s]=f.useState(!1),[i,r]=f.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[o,c]=f.useState(new Map),[a,p]=f.useState({config:void 0,rootSuite:void 0,loadErrors:[]}),[d,b]=f.useState(),[g,l]=f.useState({}),[m,v]=f.useState(new Set),[E,N]=f.useState(!1),[S,D]=f.useState(),[R,J]=Dt("watch-all",!1),[st,z]=f.useState({value:new Set}),u=f.useRef(Promise.resolve()),k=f.useRef(new Set),[w,T]=f.useState(0),[C,y]=f.useState(!1),[Q,ut]=f.useState(!0),Et=f.useRef(null),it=f.useCallback(()=>{N(!0),z({value:new Set}),at(bt,new j("","root"),[],void 0),Tt(!0).then(async()=>{N(!1);const{hasBrowsers:x}=await O("checkBrowsers");ut(x)})},[]);f.useEffect(()=>{var x;(x=Et.current)==null||x.focus(),N(!0),Lt({onEvent:ie,onClose:()=>y(!0)}).then(M=>{O=async(L,F)=>{const P=window.__logForTest;P==null||P({method:L,params:F}),await M(L,F)},it()})},[it]),at=f.useCallback((x,M,L,F)=>{const P=x.configFile?vt.getObject(x.configFile+":projects",void 0):void 0;for(const I of o.keys())M.suites.find(Z=>Z.title===I)||o.delete(I);for(const I of M.suites)o.has(I.title)||o.set(I.title,!!(P!=null&&P.includes(I.title)));!P&&o.size&&![...o.values()].includes(!0)&&o.set(o.entries().next().value[0],!0),p({config:x,rootSuite:M,loadErrors:L}),c(new Map(o)),S&&F?b(F):F||b(void 0)},[o,S]);const nt=f.useCallback((x,M)=>{x==="bounce-if-busy"&&S||(k.current=new Set([...k.current,...M]),u.current=u.current.then(async()=>{var P,I,Z;const L=k.current;if(k.current=new Set,!L.size)return;{for(const W of((P=a.rootSuite)==null?void 0:P.allTests())||[])L.has(W.id)&&(W._clearResults(),W._createTestResult("pending"));p({...a})}const F=" ["+new Date().toLocaleTimeString()+"]";A.write("\x1B[2m—".repeat(Math.max(0,St.cols-F.length))+F+"\x1B[22m"),b({total:0,passed:0,failed:0,skipped:0}),D({testIds:L}),await O("run",{testIds:[...L],projects:[...o].filter(([W,yt])=>yt).map(([W])=>W)});for(const W of((I=a.rootSuite)==null?void 0:I.allTests())||[])((Z=W.results[0])==null?void 0:Z.duration)===-1&&W._clearResults();p({...a}),D(void 0)}))},[o,S,a]),V=!!S,ot=f.useRef(null),Ct=f.useCallback(x=>{var M;x.preventDefault(),x.stopPropagation(),(M=ot.current)==null||M.showModal()},[]),rt=f.useCallback(x=>{var M;x.preventDefault(),x.stopPropagation(),(M=ot.current)==null||M.close()},[]),xt=f.useCallback(x=>{rt(x),s(!0),O("installBrowsers").then(async()=>{s(!1);const{hasBrowsers:M}=await O("checkBrowsers");ut(M)})},[rt]);return _("div",{className:"vbox ui-mode",children:[!Q&&_("dialog",{ref:ot,children:[_("div",{className:"title",children:[h("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),_("div",{className:"body",children:["Playwright did not find installed browsers.",h("br",{}),"Would you like to run `playwright install`?",h("br",{}),h("button",{className:"button",onClick:xt,children:"Install"}),h("button",{className:"button secondary",onClick:rt,children:"Dismiss"})]})]}),C&&_("div",{className:"disconnected",children:[h("div",{className:"title",children:"UI Mode disconnected"}),_("div",{children:[h("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),_(Ft,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",children:[_("div",{className:"vbox",children:[_("div",{className:"vbox"+(e?"":" hidden"),children:[_(tt,{children:[h("div",{className:"section-title",style:{flex:"none"},children:"Output"}),h(B,{icon:"circle-slash",title:"Clear output",onClick:()=>A.clear()}),h("div",{className:"spacer"}),h(B,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),h(qt,{source:A})]}),h("div",{className:"vbox"+(e?" hidden":""),children:h(se,{item:g,rootDir:(dt=a.config)==null?void 0:dt.rootDir})})]}),_("div",{className:"vbox ui-mode-sidebar",children:[_(tt,{noShadow:!0,noMinHeight:!0,children:[h("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),h("div",{className:"section-title",children:"Playwright"}),h(B,{icon:"color-mode",title:"Toggle color mode",onClick:()=>It()}),h(B,{icon:"refresh",title:"Reload",onClick:()=>it(),disabled:V||E}),h(B,{icon:"terminal",title:"Toggle output",toggled:e,onClick:()=>{s(!e)}}),!Q&&h(B,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Ct})]}),h(Gt,{filterText:n,setFilterText:t,statusFilters:i,setStatusFilters:r,projectFilters:o,setProjectFilters:c,testModel:a,runTests:()=>nt("bounce-if-busy",m)}),_(tt,{noMinHeight:!0,children:[!V&&!d&&h("div",{className:"section-title",children:"Tests"}),!V&&d&&h("div",{"data-testid":"status-line",className:"status-line",children:_("div",{children:[d.passed,"/",d.total," passed (",d.passed/d.total*100|0,"%)"]})}),V&&d&&h("div",{"data-testid":"status-line",className:"status-line",children:_("div",{children:["Running ",d.passed,"/",S.testIds.size," passed (",d.passed/S.testIds.size*100|0,"%)"]})}),h(B,{icon:"play",title:"Run all",onClick:()=>nt("bounce-if-busy",m),disabled:V||E}),h(B,{icon:"debug-stop",title:"Stop",onClick:()=>Y("stop"),disabled:!V||E}),h(B,{icon:"eye",title:"Watch all",toggled:R,onClick:()=>{z({value:new Set}),J(!R)}}),h(B,{icon:"collapse-all",title:"Collapse all",onClick:()=>{T(w+1)}})]}),h(ee,{statusFilters:i,projectFilters:o,filterText:n,testModel:a,runningState:S,runTests:nt,onItemSelected:l,setVisibleTestIds:v,watchAll:R,watchedTreeIds:st,setWatchedTreeIds:z,isLoading:E,requestedCollapseAllCount:w})]})]})]})},Gt=({filterText:n,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:i,setProjectFilters:r,testModel:o,runTests:c})=>{const[a,p]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{var l;(l=d.current)==null||l.focus()},[]);const b=[...e.entries()].filter(([l,m])=>m).map(([l])=>l).join(" ")||"all",g=[...i.entries()].filter(([l,m])=>m).map(([l])=>l).join(" ")||"all";return _("div",{className:"filters",children:[h(Jt,{expanded:a,setExpanded:p,title:h("input",{ref:d,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:n,onChange:l=>{t(l.target.value)},onKeyDown:l=>{l.key==="Enter"&&c()}})}),_("div",{className:"filter-summary",title:"Status: "+b+`
|
|
2
|
+
Projects: `+g,onClick:()=>p(!a),children:[h("span",{className:"filter-label",children:"Status:"})," ",b,h("span",{className:"filter-label",children:"Projects:"})," ",g]}),a&&_("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[h("div",{className:"filter-list",children:[...e.entries()].map(([l,m])=>h("div",{className:"filter-entry",children:_("label",{children:[h("input",{type:"checkbox",checked:m,onClick:()=>{const v=new Map(e);v.set(l,!v.get(l)),s(v)}}),h("div",{children:l})]})}))}),h("div",{className:"filter-list",children:[...i.entries()].map(([l,m])=>h("div",{className:"filter-entry",children:_("label",{children:[h("input",{type:"checkbox",checked:m,onClick:()=>{var N;const v=new Map(i);v.set(l,!v.get(l)),r(v);const E=(N=o==null?void 0:o.config)==null?void 0:N.configFile;E&&vt.setObject(E+":projects",[...v.entries()].filter(([S,D])=>D).map(([S])=>S))}}),h("div",{children:l||"untitled"})]})}))})]})]})},te=zt,ee=({statusFilters:n,projectFilters:t,filterText:e,testModel:s,runTests:i,runningState:r,watchAll:o,watchedTreeIds:c,setWatchedTreeIds:a,isLoading:p,onItemSelected:d,setVisibleTestIds:b,requestedCollapseAllCount:g})=>{const[l,m]=f.useState({expandedItems:new Map}),[v,E]=f.useState(),[N,S]=f.useState(g),{rootItem:D,treeItemMap:R,fileNames:J}=f.useMemo(()=>{let u=re(s.rootSuite,s.loadErrors,t);le(u,e,n,r==null?void 0:r.testIds),kt(u),u=ae(u),ce(u);const k=new Map,w=new Set,T=new Set,C=y=>{y.kind==="group"&&y.location.file&&T.add(y.location.file),y.kind==="case"&&y.tests.forEach(Q=>w.add(Q.id)),y.children.forEach(C),k.set(y.id,y)};return C(u),b(w),{rootItem:u,treeItemMap:k,fileNames:T}},[e,s,n,t,b,r]);f.useEffect(()=>{if(N!==g){l.expandedItems.clear();for(const w of R.keys())l.expandedItems.set(w,!1);S(g),E(void 0),m({...l});return}if(!r||r.itemSelectedByUser)return;let u;const k=w=>{var T;w.children.forEach(k),!u&&w.status==="failed"&&(w.kind==="test"&&r.testIds.has(w.test.id)||w.kind==="case"&&r.testIds.has((T=w.tests[0])==null?void 0:T.id))&&(u=w)};k(D),u&&E(u.id)},[r,E,D,N,S,g,l,m,R]);const{selectedTreeItem:st}=f.useMemo(()=>{const u=v?R.get(v):void 0;let k;u&&(k={file:u.location.file,line:u.location.line,source:{errors:s.loadErrors.filter(T=>{var C;return((C=T.location)==null?void 0:C.file)===u.location.file}).map(T=>({line:T.location.line,message:T.message})),content:void 0}});let w;return(u==null?void 0:u.kind)==="test"?w=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(w=u.tests[0]),d({treeItem:u,testCase:w,testFile:k}),{selectedTreeItem:u}},[d,v,s,R]);f.useEffect(()=>{if(!p)if(o)Y("watch",{fileNames:[...J]});else{const u=new Set;for(const k of c.value){const w=R.get(k),T=w==null?void 0:w.location.file;T&&u.add(T)}Y("watch",{fileNames:[...u]})}},[p,D,J,o,c,R]);const z=u=>{E(u.id),i("bounce-if-busy",lt(u))};return _t=u=>{const k=[],w=new Set(u);if(o){const T=C=>{const y=C.location.file;y&&w.has(y)&&k.push(...lt(C)),C.kind==="group"&&C.subKind==="folder"&&C.children.forEach(T)};T(D)}else for(const T of c.value){const C=R.get(T),y=C==null?void 0:C.location.file;y&&w.has(y)&&k.push(...lt(C))}i("queue-if-busy",new Set(k))},h(te,{name:"tests",treeState:l,setTreeState:m,rootItem:D,dataTestId:"test-tree",render:u=>_("div",{className:"hbox ui-mode-list-item",children:[h("div",{className:"ui-mode-list-item-title",title:u.title,children:u.title}),!!u.duration&&u.status!=="skipped"&&h("div",{className:"ui-mode-list-item-time",children:Wt(u.duration)}),_(tt,{noMinHeight:!0,noShadow:!0,children:[h(B,{icon:"play",title:"Run",onClick:()=>z(u),disabled:!!r}),h(B,{icon:"go-to-file",title:"Open in VS Code",onClick:()=>Y("open",{location:oe(u)}),style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!o&&h(B,{icon:"eye",title:"Watch",onClick:()=>{c.value.has(u.id)?c.value.delete(u.id):c.value.add(u.id),a({...c})},toggled:c.value.has(u.id)})]})]}),icon:u=>Ot(u.status),selectedItem:st,onAccepted:z,onSelected:u=>{r&&(r.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:e?5:1,noItemsMessage:p?"Loading…":"No tests"})},se=({item:n,rootDir:t})=>{var g;const[e,s]=f.useState(),[i,r]=f.useState(0),o=f.useRef(null),{outputDir:c}=f.useMemo(()=>({outputDir:n.testCase?ne(n.testCase):void 0}),[n]),[a,p]=f.useState(),d=f.useCallback(l=>p(ht(l)),[p]),b=a?e==null?void 0:e.model.actions.find(l=>ht(l)===a):void 0;return f.useEffect(()=>{var E,N;o.current&&clearTimeout(o.current);const l=(E=n.testCase)==null?void 0:E.results[0];if(!l){s(void 0);return}const m=l&&l.duration>=0&&l.attachments.find(S=>S.name==="trace");if(m&&m.path){wt(m.path).then(S=>s({model:S,isLive:!1}));return}if(!c){s(void 0);return}const v=`${c}/${Qt(l.workerIndex)}/traces/${(N=n.testCase)==null?void 0:N.id}.json`;return o.current=setTimeout(async()=>{try{const S=await wt(v);s({model:S,isLive:!0})}catch{s(void 0)}finally{r(i+1)}},500),()=>{o.current&&clearTimeout(o.current)}},[c,n,s,i,r]),h(jt,{model:e==null?void 0:e.model,hideStackFrames:!0,showSourcesFirst:!0,rootDir:t,initialSelection:b,onSelectionChanged:d,fallbackLocation:n.testFile,isLive:e==null?void 0:e.isLive,status:(g=n.treeItem)==null?void 0:g.status},"workbench")};let $,q,gt,et,H;const mt=()=>{clearTimeout(et),et=void 0,at(H.config,H.rootSuite,H.loadErrors,H.progress)},U=(n,t,e,s,i=!1)=>{H={config:n,rootSuite:t,loadErrors:e,progress:s},i?mt():et||(et=setTimeout(mt,250))},Tt=n=>{if(!n)return O("list",{});let t;const e=[],s={total:0,passed:0,failed:0,skipped:0};let i;return $=new pt(X,{version:()=>"v2",onConfigure:r=>{i=r,q=new pt(X,{onBegin:o=>{gt=o.allTests().length,q=void 0}},!1)},onBegin:r=>{t||(t=r),s.total=gt,s.passed=0,s.failed=0,s.skipped=0,U(i,t,e,s,!0)},onEnd:()=>{U(i,t,e,s,!0)},onTestBegin:()=>{U(i,t,e,s)},onTestEnd:r=>{r.outcome()==="skipped"?++s.skipped:r.outcome()==="unexpected"?++s.failed:++s.passed,U(i,t,e,s)},onError:r=>{A.write((r.stack||r.value||"")+`
|
|
3
|
+
`),e.push(r),U(i,t??new j("","root"),e,s)},printsToStdio:()=>!1,onStdOut:()=>{},onStdErr:()=>{},onExit:()=>{},onStepBegin:()=>{},onStepEnd:()=>{}},!0),$._setClearPreviousResultsWhenTestBegins(),O("list",{})},Y=(n,t)=>{if(window._overrideProtocolForTest){window._overrideProtocolForTest({method:n,params:t}).catch(()=>{});return}O(n,t).catch(e=>{console.error(e)})},ie=(n,t)=>{var e,s;if(n==="listChanged"){Tt(!1).catch(()=>{});return}if(n==="testFilesChanged"){_t(t.testFileNames);return}if(n==="stdio"){if(t.buffer){const i=atob(t.buffer);A.write(i)}else A.write(t.text);return}(e=q==null?void 0:q.dispatch({method:n,params:t}))==null||e.catch(()=>{}),(s=$==null?void 0:$.dispatch({method:n,params:t}))==null||s.catch(()=>{})},ne=n=>{var t;for(let e=n.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir},oe=n=>{if(n)return n.location.file+":"+n.location.line},lt=n=>{const t=new Set;if(!n)return t;const e=s=>{var i;s.kind==="case"?s.tests.map(r=>r.id).forEach(r=>t.add(r)):s.kind==="test"?t.add(s.id):(i=s.children)==null||i.forEach(e)};return e(n),t};function ct(n,t,e,s){if(t.length===0)return n;const i=t.join(X),r=s.get(i);if(r)return r;const o=ct(n,t.slice(0,t.length-1),!1,s),c={kind:"group",subKind:e?"file":"folder",id:i,title:t[t.length-1],location:{file:i,line:0,column:0},duration:0,parent:o,children:[],status:"none",hasLoadErrors:!1};return o.children.push(c),s.set(i,c),c}function re(n,t,e){const s=[...e.values()].some(Boolean),i={kind:"group",subKind:"folder",id:"root",title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},r=(c,a,p)=>{for(const d of a.suites){const b=d.title||"<anonymous>";let g=p.children.find(l=>l.kind==="group"&&l.title===b);g||(g={kind:"group",subKind:"describe",id:"suite:"+a.titlePath().join("")+""+b,title:b,location:d.location,duration:0,parent:p,children:[],status:"none",hasLoadErrors:!1},p.children.push(g)),r(c,d,g)}for(const d of a.tests){const b=d.title;let g=p.children.find(v=>v.kind!=="group"&&v.title===b);g||(g={kind:"case",id:"test:"+d.titlePath().join(""),title:b,parent:p,children:[],tests:[],location:d.location,duration:0,status:"none"},p.children.push(g));const l=d.results[0];let m="none";(l==null?void 0:l.statusEx)==="scheduled"?m="scheduled":(l==null?void 0:l.statusEx)==="running"?m="running":(l==null?void 0:l.status)==="skipped"?m="skipped":(l==null?void 0:l.status)==="interrupted"?m="none":l&&d.outcome()!=="expected"?m="failed":l&&d.outcome()==="expected"&&(m="passed"),g.tests.push(d),g.children.push({kind:"test",id:d.id,title:c,location:d.location,test:d,parent:g,children:[],status:m,duration:d.results.length?Math.max(0,d.results[0].duration):0,project:c}),g.duration=g.children.reduce((v,E)=>v+E.duration,0)}},o=new Map;for(const c of(n==null?void 0:n.suites)||[])if(!(s&&!e.get(c.title)))for(const a of c.suites){const p=ct(i,a.location.file.split(X),!0,o);r(c.title,a,p)}for(const c of t){if(!c.location)continue;const a=ct(i,c.location.file.split(X),!0,o);a.hasLoadErrors=!0}return i}function le(n,t,e,s){const i=t.trim().toLowerCase().split(" "),r=[...e.values()].some(Boolean),o=a=>{const p=a.tests[0].titlePath().join(" ").toLowerCase();return!i.every(d=>p.includes(d))&&!a.tests.some(d=>s==null?void 0:s.has(d.id))?!1:(a.children=a.children.filter(d=>!r||(s==null?void 0:s.has(d.test.id))||e.get(d.status)),a.tests=a.children.map(d=>d.test),!!a.children.length)},c=a=>{const p=[];for(const d of a.children)d.kind==="case"?o(d)&&p.push(d):(c(d),(d.children.length||d.hasLoadErrors)&&p.push(d));a.children=p};c(n)}function kt(n){for(const o of n.children)kt(o);n.kind==="group"&&n.children.sort((o,c)=>o.location.file.localeCompare(c.location.file)||o.location.line-c.location.line);let t=n.children.length>0,e=n.children.length>0,s=!1,i=!1,r=!1;for(const o of n.children)e=e&&o.status==="skipped",t=t&&(o.status==="passed"||o.status==="skipped"),s=s||o.status==="failed",i=i||o.status==="running",r=r||o.status==="scheduled";i?n.status="running":r?n.status="scheduled":s?n.status="failed":e?n.status="skipped":t&&(n.status="passed")}function ae(n){let t=n;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];return t.location=n.location,t}function ce(n){const t=e=>{e.kind==="case"&&e.children.length===1?e.children=[]:e.children.forEach(t)};t(n)}async function wt(n){const t=new URLSearchParams;t.set("trace",n);const s=await(await fetch(`contexts?${t.toString()}`)).json();return new At(s)}const X=navigator.userAgent.toLowerCase().includes("windows")?"\\":"/";(async()=>{if(Vt(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(n=>setTimeout(n,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
|
|
4
|
+
Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(n=>{navigator.serviceWorker.oncontrollerchange=()=>n()}),setInterval(function(){fetch("ping")},1e4)}Kt.render(h(Zt,{}),document.querySelector("#root"))})();
|