@checkly/playwright-core 1.51.15-beta.1 → 1.51.16-beta.0
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/secretsFilter.js +33 -6
- package/lib/generated/clockSource.js +2 -1
- package/lib/generated/consoleApiSource.js +2 -1
- package/lib/generated/injectedScriptSource.js +2 -1
- package/lib/generated/pollingRecorderSource.js +2 -1
- package/lib/generated/utilityScriptSource.js +2 -1
- package/lib/generated/webSocketMockSource.js +2 -1
- package/lib/vite/recorder/assets/codeMirrorModule-DrMbgOIo.js +16684 -0
- package/lib/vite/recorder/assets/codeMirrorModule-DuST8d_k.css +344 -0
- package/lib/vite/recorder/assets/index-5NM3V7eb.css +2524 -0
- package/lib/vite/recorder/assets/index-CT-scFHn.js +16848 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-CB-2okZ8.js +16684 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-CBiB4avC.js +217 -0
- package/lib/vite/traceViewer/assets/inspectorTab-CwgfffWb.js +25143 -0
- package/lib/vite/traceViewer/assets/workbench-CWZselvp.js +2470 -0
- package/lib/vite/traceViewer/assets/xtermModule-Es_gt_u7.js +5994 -0
- package/lib/vite/traceViewer/codeMirrorModule.DuST8d_k.css +344 -0
- package/lib/vite/traceViewer/defaultSettingsView.Dp3b_92q.css +41 -0
- package/lib/vite/traceViewer/embedded.BeldSa2G.css +68 -0
- package/lib/vite/traceViewer/embedded.gzudoghF.js +106 -0
- package/lib/vite/traceViewer/embedded.html +6 -6
- package/lib/vite/traceViewer/index.DilotR1h.js +314 -0
- package/lib/vite/traceViewer/index.QewjJ85u.css +131 -0
- package/lib/vite/traceViewer/index.html +8 -8
- package/lib/vite/traceViewer/inspectorTab.DnGm18kV.css +3178 -0
- package/lib/vite/traceViewer/recorder.DLgqV9db.css +15 -0
- package/lib/vite/traceViewer/recorder.DVrkq3Um.js +551 -0
- package/lib/vite/traceViewer/recorder.html +4 -4
- package/lib/vite/traceViewer/uiMode.C9_OcpPU.js +1756 -0
- package/lib/vite/traceViewer/uiMode.c5ORgcrX.css +1424 -0
- package/lib/vite/traceViewer/uiMode.html +8 -8
- package/lib/vite/traceViewer/workbench.xUZSA8PY.css +787 -0
- package/lib/vite/traceViewer/xtermModule.EsaqrrTX.css +209 -0
- package/package.json +1 -1
- package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +0 -24
- package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
- package/lib/vite/recorder/assets/index-ELPgmkwA.js +0 -184
- package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-gU1OOCQO.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-B5n_FjMx.js +0 -1
- package/lib/vite/traceViewer/assets/inspectorTab-6Tru8Mn_.js +0 -235
- package/lib/vite/traceViewer/assets/workbench-B_Nj4NA2.js +0 -25
- package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
- package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
- package/lib/vite/traceViewer/defaultSettingsView.CO3FR0CX.css +0 -1
- package/lib/vite/traceViewer/embedded.DpNPH6mk.js +0 -2
- package/lib/vite/traceViewer/embedded.mLhjB5IF.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.CuE3SYGw.js +0 -2
- package/lib/vite/traceViewer/inspectorTab.CXDulcFG.css +0 -1
- package/lib/vite/traceViewer/recorder.BD-uZJs7.js +0 -2
- package/lib/vite/traceViewer/recorder.tn0RQdqM.css +0 -0
- package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
- package/lib/vite/traceViewer/uiMode.DHrNgddz.js +0 -5
- package/lib/vite/traceViewer/workbench.B9vIAzH9.css +0 -1
- package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
@@ -0,0 +1,551 @@
|
|
|
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, Q as sha1, M as MultiTraceModel, L as ListView, o as asLocator, g as Toolbar, T as ToolbarButton, U as ToolbarSeparator, V as copy, t as toggleTheme, S as SplitView, H as TabbedPane, E as useConsoleTabModel, F as useNetworkTabModel, h as useSetting, W as collectSnapshots, X as extendSnapshot, Y as SnapshotView, O as SourceTab, J as InspectorTab, K as ConsoleTab, N as NetworkTab, a as applyTheme, c as clientExports } from "./assets/inspectorTab-CwgfffWb.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
|
+
clientExports.createRoot(document.querySelector("#root")).render(/* @__PURE__ */ jsxRuntimeExports.jsx(RecorderView, {}));
|
|
550
|
+
})();
|
|
551
|
+
//# sourceMappingURL=recorder.DVrkq3Um.js.map
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<title>Playwright Recorder</title>
|
|
9
|
-
<script type="module" crossorigin src="./recorder.
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="./inspectorTab.
|
|
12
|
-
<link rel="stylesheet" crossorigin href="./recorder.
|
|
9
|
+
<script type="module" crossorigin src="./recorder.DVrkq3Um.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-CwgfffWb.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="./inspectorTab.DnGm18kV.css">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="./recorder.DLgqV9db.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|