@checkly/playwright-core 1.48.22-beta.1 → 1.48.22
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/clockSource.js +1 -2
- package/lib/generated/consoleApiSource.js +1 -2
- package/lib/generated/injectedScriptSource.js +1 -2
- package/lib/generated/pollingRecorderSource.js +1 -2
- package/lib/generated/utilityScriptSource.js +1 -2
- package/lib/generated/webSocketMockSource.js +1 -2
- package/lib/vite/{traceViewer/assets/codeMirrorModule-xvopPhZ4.js → recorder/assets/codeMirrorModule-d0KhC1qL.js} +1 -1
- package/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +1 -0
- package/lib/vite/recorder/assets/index-BW-aOBcL.css +1 -0
- package/lib/vite/recorder/assets/index-Bxxcmxlu.js +42 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-pBPtArIT.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-tzBrK1V4.js +24 -0
- package/lib/vite/traceViewer/assets/{inspectorTab-wfvwpMHs.js → inspectorTab-BuJ3wAX_.js} +3 -3
- package/lib/vite/traceViewer/assets/{inspectorTab-BPzhNk9r.js → inspectorTab-Soeeuvzv.js} +3 -3
- package/lib/vite/traceViewer/assets/{workbench-DLv_q9ji.js → workbench-DdmJ9AJV.js} +1 -1
- package/lib/vite/traceViewer/assets/{workbench-LKskf2Iy.js → workbench-lypYlf00.js} +1 -1
- package/lib/vite/traceViewer/{embedded.BIubxTi3.js → embedded.BkvOrz5Z.js} +1 -1
- package/lib/vite/traceViewer/{embedded.BXYl5zRv.js → embedded.DInvAijy.js} +1 -1
- package/lib/vite/traceViewer/embedded.html +6 -6
- package/lib/vite/traceViewer/{index.DPD22sZn.js → index.Dha3cgqs.js} +1 -1
- package/lib/vite/traceViewer/{index.DZkJsFod.js → index._Iolt-uE.js} +1 -1
- package/lib/vite/traceViewer/index.html +7 -7
- package/lib/vite/traceViewer/{recorder.BVExlUUk.js → recorder.DNMfnSiu.js} +1 -1
- package/lib/vite/traceViewer/{recorder.BaRuS6Pc.js → recorder.DTSaNaly.js} +1 -1
- package/lib/vite/traceViewer/recorder.html +4 -4
- package/lib/vite/traceViewer/{uiMode.DjTS7tqC.js → uiMode.BM7yhjzl.js} +1 -1
- package/lib/vite/traceViewer/{uiMode.B11wexdJ.js → uiMode.Cr1tvTWS.js} +1 -1
- package/lib/vite/traceViewer/uiMode.html +7 -7
- package/package.json +1 -1
- package/lib/cli/cli.js +0 -61
- package/lib/common/debugLogger.js +0 -90
- package/lib/generated/recorderSource.js +0 -7
- package/lib/server/recorder/codeGenerator.js +0 -154
- package/lib/server/recorder/csharp.js +0 -311
- package/lib/server/recorder/java.js +0 -217
- package/lib/server/recorder/javascript.js +0 -230
- package/lib/server/recorder/jsonl.js +0 -48
- package/lib/server/recorder/language.js +0 -45
- package/lib/server/recorder/python.js +0 -276
- package/lib/server/recorder/recorderActions.js +0 -6
- package/lib/server/recorder/utils.js +0 -46
- package/lib/utils/glob.js +0 -84
- package/lib/utils/mimeType.js +0 -30
- package/lib/vite/recorder/assets/codeMirrorModule--bQcPrZ2.js +0 -16437
- package/lib/vite/recorder/assets/codeMirrorModule-Cy8X9Wtw.css +0 -344
- package/lib/vite/recorder/assets/index-BMeslH8X.js +0 -9946
- package/lib/vite/recorder/assets/index-BjXmTggo.css +0 -2515
- package/lib/vite/traceViewer/assets/codeMirrorModule-75b0ca4f.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-BTYWvxEC.js +0 -16437
- package/lib/vite/traceViewer/assets/codeMirrorModule-CBokkFJ2.js +0 -16431
- package/lib/vite/traceViewer/assets/codeMirrorModule-CNHvVrFd.js +0 -16437
- package/lib/vite/traceViewer/assets/codeMirrorModule-CpGx_S8D.js +0 -16443
- package/lib/vite/traceViewer/assets/codeMirrorModule-DGE2kpkE.js +0 -16443
- package/lib/vite/traceViewer/assets/codeMirrorModule-DblsdhjA.js +0 -16449
- package/lib/vite/traceViewer/assets/codeMirrorModule-DtXZtbmO.js +0 -16437
- package/lib/vite/traceViewer/assets/codeMirrorModule-SomGa-Da.js +0 -16443
- package/lib/vite/traceViewer/assets/codeMirrorModule-c1454a2e.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-c9bb9834.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-cc2329e4.js +0 -15593
- package/lib/vite/traceViewer/assets/codeMirrorModule-d2cc7db0.js +0 -15579
- package/lib/vite/traceViewer/assets/codeMirrorModule-da915a35.js +0 -15586
- package/lib/vite/traceViewer/assets/codeMirrorModule-f03b1a3e.js +0 -15579
- package/lib/vite/traceViewer/assets/codeMirrorModule-f333a775.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-lDjkI8Ax.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-uWDlVSQz.js +0 -15585
- package/lib/vite/traceViewer/assets/codeMirrorModule-yboVpgC0.js +0 -15592
- package/lib/vite/traceViewer/assets/inspectorTab-B4ynvyY9.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-BB2Bm-wy.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-BqBvUFio.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-CHcHvp_a.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-C_OTuI8x.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-DOc4D3cX.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-Dw0Gnh1T.js +0 -17361
- package/lib/vite/traceViewer/assets/inspectorTab-Ywa000c9.js +0 -17361
- package/lib/vite/traceViewer/assets/testServerConnection-D-tXL3sj.js +0 -224
- package/lib/vite/traceViewer/assets/workbench-CROk6Fcc.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-CWtpwfKK.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-CfXOj3eT.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-D9CTkv-4.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-DNolpp3y.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-DUc2iD0P.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-DjoIOtwK.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-M-Dh_RgU.js +0 -1473
- package/lib/vite/traceViewer/assets/workbench-dnZM5a7x.js +0 -1473
- package/lib/vite/traceViewer/assets/wsPort-54626118.js +0 -18361
- package/lib/vite/traceViewer/assets/wsPort-57f274c6.js +0 -18361
- package/lib/vite/traceViewer/assets/wsPort-762c6840.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-85286e61.js +0 -18361
- package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-CAXygIGt.js +0 -18540
- package/lib/vite/traceViewer/assets/wsPort-cc0077b5.js +0 -18542
- package/lib/vite/traceViewer/assets/wsPort-edfeeb7d.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +0 -64
- package/lib/vite/traceViewer/assets/wsPort-peeLnQhT.js +0 -18564
- package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +0 -9
- package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +0 -6410
- package/lib/vite/traceViewer/assets/xtermModule-DZP0glxx.js +0 -5982
- package/lib/vite/traceViewer/assets/xtermModule-_6TC5FYT.js +0 -6529
- package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +0 -1
- package/lib/vite/traceViewer/codeMirrorModule.Cy8X9Wtw.css +0 -344
- package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +0 -344
- package/lib/vite/traceViewer/codeMirrorModule.svF_VrcJ.css +0 -344
- package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
- package/lib/vite/traceViewer/codicon.zGuYmc9o.ttf +0 -0
- package/lib/vite/traceViewer/embedded.6N1v7bZ1.js +0 -106
- package/lib/vite/traceViewer/embedded.BOw0jX78.js +0 -106
- package/lib/vite/traceViewer/embedded.BaqdbLsy.js +0 -106
- package/lib/vite/traceViewer/embedded.CHH7D63q.js +0 -106
- package/lib/vite/traceViewer/embedded.CwwTDBzP.js +0 -106
- package/lib/vite/traceViewer/embedded.DeCrOtlO.js +0 -106
- package/lib/vite/traceViewer/embedded.DjZq4InJ.css +0 -68
- package/lib/vite/traceViewer/embedded.DnD_eIZU.js +0 -106
- package/lib/vite/traceViewer/embedded.i_k4ceMJ.js +0 -106
- package/lib/vite/traceViewer/embedded.ymLJ2mBS.js +0 -106
- package/lib/vite/traceViewer/index.1a1fe659.css +0 -1
- package/lib/vite/traceViewer/index.1b525c1c.js +0 -181
- package/lib/vite/traceViewer/index.55e65778.js +0 -181
- package/lib/vite/traceViewer/index.5mge2rY_.css +0 -124
- package/lib/vite/traceViewer/index.5nqVcfiC.js +0 -180
- package/lib/vite/traceViewer/index.5ooko4n7.js +0 -180
- package/lib/vite/traceViewer/index.76e9f312.css +0 -124
- package/lib/vite/traceViewer/index.Bfh46hDK.js +0 -197
- package/lib/vite/traceViewer/index.Bugo2TbS.js +0 -197
- package/lib/vite/traceViewer/index.BzvnAP7t.js +0 -197
- package/lib/vite/traceViewer/index.C8ZWP1Qw.js +0 -197
- package/lib/vite/traceViewer/index.CM_h9lHr.js +0 -197
- package/lib/vite/traceViewer/index.CY13pBr8.js +0 -197
- package/lib/vite/traceViewer/index.DW2ZzZfL.js +0 -197
- package/lib/vite/traceViewer/index.DblJtEW_.js +0 -197
- package/lib/vite/traceViewer/index.QanXxRUb.css +0 -131
- package/lib/vite/traceViewer/index.UtHmfPiA.js +0 -197
- package/lib/vite/traceViewer/index.a265fbdb.js +0 -2
- package/lib/vite/traceViewer/index.c9f6fa8f.js +0 -2
- package/lib/vite/traceViewer/index.d86e70ca.js +0 -181
- package/lib/vite/traceViewer/index.decad628.js +0 -2
- package/lib/vite/traceViewer/index.e8730524.js +0 -181
- package/lib/vite/traceViewer/index.ed9a3c58.js +0 -2
- package/lib/vite/traceViewer/inspectorTab.DGJWXOSd.css +0 -3145
- package/lib/vite/traceViewer/recorder.3Xfrl_zV.js +0 -551
- package/lib/vite/traceViewer/recorder.B76AH9PE.js +0 -551
- package/lib/vite/traceViewer/recorder.BHq8OXiu.js +0 -551
- package/lib/vite/traceViewer/recorder.BWH6blRw.js +0 -551
- package/lib/vite/traceViewer/recorder.DBDpiNOK.css +0 -15
- package/lib/vite/traceViewer/recorder.Db1aK_DY.js +0 -551
- package/lib/vite/traceViewer/recorder.Fwf59ZKh.js +0 -551
- package/lib/vite/traceViewer/recorder.uj3cfoMf.js +0 -551
- package/lib/vite/traceViewer/recorder.zV_xPHM4.js +0 -551
- 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.3ff70f7d.js +0 -4
- package/lib/vite/traceViewer/uiMode.4d0a45af.js +0 -1484
- package/lib/vite/traceViewer/uiMode.66eb0ce2.js +0 -1484
- package/lib/vite/traceViewer/uiMode.8b41a49d.css +0 -1
- package/lib/vite/traceViewer/uiMode.8d080c01.js +0 -1486
- package/lib/vite/traceViewer/uiMode.BH2Nj2h0.js +0 -1724
- package/lib/vite/traceViewer/uiMode.BKrDfnAk.js +0 -1725
- package/lib/vite/traceViewer/uiMode.BMYUvsRh.js +0 -1725
- package/lib/vite/traceViewer/uiMode.BVpTBGoe.js +0 -1724
- package/lib/vite/traceViewer/uiMode.BWhJCEE9.js +0 -1725
- package/lib/vite/traceViewer/uiMode.Bg9fACTB.js +0 -1725
- package/lib/vite/traceViewer/uiMode.CBRJkC_K.js +0 -1724
- package/lib/vite/traceViewer/uiMode.CYBsUhm_.js +0 -1724
- package/lib/vite/traceViewer/uiMode.DCSdxlAq.js +0 -1724
- package/lib/vite/traceViewer/uiMode.DRmgrHSk.css +0 -1462
- package/lib/vite/traceViewer/uiMode.DtleKuGI.js +0 -1724
- package/lib/vite/traceViewer/uiMode.UamAvOMX.js +0 -1725
- package/lib/vite/traceViewer/uiMode._Kp3dUXk.js +0 -1724
- package/lib/vite/traceViewer/uiMode.bBcXYWNF.js +0 -1725
- package/lib/vite/traceViewer/uiMode.ca6ec898.js +0 -4
- package/lib/vite/traceViewer/uiMode.e-PLonGl.js +0 -1490
- package/lib/vite/traceViewer/uiMode.e_-GuqEi.js +0 -1725
- package/lib/vite/traceViewer/uiMode.f1YADWIl.js +0 -1724
- package/lib/vite/traceViewer/uiMode.kHsXCfV8.js +0 -1490
- package/lib/vite/traceViewer/uiMode.myF_lyEH.js +0 -1724
- package/lib/vite/traceViewer/uiMode.xvJHbkzl.css +0 -1324
- package/lib/vite/traceViewer/workbench.9Es1K_T7.css +0 -549
- package/lib/vite/traceViewer/workbench.BQNDbcQ0.css +0 -550
- package/lib/vite/traceViewer/wsPort.162042f9.css +0 -3450
- package/lib/vite/traceViewer/wsPort.997c92cf.css +0 -3513
- package/lib/vite/traceViewer/wsPort.9c9a6767.css +0 -1
- package/lib/vite/traceViewer/wsPort.p5jUwABW.css +0 -3450
- package/lib/vite/traceViewer/xtermModule.125f4259.css +0 -191
- package/lib/vite/traceViewer/xtermModule.4oRVGWQ-.css +0 -209
- package/lib/vite/traceViewer/xtermModule.6428296b.css +0 -32
- package/lib/vite/traceViewer/xtermModule.OKEVRlkP.css +0 -209
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { j as jsxRuntimeExports, r as reactExports, M as MultiTraceModel, F as sha1, n as asLocator, L as ListView, g as Toolbar, T as ToolbarButton, H as ToolbarSeparator, J as copy, t as toggleTheme, S as SplitView, D as TabbedPane, y as useConsoleTabModel, z as useNetworkTabModel, h as useSetting, A as ConsoleTab, N as NetworkTab, K as collectSnapshots, O as extendSnapshot, Q as SnapshotView, I as InspectorTab, E as SourceTab, a as applyTheme, c as createRoot } from "./assets/inspectorTab-C_OTuI8x.js";
|
|
5
|
-
const SourceChooser = ({ sources, fileId, setFileId }) => {
|
|
6
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("select", { className: "source-chooser", hidden: !sources.length, title: "Source chooser", value: fileId, onChange: (event) => {
|
|
7
|
-
setFileId(event.target.selectedOptions[0].value);
|
|
8
|
-
}, children: renderSourceOptions(sources) });
|
|
9
|
-
};
|
|
10
|
-
function renderSourceOptions(sources) {
|
|
11
|
-
const transformTitle = (title) => title.replace(/.*[/\\]([^/\\]+)/, "$1");
|
|
12
|
-
const renderOption = (source) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: source.id, children: transformTitle(source.label) }, source.id);
|
|
13
|
-
const sourcesByGroups = /* @__PURE__ */ new Map();
|
|
14
|
-
for (const source of sources) {
|
|
15
|
-
let list = sourcesByGroups.get(source.group || "Debugger");
|
|
16
|
-
if (!list) {
|
|
17
|
-
list = [];
|
|
18
|
-
sourcesByGroups.set(source.group || "Debugger", list);
|
|
19
|
-
}
|
|
20
|
-
list.push(source);
|
|
21
|
-
}
|
|
22
|
-
return [...sourcesByGroups.entries()].map(([group, sources2]) => /* @__PURE__ */ jsxRuntimeExports.jsx("optgroup", { label: group, children: sources2.filter((s) => (s.group || "Debugger") === group).map((source) => renderOption(source)) }, group));
|
|
23
|
-
}
|
|
24
|
-
const ModelContext = reactExports.createContext(void 0);
|
|
25
|
-
const ModelProvider = ({ trace, children }) => {
|
|
26
|
-
const [model, setModel] = reactExports.useState();
|
|
27
|
-
const [counter, setCounter] = reactExports.useState(0);
|
|
28
|
-
const pollTimer = reactExports.useRef(null);
|
|
29
|
-
reactExports.useEffect(() => {
|
|
30
|
-
if (pollTimer.current)
|
|
31
|
-
clearTimeout(pollTimer.current);
|
|
32
|
-
pollTimer.current = setTimeout(async () => {
|
|
33
|
-
try {
|
|
34
|
-
const result = await loadSingleTraceFile(trace);
|
|
35
|
-
if (result.sha1 !== (model == null ? void 0 : model.sha1))
|
|
36
|
-
setModel(result);
|
|
37
|
-
} catch {
|
|
38
|
-
setModel(void 0);
|
|
39
|
-
} finally {
|
|
40
|
-
setCounter(counter + 1);
|
|
41
|
-
}
|
|
42
|
-
}, 500);
|
|
43
|
-
return () => {
|
|
44
|
-
if (pollTimer.current)
|
|
45
|
-
clearTimeout(pollTimer.current);
|
|
46
|
-
};
|
|
47
|
-
}, [counter, model, trace]);
|
|
48
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ModelContext.Provider, { value: model == null ? void 0 : model.model, children });
|
|
49
|
-
};
|
|
50
|
-
async function loadSingleTraceFile(url) {
|
|
51
|
-
const params = new URLSearchParams();
|
|
52
|
-
params.set("trace", url);
|
|
53
|
-
params.set("limit", "1");
|
|
54
|
-
const response = await fetch(`contexts?${params.toString()}`);
|
|
55
|
-
const contextEntries = await response.json();
|
|
56
|
-
const tokens = [];
|
|
57
|
-
for (const entry of contextEntries) {
|
|
58
|
-
entry.actions.forEach((a) => tokens.push(a.type + "@" + a.startTime + "-" + a.endTime));
|
|
59
|
-
entry.events.forEach((e) => tokens.push(e.type + "@" + e.time));
|
|
60
|
-
}
|
|
61
|
-
return { model: new MultiTraceModel(contextEntries), sha1: await sha1(tokens.join("|")) };
|
|
62
|
-
}
|
|
63
|
-
function buildFullSelector(framePath, selector) {
|
|
64
|
-
return [...framePath, selector].join(" >> internal:control=enter-frame >> ");
|
|
65
|
-
}
|
|
66
|
-
function traceParamsForAction(actionInContext) {
|
|
67
|
-
const { action } = actionInContext;
|
|
68
|
-
switch (action.name) {
|
|
69
|
-
case "navigate": {
|
|
70
|
-
const params = {
|
|
71
|
-
url: action.url
|
|
72
|
-
};
|
|
73
|
-
return { method: "goto", params };
|
|
74
|
-
}
|
|
75
|
-
case "openPage":
|
|
76
|
-
case "closePage":
|
|
77
|
-
throw new Error("Not reached");
|
|
78
|
-
}
|
|
79
|
-
const selector = buildFullSelector(actionInContext.frame.framePath, action.selector);
|
|
80
|
-
switch (action.name) {
|
|
81
|
-
case "click": {
|
|
82
|
-
const params = {
|
|
83
|
-
selector,
|
|
84
|
-
strict: true,
|
|
85
|
-
modifiers: toKeyboardModifiers(action.modifiers),
|
|
86
|
-
button: action.button,
|
|
87
|
-
clickCount: action.clickCount,
|
|
88
|
-
position: action.position
|
|
89
|
-
};
|
|
90
|
-
return { method: "click", params };
|
|
91
|
-
}
|
|
92
|
-
case "press": {
|
|
93
|
-
const params = {
|
|
94
|
-
selector,
|
|
95
|
-
strict: true,
|
|
96
|
-
key: [...toKeyboardModifiers(action.modifiers), action.key].join("+")
|
|
97
|
-
};
|
|
98
|
-
return { method: "press", params };
|
|
99
|
-
}
|
|
100
|
-
case "fill": {
|
|
101
|
-
const params = {
|
|
102
|
-
selector,
|
|
103
|
-
strict: true,
|
|
104
|
-
value: action.text
|
|
105
|
-
};
|
|
106
|
-
return { method: "fill", params };
|
|
107
|
-
}
|
|
108
|
-
case "setInputFiles": {
|
|
109
|
-
const params = {
|
|
110
|
-
selector,
|
|
111
|
-
strict: true,
|
|
112
|
-
localPaths: action.files
|
|
113
|
-
};
|
|
114
|
-
return { method: "setInputFiles", params };
|
|
115
|
-
}
|
|
116
|
-
case "check": {
|
|
117
|
-
const params = {
|
|
118
|
-
selector,
|
|
119
|
-
strict: true
|
|
120
|
-
};
|
|
121
|
-
return { method: "check", params };
|
|
122
|
-
}
|
|
123
|
-
case "uncheck": {
|
|
124
|
-
const params = {
|
|
125
|
-
selector,
|
|
126
|
-
strict: true
|
|
127
|
-
};
|
|
128
|
-
return { method: "uncheck", params };
|
|
129
|
-
}
|
|
130
|
-
case "select": {
|
|
131
|
-
const params = {
|
|
132
|
-
selector,
|
|
133
|
-
strict: true,
|
|
134
|
-
options: action.options.map((option) => ({ value: option }))
|
|
135
|
-
};
|
|
136
|
-
return { method: "selectOption", params };
|
|
137
|
-
}
|
|
138
|
-
case "assertChecked": {
|
|
139
|
-
const params = {
|
|
140
|
-
selector: action.selector,
|
|
141
|
-
expression: "to.be.checked",
|
|
142
|
-
isNot: !action.checked
|
|
143
|
-
};
|
|
144
|
-
return { method: "expect", params };
|
|
145
|
-
}
|
|
146
|
-
case "assertText": {
|
|
147
|
-
const params = {
|
|
148
|
-
selector,
|
|
149
|
-
expression: "to.have.text",
|
|
150
|
-
expectedText: [],
|
|
151
|
-
isNot: false
|
|
152
|
-
};
|
|
153
|
-
return { method: "expect", params };
|
|
154
|
-
}
|
|
155
|
-
case "assertValue": {
|
|
156
|
-
const params = {
|
|
157
|
-
selector,
|
|
158
|
-
expression: "to.have.value",
|
|
159
|
-
expectedValue: void 0,
|
|
160
|
-
isNot: false
|
|
161
|
-
};
|
|
162
|
-
return { method: "expect", params };
|
|
163
|
-
}
|
|
164
|
-
case "assertVisible": {
|
|
165
|
-
const params = {
|
|
166
|
-
selector,
|
|
167
|
-
expression: "to.be.visible",
|
|
168
|
-
isNot: false
|
|
169
|
-
};
|
|
170
|
-
return { method: "expect", params };
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function toKeyboardModifiers(modifiers) {
|
|
175
|
-
const result = [];
|
|
176
|
-
if (modifiers & 1)
|
|
177
|
-
result.push("Alt");
|
|
178
|
-
if (modifiers & 2)
|
|
179
|
-
result.push("ControlOrMeta");
|
|
180
|
-
if (modifiers & 4)
|
|
181
|
-
result.push("ControlOrMeta");
|
|
182
|
-
if (modifiers & 8)
|
|
183
|
-
result.push("Shift");
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
const ActionList = ListView;
|
|
187
|
-
const ActionListView = ({
|
|
188
|
-
sdkLanguage,
|
|
189
|
-
actions,
|
|
190
|
-
selectedAction,
|
|
191
|
-
onSelectedAction
|
|
192
|
-
}) => {
|
|
193
|
-
const render = reactExports.useCallback((action) => {
|
|
194
|
-
return renderAction(sdkLanguage, action);
|
|
195
|
-
}, [sdkLanguage]);
|
|
196
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vbox", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197
|
-
ActionList,
|
|
198
|
-
{
|
|
199
|
-
name: "actions",
|
|
200
|
-
items: actions,
|
|
201
|
-
selectedItem: selectedAction,
|
|
202
|
-
onSelected: onSelectedAction,
|
|
203
|
-
render
|
|
204
|
-
}
|
|
205
|
-
) });
|
|
206
|
-
};
|
|
207
|
-
const renderAction = (sdkLanguage, action) => {
|
|
208
|
-
const { method, params } = traceParamsForAction(action);
|
|
209
|
-
const locator = params.selector ? asLocator(sdkLanguage || "javascript", params.selector) : void 0;
|
|
210
|
-
const apiName = `page.${method}`;
|
|
211
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "action-title", title: apiName, children: [
|
|
212
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: apiName }),
|
|
213
|
-
locator && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "action-selector", title: locator, children: locator }),
|
|
214
|
-
method === "goto" && params.url && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "action-url", title: params.url, children: params.url })
|
|
215
|
-
] }) });
|
|
216
|
-
};
|
|
217
|
-
const BackendContext = reactExports.createContext(void 0);
|
|
218
|
-
const BackendProvider = ({ guid, children }) => {
|
|
219
|
-
const [connection, setConnection] = reactExports.useState(void 0);
|
|
220
|
-
const [mode, setMode] = reactExports.useState("none");
|
|
221
|
-
const [actions, setActions] = reactExports.useState({ actions: [], sources: [] });
|
|
222
|
-
const callbacks = reactExports.useRef({ setMode, setActions });
|
|
223
|
-
reactExports.useEffect(() => {
|
|
224
|
-
const wsURL = new URL(`../${guid}`, window.location.toString());
|
|
225
|
-
wsURL.protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
226
|
-
const webSocket = new WebSocket(wsURL.toString());
|
|
227
|
-
setConnection(new Connection(webSocket, callbacks.current));
|
|
228
|
-
return () => {
|
|
229
|
-
webSocket.close();
|
|
230
|
-
};
|
|
231
|
-
}, [guid]);
|
|
232
|
-
const backend = reactExports.useMemo(() => {
|
|
233
|
-
return connection ? { mode, actions: actions.actions, sources: actions.sources, connection } : void 0;
|
|
234
|
-
}, [actions, mode, connection]);
|
|
235
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BackendContext.Provider, { value: backend, children });
|
|
236
|
-
};
|
|
237
|
-
class Connection {
|
|
238
|
-
constructor(webSocket, options) {
|
|
239
|
-
__publicField(this, "_lastId", 0);
|
|
240
|
-
__publicField(this, "_webSocket");
|
|
241
|
-
__publicField(this, "_callbacks", /* @__PURE__ */ new Map());
|
|
242
|
-
__publicField(this, "_options");
|
|
243
|
-
this._webSocket = webSocket;
|
|
244
|
-
this._callbacks = /* @__PURE__ */ new Map();
|
|
245
|
-
this._options = options;
|
|
246
|
-
this._webSocket.addEventListener("message", (event) => {
|
|
247
|
-
const message = JSON.parse(event.data);
|
|
248
|
-
const { id, result, error, method, params } = message;
|
|
249
|
-
if (id) {
|
|
250
|
-
const callback = this._callbacks.get(id);
|
|
251
|
-
if (!callback)
|
|
252
|
-
return;
|
|
253
|
-
this._callbacks.delete(id);
|
|
254
|
-
if (error)
|
|
255
|
-
callback.reject(new Error(error));
|
|
256
|
-
else
|
|
257
|
-
callback.resolve(result);
|
|
258
|
-
} else {
|
|
259
|
-
this._dispatchEvent(method, params);
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
setMode(mode) {
|
|
264
|
-
this._sendMessageNoReply("setMode", { mode });
|
|
265
|
-
}
|
|
266
|
-
async _sendMessage(method, params) {
|
|
267
|
-
const id = ++this._lastId;
|
|
268
|
-
const message = { id, method, params };
|
|
269
|
-
this._webSocket.send(JSON.stringify(message));
|
|
270
|
-
return new Promise((resolve, reject) => {
|
|
271
|
-
this._callbacks.set(id, { resolve, reject });
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
_sendMessageNoReply(method, params) {
|
|
275
|
-
this._sendMessage(method, params).catch(() => {
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
_dispatchEvent(method, params) {
|
|
279
|
-
if (method === "setMode") {
|
|
280
|
-
const { mode } = params;
|
|
281
|
-
this._options.setMode(mode);
|
|
282
|
-
}
|
|
283
|
-
if (method === "setActions") {
|
|
284
|
-
const { actions, sources } = params;
|
|
285
|
-
this._options.setActions({ actions: actions.filter((a) => a.action.name !== "openPage" && a.action.name !== "closePage"), sources });
|
|
286
|
-
window.playwrightSourcesEchoForTest = sources;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
const RecorderView = () => {
|
|
291
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
292
|
-
const guid = searchParams.get("ws");
|
|
293
|
-
const trace = searchParams.get("trace") + ".json";
|
|
294
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(BackendProvider, { guid, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProvider, { trace, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Workbench, {}) }) });
|
|
295
|
-
};
|
|
296
|
-
const Workbench = () => {
|
|
297
|
-
const backend = reactExports.useContext(BackendContext);
|
|
298
|
-
const model = reactExports.useContext(ModelContext);
|
|
299
|
-
const [fileId, setFileId] = reactExports.useState();
|
|
300
|
-
const [selectedStartTime, setSelectedStartTime] = reactExports.useState(void 0);
|
|
301
|
-
const [isInspecting, setIsInspecting] = reactExports.useState(false);
|
|
302
|
-
const [highlightedLocatorInProperties, setHighlightedLocatorInProperties] = reactExports.useState("");
|
|
303
|
-
const [highlightedLocatorInTrace, setHighlightedLocatorInTrace] = reactExports.useState("");
|
|
304
|
-
const [traceCallId, setTraceCallId] = reactExports.useState();
|
|
305
|
-
const setSelectedAction = reactExports.useCallback((action) => {
|
|
306
|
-
setSelectedStartTime(action == null ? void 0 : action.startTime);
|
|
307
|
-
}, []);
|
|
308
|
-
const selectedAction = reactExports.useMemo(() => {
|
|
309
|
-
return backend == null ? void 0 : backend.actions.find((a) => a.startTime === selectedStartTime);
|
|
310
|
-
}, [backend == null ? void 0 : backend.actions, selectedStartTime]);
|
|
311
|
-
reactExports.useEffect(() => {
|
|
312
|
-
var _a;
|
|
313
|
-
const callId = (_a = model == null ? void 0 : model.actions.find((a) => a.endTime && a.endTime === (selectedAction == null ? void 0 : selectedAction.endTime))) == null ? void 0 : _a.callId;
|
|
314
|
-
if (callId)
|
|
315
|
-
setTraceCallId(callId);
|
|
316
|
-
}, [model, selectedAction]);
|
|
317
|
-
const source = reactExports.useMemo(() => (backend == null ? void 0 : backend.sources.find((s) => s.id === fileId)) || (backend == null ? void 0 : backend.sources[0]), [backend == null ? void 0 : backend.sources, fileId]);
|
|
318
|
-
const sourceLocation = reactExports.useMemo(() => {
|
|
319
|
-
if (!source)
|
|
320
|
-
return void 0;
|
|
321
|
-
const sourceLocation2 = {
|
|
322
|
-
file: "",
|
|
323
|
-
line: 0,
|
|
324
|
-
column: 0,
|
|
325
|
-
source: {
|
|
326
|
-
errors: [],
|
|
327
|
-
content: source.text
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
return sourceLocation2;
|
|
331
|
-
}, [source]);
|
|
332
|
-
const sdkLanguage = (source == null ? void 0 : source.language) || "javascript";
|
|
333
|
-
const { boundaries } = reactExports.useMemo(() => {
|
|
334
|
-
const boundaries2 = { minimum: (model == null ? void 0 : model.startTime) || 0, maximum: (model == null ? void 0 : model.endTime) || 3e4 };
|
|
335
|
-
if (boundaries2.minimum > boundaries2.maximum) {
|
|
336
|
-
boundaries2.minimum = 0;
|
|
337
|
-
boundaries2.maximum = 3e4;
|
|
338
|
-
}
|
|
339
|
-
boundaries2.maximum += (boundaries2.maximum - boundaries2.minimum) / 20;
|
|
340
|
-
return { boundaries: boundaries2 };
|
|
341
|
-
}, [model]);
|
|
342
|
-
const locatorPickedInTrace = reactExports.useCallback((locator) => {
|
|
343
|
-
setHighlightedLocatorInProperties(locator);
|
|
344
|
-
setHighlightedLocatorInTrace("");
|
|
345
|
-
setIsInspecting(false);
|
|
346
|
-
}, []);
|
|
347
|
-
const locatorTypedInProperties = reactExports.useCallback((locator) => {
|
|
348
|
-
setHighlightedLocatorInTrace(locator);
|
|
349
|
-
setHighlightedLocatorInProperties(locator);
|
|
350
|
-
}, []);
|
|
351
|
-
const actionList = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
352
|
-
ActionListView,
|
|
353
|
-
{
|
|
354
|
-
sdkLanguage,
|
|
355
|
-
actions: (backend == null ? void 0 : backend.actions) || [],
|
|
356
|
-
selectedAction,
|
|
357
|
-
onSelectedAction: setSelectedAction
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
const actionsTab = {
|
|
361
|
-
id: "actions",
|
|
362
|
-
title: "Actions",
|
|
363
|
-
component: actionList
|
|
364
|
-
};
|
|
365
|
-
const toolbar = /* @__PURE__ */ jsxRuntimeExports.jsxs(Toolbar, { sidebarBackground: true, children: [
|
|
366
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: 4 } }),
|
|
367
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "inspect", title: "Pick locator", toggled: isInspecting, onClick: () => {
|
|
368
|
-
setIsInspecting(!isInspecting);
|
|
369
|
-
} }),
|
|
370
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "eye", title: "Assert visibility", onClick: () => {
|
|
371
|
-
} }),
|
|
372
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "whole-word", title: "Assert text", onClick: () => {
|
|
373
|
-
} }),
|
|
374
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "symbol-constant", title: "Assert value", onClick: () => {
|
|
375
|
-
} }),
|
|
376
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarSeparator, {}),
|
|
377
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "files", title: "Copy", disabled: !source || !source.text, onClick: () => {
|
|
378
|
-
if (source == null ? void 0 : source.text)
|
|
379
|
-
copy(source.text);
|
|
380
|
-
} }),
|
|
381
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { flex: "auto" } }),
|
|
382
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Target:" }),
|
|
383
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SourceChooser, { fileId, sources: (backend == null ? void 0 : backend.sources) || [], setFileId: (fileId2) => {
|
|
384
|
-
setFileId(fileId2);
|
|
385
|
-
} }),
|
|
386
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ToolbarButton, { icon: "color-mode", title: "Toggle color mode", toggled: false, onClick: () => toggleTheme() })
|
|
387
|
-
] });
|
|
388
|
-
const sidebarTabbedPane = /* @__PURE__ */ jsxRuntimeExports.jsx(TabbedPane, { tabs: [actionsTab] });
|
|
389
|
-
const traceView = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
390
|
-
TraceView,
|
|
391
|
-
{
|
|
392
|
-
sdkLanguage,
|
|
393
|
-
callId: traceCallId,
|
|
394
|
-
isInspecting,
|
|
395
|
-
setIsInspecting,
|
|
396
|
-
highlightedLocator: highlightedLocatorInTrace,
|
|
397
|
-
setHighlightedLocator: locatorPickedInTrace
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
const propertiesView = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
401
|
-
PropertiesView,
|
|
402
|
-
{
|
|
403
|
-
sdkLanguage,
|
|
404
|
-
boundaries,
|
|
405
|
-
setIsInspecting,
|
|
406
|
-
highlightedLocator: highlightedLocatorInProperties,
|
|
407
|
-
setHighlightedLocator: locatorTypedInProperties,
|
|
408
|
-
sourceLocation
|
|
409
|
-
}
|
|
410
|
-
);
|
|
411
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vbox workbench", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
412
|
-
SplitView,
|
|
413
|
-
{
|
|
414
|
-
sidebarSize: 250,
|
|
415
|
-
orientation: "horizontal",
|
|
416
|
-
settingName: "recorderActionListSidebar",
|
|
417
|
-
sidebarIsFirst: true,
|
|
418
|
-
main: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
419
|
-
SplitView,
|
|
420
|
-
{
|
|
421
|
-
sidebarSize: 250,
|
|
422
|
-
orientation: "vertical",
|
|
423
|
-
settingName: "recorderPropertiesSidebar",
|
|
424
|
-
main: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vbox", children: [
|
|
425
|
-
toolbar,
|
|
426
|
-
traceView
|
|
427
|
-
] }),
|
|
428
|
-
sidebar: propertiesView
|
|
429
|
-
}
|
|
430
|
-
),
|
|
431
|
-
sidebar: sidebarTabbedPane
|
|
432
|
-
}
|
|
433
|
-
) });
|
|
434
|
-
};
|
|
435
|
-
const PropertiesView = ({
|
|
436
|
-
sdkLanguage,
|
|
437
|
-
boundaries,
|
|
438
|
-
setIsInspecting,
|
|
439
|
-
highlightedLocator,
|
|
440
|
-
setHighlightedLocator,
|
|
441
|
-
sourceLocation
|
|
442
|
-
}) => {
|
|
443
|
-
const model = reactExports.useContext(ModelContext);
|
|
444
|
-
const consoleModel = useConsoleTabModel(model, boundaries);
|
|
445
|
-
const networkModel = useNetworkTabModel(model, boundaries);
|
|
446
|
-
const sourceModel = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
447
|
-
const [selectedPropertiesTab, setSelectedPropertiesTab] = useSetting("recorderPropertiesTab", "source");
|
|
448
|
-
const inspectorTab = {
|
|
449
|
-
id: "inspector",
|
|
450
|
-
title: "Locator",
|
|
451
|
-
render: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
452
|
-
InspectorTab,
|
|
453
|
-
{
|
|
454
|
-
showScreenshot: false,
|
|
455
|
-
sdkLanguage,
|
|
456
|
-
setIsInspecting,
|
|
457
|
-
highlightedLocator,
|
|
458
|
-
setHighlightedLocator
|
|
459
|
-
}
|
|
460
|
-
)
|
|
461
|
-
};
|
|
462
|
-
const sourceTab = {
|
|
463
|
-
id: "source",
|
|
464
|
-
title: "Source",
|
|
465
|
-
render: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
466
|
-
SourceTab,
|
|
467
|
-
{
|
|
468
|
-
sources: sourceModel.current,
|
|
469
|
-
stackFrameLocation: "right",
|
|
470
|
-
fallbackLocation: sourceLocation
|
|
471
|
-
}
|
|
472
|
-
)
|
|
473
|
-
};
|
|
474
|
-
const consoleTab = {
|
|
475
|
-
id: "console",
|
|
476
|
-
title: "Console",
|
|
477
|
-
count: consoleModel.entries.length,
|
|
478
|
-
render: () => /* @__PURE__ */ jsxRuntimeExports.jsx(ConsoleTab, { boundaries, consoleModel })
|
|
479
|
-
};
|
|
480
|
-
const networkTab = {
|
|
481
|
-
id: "network",
|
|
482
|
-
title: "Network",
|
|
483
|
-
count: networkModel.resources.length,
|
|
484
|
-
render: () => /* @__PURE__ */ jsxRuntimeExports.jsx(NetworkTab, { boundaries, networkModel })
|
|
485
|
-
};
|
|
486
|
-
const tabs = [
|
|
487
|
-
sourceTab,
|
|
488
|
-
inspectorTab,
|
|
489
|
-
consoleTab,
|
|
490
|
-
networkTab
|
|
491
|
-
];
|
|
492
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
493
|
-
TabbedPane,
|
|
494
|
-
{
|
|
495
|
-
tabs,
|
|
496
|
-
selectedTab: selectedPropertiesTab,
|
|
497
|
-
setSelectedTab: setSelectedPropertiesTab
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
|
-
};
|
|
501
|
-
const TraceView = ({
|
|
502
|
-
sdkLanguage,
|
|
503
|
-
callId,
|
|
504
|
-
isInspecting,
|
|
505
|
-
setIsInspecting,
|
|
506
|
-
highlightedLocator,
|
|
507
|
-
setHighlightedLocator
|
|
508
|
-
}) => {
|
|
509
|
-
const model = reactExports.useContext(ModelContext);
|
|
510
|
-
const action = reactExports.useMemo(() => {
|
|
511
|
-
return model == null ? void 0 : model.actions.find((a) => a.callId === callId);
|
|
512
|
-
}, [model, callId]);
|
|
513
|
-
const snapshot = reactExports.useMemo(() => {
|
|
514
|
-
const snapshot2 = collectSnapshots(action);
|
|
515
|
-
return snapshot2.action || snapshot2.after || snapshot2.before;
|
|
516
|
-
}, [action]);
|
|
517
|
-
const snapshotUrls = reactExports.useMemo(() => {
|
|
518
|
-
return snapshot ? extendSnapshot(snapshot) : void 0;
|
|
519
|
-
}, [snapshot]);
|
|
520
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
521
|
-
SnapshotView,
|
|
522
|
-
{
|
|
523
|
-
sdkLanguage,
|
|
524
|
-
testIdAttributeName: "data-testid",
|
|
525
|
-
isInspecting,
|
|
526
|
-
setIsInspecting,
|
|
527
|
-
highlightedLocator,
|
|
528
|
-
setHighlightedLocator,
|
|
529
|
-
snapshotUrls
|
|
530
|
-
}
|
|
531
|
-
);
|
|
532
|
-
};
|
|
533
|
-
(async () => {
|
|
534
|
-
applyTheme();
|
|
535
|
-
if (window.location.protocol !== "file:") {
|
|
536
|
-
if (!navigator.serviceWorker)
|
|
537
|
-
throw new Error(`Service workers are not supported.
|
|
538
|
-
Make sure to serve the Recorder (${window.location}) via HTTPS or localhost.`);
|
|
539
|
-
navigator.serviceWorker.register("sw.bundle.js");
|
|
540
|
-
if (!navigator.serviceWorker.controller) {
|
|
541
|
-
await new Promise((f) => {
|
|
542
|
-
navigator.serviceWorker.oncontrollerchange = () => f();
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
setInterval(function() {
|
|
546
|
-
fetch("ping");
|
|
547
|
-
}, 1e4);
|
|
548
|
-
}
|
|
549
|
-
createRoot(document.querySelector("#root")).render(/* @__PURE__ */ jsxRuntimeExports.jsx(RecorderView, {}));
|
|
550
|
-
})();
|
|
551
|
-
//# sourceMappingURL=recorder.zV_xPHM4.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
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"))})();
|