gz-research-assistant 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./core-CJ37HVMm.js";
|
|
2
|
-
import { Component as _, createElement as
|
|
3
|
-
import { StyleProvider as
|
|
4
|
-
import { Alert as
|
|
5
|
-
import { ApiOutlined as
|
|
2
|
+
import { Component as _, createElement as v, useCallback as y, useEffect as b, useId as x, useLayoutEffect as ee, useMemo as te, useRef as ne, useState as S, useSyncExternalStore as C } from "react";
|
|
3
|
+
import { StyleProvider as re } from "@ant-design/cssinjs";
|
|
4
|
+
import { Alert as w, Badge as ie, Button as T, Card as ae, Checkbox as oe, Collapse as E, ConfigProvider as se, Dropdown as ce, Empty as le, Input as D, InputNumber as ue, Select as O, Tabs as de, Tag as k, Tooltip as fe, Upload as pe, getDesignTokenCssVariables as A } from "gz-ui-web";
|
|
5
|
+
import { ApiOutlined as me, BulbOutlined as j, CameraOutlined as M, CheckCircleOutlined as N, CheckOutlined as he, CloseOutlined as ge, CodeOutlined as _e, DashboardOutlined as ve, DeleteOutlined as P, DesktopOutlined as F, DownloadOutlined as ye, EditOutlined as be, EllipsisOutlined as xe, ExperimentOutlined as I, FieldTimeOutlined as Se, FileAddOutlined as Ce, FileTextOutlined as we, FlagOutlined as Te, FolderOpenOutlined as Ee, FullscreenExitOutlined as De, FullscreenOutlined as Oe, HistoryOutlined as ke, InfoCircleOutlined as L, LineChartOutlined as R, LinkOutlined as Ae, MessageOutlined as je, MinusOutlined as z, PauseOutlined as Me, PlayCircleOutlined as Ne, PlusOutlined as B, ReadOutlined as Pe, SaveOutlined as Fe, ScissorOutlined as V, SearchOutlined as Ie, StopOutlined as H, UploadOutlined as U, VideoCameraOutlined as Le, WarningOutlined as Re } from "@ant-design/icons";
|
|
6
6
|
import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
|
|
7
7
|
import { OverlayScrollbars as ze } from "overlayscrollbars";
|
|
8
8
|
import { createRoot as Be } from "react-dom/client";
|
|
9
9
|
// \0rolldown/runtime.js
|
|
10
|
-
var Ve = Object.defineProperty,
|
|
10
|
+
var Ve = Object.defineProperty, q = Object.getOwnPropertyDescriptor, He = Object.getOwnPropertyNames, Ue = Object.prototype.hasOwnProperty, We = (e, t) => {
|
|
11
11
|
let n = {};
|
|
12
12
|
for (var r in e) Ve(n, r, {
|
|
13
13
|
get: e[r],
|
|
14
14
|
enumerable: !0
|
|
15
15
|
});
|
|
16
16
|
return t || Ve(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
17
|
-
},
|
|
18
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
17
|
+
}, Ge = (e, t, n, r) => {
|
|
18
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = He(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ue.call(e, s) && s !== n && Ve(e, s, {
|
|
19
19
|
get: ((e) => t[e]).bind(null, s),
|
|
20
|
-
enumerable: !(r =
|
|
20
|
+
enumerable: !(r = q(t, s)) || r.enumerable
|
|
21
21
|
});
|
|
22
22
|
return e;
|
|
23
|
-
},
|
|
23
|
+
}, Ke = (e, t, n) => (Ge(e, t, "default"), n && Ge(n, t, "default")), qe = { scope: "_scope_tudpr_1" }, J = {
|
|
24
24
|
dock: "_dock_1oshs_1",
|
|
25
25
|
launcher: "_launcher_1oshs_12",
|
|
26
26
|
launcherAvatar: "_launcherAvatar_1oshs_42",
|
|
@@ -55,12 +55,12 @@ var Ve = Object.defineProperty, He = Object.getOwnPropertyDescriptor, Ue = Objec
|
|
|
55
55
|
request: "_request_1oshs_316",
|
|
56
56
|
requestUrl: "_requestUrl_1oshs_448",
|
|
57
57
|
toolbarActions: "_toolbarActions_1oshs_465"
|
|
58
|
-
},
|
|
58
|
+
}, Je = (e, t) => ({
|
|
59
59
|
x: Math.max(0, Math.min(e.x, Math.max(0, window.innerWidth - t.width - 12))),
|
|
60
60
|
y: Math.max(0, Math.min(e.y, Math.max(0, window.innerHeight - t.height - 12)))
|
|
61
61
|
});
|
|
62
|
-
function
|
|
63
|
-
|
|
62
|
+
function Ye(e, t, n) {
|
|
63
|
+
b(() => {
|
|
64
64
|
let r = e.current, i = r?.closest("[data-assistant-part=\"dock\"]");
|
|
65
65
|
if (!r || !i) return;
|
|
66
66
|
let a = null, o = {
|
|
@@ -97,7 +97,7 @@ function Xe(e, t, n) {
|
|
|
97
97
|
}, m = (e) => {
|
|
98
98
|
if (!s || s.id !== e.pointerId) return;
|
|
99
99
|
let t = e.clientX - s.pointer.x, i = e.clientY - s.pointer.y;
|
|
100
|
-
!s.moved && Math.hypot(t, i) < 5 || (s.moved || (s.moved = !0, c = !0, n(!0), r.setPointerCapture(e.pointerId)), e.preventDefault(), e.stopPropagation(), a =
|
|
100
|
+
!s.moved && Math.hypot(t, i) < 5 || (s.moved || (s.moved = !0, c = !0, n(!0), r.setPointerCapture(e.pointerId)), e.preventDefault(), e.stopPropagation(), a = Je({
|
|
101
101
|
x: s.origin.x + t,
|
|
102
102
|
y: s.origin.y + i
|
|
103
103
|
}, o), l ||= requestAnimationFrame(d));
|
|
@@ -108,18 +108,18 @@ function Xe(e, t, n) {
|
|
|
108
108
|
s?.id === e.pointerId && (e.stopPropagation(), e.type === "pointercancel" && (c = !0), h());
|
|
109
109
|
}, _ = (e) => {
|
|
110
110
|
u(e) && (e.preventDefault(), e.stopPropagation(), c && e.detail !== 0 ? c = !1 : (c = !1, t()));
|
|
111
|
-
},
|
|
111
|
+
}, v = (e) => {
|
|
112
112
|
u(e) && e.preventDefault();
|
|
113
|
-
}, v = () => {
|
|
114
|
-
a && (a = Ye(a, o), f());
|
|
115
113
|
}, y = () => {
|
|
114
|
+
a && (a = Je(a, o), f());
|
|
115
|
+
}, b = () => {
|
|
116
116
|
s && (c = !0, h());
|
|
117
117
|
};
|
|
118
118
|
return window.addEventListener("pointerdown", p, !0), window.addEventListener("pointermove", m, {
|
|
119
119
|
capture: !0,
|
|
120
120
|
passive: !1
|
|
121
|
-
}), window.addEventListener("pointerup", g, !0), window.addEventListener("pointercancel", g, !0), window.addEventListener("lostpointercapture", g, !0), window.addEventListener("click", _, !0), window.addEventListener("dragstart",
|
|
122
|
-
window.removeEventListener("pointerdown", p, !0), window.removeEventListener("pointermove", m, !0), window.removeEventListener("pointerup", g, !0), window.removeEventListener("pointercancel", g, !0), window.removeEventListener("lostpointercapture", g, !0), window.removeEventListener("click", _, !0), window.removeEventListener("dragstart",
|
|
121
|
+
}), window.addEventListener("pointerup", g, !0), window.addEventListener("pointercancel", g, !0), window.addEventListener("lostpointercapture", g, !0), window.addEventListener("click", _, !0), window.addEventListener("dragstart", v, !0), window.addEventListener("resize", y), window.addEventListener("blur", b), () => {
|
|
122
|
+
window.removeEventListener("pointerdown", p, !0), window.removeEventListener("pointermove", m, !0), window.removeEventListener("pointerup", g, !0), window.removeEventListener("pointercancel", g, !0), window.removeEventListener("lostpointercapture", g, !0), window.removeEventListener("click", _, !0), window.removeEventListener("dragstart", v, !0), window.removeEventListener("resize", y), window.removeEventListener("blur", b), h();
|
|
123
123
|
};
|
|
124
124
|
}, [
|
|
125
125
|
e,
|
|
@@ -127,7 +127,7 @@ function Xe(e, t, n) {
|
|
|
127
127
|
n
|
|
128
128
|
]);
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var Y = {
|
|
131
131
|
formStack: "_formStack_175v2_1 _formStack_13kbl_763",
|
|
132
132
|
subheading: "_subheading_175v2_4 _subheading_13kbl_639",
|
|
133
133
|
json: "_json_175v2_7 _json_13kbl_377",
|
|
@@ -155,7 +155,7 @@ var J = {
|
|
|
155
155
|
assertionResults: "_assertionResults_175v2_175",
|
|
156
156
|
assertionResult: "_assertionResult_175v2_175",
|
|
157
157
|
assertionSummary: "_assertionSummary_175v2_202"
|
|
158
|
-
},
|
|
158
|
+
}, Xe = {
|
|
159
159
|
click: "点击",
|
|
160
160
|
fill: "输入",
|
|
161
161
|
select: "选择",
|
|
@@ -164,25 +164,25 @@ var J = {
|
|
|
164
164
|
"assert-text": "检查文字",
|
|
165
165
|
assert: "断言",
|
|
166
166
|
unsupported: "需要处理"
|
|
167
|
-
},
|
|
168
|
-
import * as
|
|
169
|
-
|
|
167
|
+
}, X = /* @__PURE__ */ We({});
|
|
168
|
+
import * as Ze from "gz-laya-pilot/schema";
|
|
169
|
+
Ke(X, Ze);
|
|
170
170
|
// src/pages/assistant/components/ActionMenu.tsx
|
|
171
|
-
function
|
|
172
|
-
return /* @__PURE__ */ G(
|
|
171
|
+
function Qe({ label: e, items: t, disabled: n }) {
|
|
172
|
+
return /* @__PURE__ */ G(ce, {
|
|
173
173
|
trigger: ["click"],
|
|
174
174
|
menu: { items: t },
|
|
175
175
|
disabled: n,
|
|
176
|
-
children: /* @__PURE__ */ G(
|
|
176
|
+
children: /* @__PURE__ */ G(T, {
|
|
177
177
|
type: "text",
|
|
178
|
-
icon: /* @__PURE__ */ G(
|
|
178
|
+
icon: /* @__PURE__ */ G(xe, {}),
|
|
179
179
|
"aria-label": e,
|
|
180
180
|
disabled: n,
|
|
181
181
|
children: "更多"
|
|
182
182
|
})
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
var
|
|
185
|
+
var Z = {
|
|
186
186
|
buttonRow: "_buttonRow_gry3r_1 _buttonRow_13kbl_627",
|
|
187
187
|
field: "_field_gry3r_4 _field_13kbl_761",
|
|
188
188
|
hint: "_hint_gry3r_7 _hint_13kbl_515",
|
|
@@ -192,34 +192,34 @@ var X = {
|
|
|
192
192
|
assertionFields: "_assertionFields_gry3r_29"
|
|
193
193
|
};
|
|
194
194
|
// src/pages/assistant/components/AssertionEditor/index.tsx
|
|
195
|
-
function
|
|
196
|
-
let o =
|
|
195
|
+
function $e({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCancel: a }) {
|
|
196
|
+
let o = x(), [s, c] = S(e ?? {
|
|
197
197
|
name: "",
|
|
198
198
|
source: "page-text",
|
|
199
199
|
operator: "contains",
|
|
200
200
|
expected: "",
|
|
201
201
|
timeout: 1e4
|
|
202
|
-
}), [l, u] =
|
|
202
|
+
}), [l, u] = S(n), [d, f] = S(""), p = (e) => c((t) => ({
|
|
203
203
|
...t,
|
|
204
204
|
...e
|
|
205
|
-
})), m = (0,
|
|
205
|
+
})), m = (0, X.isRequestAssertion)(s.source), h = t.slice(0, l).some((e) => e.target);
|
|
206
206
|
return /* @__PURE__ */ K("div", {
|
|
207
|
-
className: [
|
|
207
|
+
className: [Z.assertionEditor, Z.formStack].join(" "),
|
|
208
208
|
"data-assistant-part": "assertion-editor form-stack",
|
|
209
209
|
"aria-label": e ? "编辑断言配置" : "新增断言配置",
|
|
210
210
|
children: [
|
|
211
211
|
/* @__PURE__ */ K("h3", {
|
|
212
|
-
className:
|
|
212
|
+
className: Z.subheading,
|
|
213
213
|
"data-assistant-part": "subheading",
|
|
214
|
-
children: [/* @__PURE__ */ G(
|
|
214
|
+
children: [/* @__PURE__ */ G(N, {}), e ? "编辑断言" : "添加断言"]
|
|
215
215
|
}),
|
|
216
216
|
/* @__PURE__ */ K("div", {
|
|
217
|
-
className:
|
|
217
|
+
className: Z.field,
|
|
218
218
|
"data-assistant-part": "field",
|
|
219
219
|
children: [/* @__PURE__ */ G("label", {
|
|
220
220
|
htmlFor: `${o}-name`,
|
|
221
221
|
children: "断言名称"
|
|
222
|
-
}), /* @__PURE__ */ G(
|
|
222
|
+
}), /* @__PURE__ */ G(D, {
|
|
223
223
|
id: `${o}-name`,
|
|
224
224
|
placeholder: "例如:保存后显示成功提示",
|
|
225
225
|
value: s.name,
|
|
@@ -229,12 +229,12 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
229
229
|
})]
|
|
230
230
|
}),
|
|
231
231
|
!e && /* @__PURE__ */ K("div", {
|
|
232
|
-
className:
|
|
232
|
+
className: Z.field,
|
|
233
233
|
"data-assistant-part": "field",
|
|
234
234
|
children: [/* @__PURE__ */ G("label", {
|
|
235
235
|
htmlFor: `${o}-position`,
|
|
236
236
|
children: "执行位置"
|
|
237
|
-
}), /* @__PURE__ */ G(
|
|
237
|
+
}), /* @__PURE__ */ G(O, {
|
|
238
238
|
id: `${o}-position`,
|
|
239
239
|
value: l,
|
|
240
240
|
disabled: r,
|
|
@@ -249,59 +249,59 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
249
249
|
})]
|
|
250
250
|
}),
|
|
251
251
|
/* @__PURE__ */ K("div", {
|
|
252
|
-
className:
|
|
252
|
+
className: Z.assertionFields,
|
|
253
253
|
"data-assistant-part": "assertion-fields",
|
|
254
254
|
children: [/* @__PURE__ */ K("div", {
|
|
255
|
-
className:
|
|
255
|
+
className: Z.field,
|
|
256
256
|
"data-assistant-part": "field",
|
|
257
257
|
children: [/* @__PURE__ */ G("label", {
|
|
258
258
|
htmlFor: `${o}-source`,
|
|
259
259
|
children: "断言对象"
|
|
260
|
-
}), /* @__PURE__ */ G(
|
|
260
|
+
}), /* @__PURE__ */ G(O, {
|
|
261
261
|
id: `${o}-source`,
|
|
262
262
|
value: s.source,
|
|
263
263
|
disabled: r,
|
|
264
|
-
options: Object.entries(
|
|
264
|
+
options: Object.entries(X.assertionSources).map(([e, t]) => ({
|
|
265
265
|
value: e,
|
|
266
266
|
label: t
|
|
267
267
|
})),
|
|
268
268
|
onChange: (e) => p({
|
|
269
269
|
source: e,
|
|
270
|
-
operator: (0,
|
|
270
|
+
operator: (0, X.operatorsFor)(e)[0],
|
|
271
271
|
expected: e === "element-count" || e === "request-count" ? "1" : "",
|
|
272
|
-
timeout: (0,
|
|
272
|
+
timeout: (0, X.isRequestAssertion)(e) ? m ? s.timeout : 3e3 : m ? 1e4 : s.timeout,
|
|
273
273
|
method: s.method ?? "GET",
|
|
274
274
|
selector: s.selector ?? ""
|
|
275
275
|
})
|
|
276
276
|
})]
|
|
277
277
|
}), /* @__PURE__ */ K("div", {
|
|
278
|
-
className:
|
|
278
|
+
className: Z.field,
|
|
279
279
|
"data-assistant-part": "field",
|
|
280
280
|
children: [/* @__PURE__ */ G("label", {
|
|
281
281
|
htmlFor: `${o}-operator`,
|
|
282
282
|
children: "比较条件"
|
|
283
|
-
}), /* @__PURE__ */ G(
|
|
283
|
+
}), /* @__PURE__ */ G(O, {
|
|
284
284
|
id: `${o}-operator`,
|
|
285
285
|
value: s.operator,
|
|
286
286
|
disabled: r,
|
|
287
287
|
onChange: (e) => p({ operator: e }),
|
|
288
|
-
options: (0,
|
|
288
|
+
options: (0, X.operatorsFor)(s.source).map((e) => ({
|
|
289
289
|
value: e,
|
|
290
|
-
label:
|
|
290
|
+
label: X.assertionOperators[e]
|
|
291
291
|
}))
|
|
292
292
|
})]
|
|
293
293
|
})]
|
|
294
294
|
}),
|
|
295
295
|
m && /* @__PURE__ */ K(W, { children: [
|
|
296
296
|
/* @__PURE__ */ K("div", {
|
|
297
|
-
className:
|
|
297
|
+
className: Z.assertionFields,
|
|
298
298
|
"data-assistant-part": "assertion-fields",
|
|
299
299
|
children: [/* @__PURE__ */ K("div", {
|
|
300
|
-
className:
|
|
300
|
+
className: Z.field,
|
|
301
301
|
children: [/* @__PURE__ */ G("label", {
|
|
302
302
|
htmlFor: `${o}-method`,
|
|
303
303
|
children: "请求方法"
|
|
304
|
-
}), /* @__PURE__ */ G(
|
|
304
|
+
}), /* @__PURE__ */ G(O, {
|
|
305
305
|
id: `${o}-method`,
|
|
306
306
|
value: s.method,
|
|
307
307
|
disabled: r,
|
|
@@ -320,11 +320,11 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
320
320
|
onChange: (e) => p({ method: e })
|
|
321
321
|
})]
|
|
322
322
|
}), /* @__PURE__ */ K("div", {
|
|
323
|
-
className:
|
|
323
|
+
className: Z.field,
|
|
324
324
|
children: [/* @__PURE__ */ G("label", {
|
|
325
325
|
htmlFor: `${o}-pathname`,
|
|
326
326
|
children: "接口路径"
|
|
327
|
-
}), /* @__PURE__ */ G(
|
|
327
|
+
}), /* @__PURE__ */ G(D, {
|
|
328
328
|
id: `${o}-pathname`,
|
|
329
329
|
placeholder: "/api/orders",
|
|
330
330
|
maxLength: 2e3,
|
|
@@ -335,23 +335,23 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
335
335
|
})]
|
|
336
336
|
}),
|
|
337
337
|
/* @__PURE__ */ K("p", {
|
|
338
|
-
className:
|
|
338
|
+
className: Z.hint,
|
|
339
339
|
children: ["从上一操作开始,只统计同源 Fetch / XHR,忽略查询参数。", s.source === "request-success" && " 至少调用一次,且所有调用须在窗口内完成并返回 HTTP 2xx。"]
|
|
340
340
|
}),
|
|
341
|
-
!h && /* @__PURE__ */ G(
|
|
341
|
+
!h && /* @__PURE__ */ G(w, {
|
|
342
342
|
type: "warning",
|
|
343
343
|
title: "接口断言必须放在一次操作之后"
|
|
344
344
|
})
|
|
345
345
|
] }),
|
|
346
|
-
(0,
|
|
347
|
-
className:
|
|
346
|
+
(0, X.assertionNeedsSelector)(s.source) && /* @__PURE__ */ K("div", {
|
|
347
|
+
className: Z.field,
|
|
348
348
|
"data-assistant-part": "field",
|
|
349
349
|
children: [
|
|
350
350
|
/* @__PURE__ */ G("label", {
|
|
351
351
|
htmlFor: `${o}-selector`,
|
|
352
352
|
children: "元素定位(CSS)"
|
|
353
353
|
}),
|
|
354
|
-
/* @__PURE__ */ G(
|
|
354
|
+
/* @__PURE__ */ G(D, {
|
|
355
355
|
id: `${o}-selector`,
|
|
356
356
|
value: s.selector,
|
|
357
357
|
maxLength: 2e3,
|
|
@@ -360,19 +360,19 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
360
360
|
onChange: (e) => p({ selector: e.target.value })
|
|
361
361
|
}),
|
|
362
362
|
/* @__PURE__ */ G("p", {
|
|
363
|
-
className:
|
|
363
|
+
className: Z.hint,
|
|
364
364
|
"data-assistant-part": "hint",
|
|
365
365
|
children: "可从步骤定位信息复制。除数量断言外,必须匹配唯一元素。"
|
|
366
366
|
})
|
|
367
367
|
]
|
|
368
368
|
}),
|
|
369
|
-
(0,
|
|
370
|
-
className:
|
|
369
|
+
(0, X.assertionNeedsExpected)(s.source) && /* @__PURE__ */ K("div", {
|
|
370
|
+
className: Z.field,
|
|
371
371
|
"data-assistant-part": "field",
|
|
372
372
|
children: [/* @__PURE__ */ G("label", {
|
|
373
373
|
htmlFor: `${o}-expected`,
|
|
374
374
|
children: m ? "调用次数" : "期望值"
|
|
375
|
-
}), /* @__PURE__ */ G(
|
|
375
|
+
}), /* @__PURE__ */ G(D, {
|
|
376
376
|
id: `${o}-expected`,
|
|
377
377
|
value: s.expected,
|
|
378
378
|
maxLength: 2e3,
|
|
@@ -382,12 +382,12 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
382
382
|
})]
|
|
383
383
|
}),
|
|
384
384
|
/* @__PURE__ */ K("div", {
|
|
385
|
-
className:
|
|
385
|
+
className: Z.field,
|
|
386
386
|
"data-assistant-part": "field",
|
|
387
387
|
children: [/* @__PURE__ */ G("label", {
|
|
388
388
|
htmlFor: `${o}-timeout`,
|
|
389
389
|
children: m ? "观察时间(毫秒)" : "最长等待时间(毫秒)"
|
|
390
|
-
}), /* @__PURE__ */ G(
|
|
390
|
+
}), /* @__PURE__ */ G(ue, {
|
|
391
391
|
id: `${o}-timeout`,
|
|
392
392
|
min: 500,
|
|
393
393
|
max: 3e4,
|
|
@@ -397,21 +397,21 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
397
397
|
onChange: (e) => p({ timeout: e ?? (m ? 3e3 : 1e4) })
|
|
398
398
|
})]
|
|
399
399
|
}),
|
|
400
|
-
d && /* @__PURE__ */ G(
|
|
400
|
+
d && /* @__PURE__ */ G(w, {
|
|
401
401
|
showIcon: !0,
|
|
402
402
|
type: "error",
|
|
403
403
|
title: d
|
|
404
404
|
}),
|
|
405
405
|
/* @__PURE__ */ K("div", {
|
|
406
|
-
className:
|
|
406
|
+
className: Z.buttonRow,
|
|
407
407
|
"data-assistant-part": "button-row",
|
|
408
|
-
children: [/* @__PURE__ */ G(
|
|
409
|
-
icon: /* @__PURE__ */ G(
|
|
408
|
+
children: [/* @__PURE__ */ G(T, {
|
|
409
|
+
icon: /* @__PURE__ */ G(Fe, {}),
|
|
410
410
|
type: "primary",
|
|
411
411
|
disabled: r || m && !h,
|
|
412
412
|
onClick: () => {
|
|
413
413
|
try {
|
|
414
|
-
let e = (0,
|
|
414
|
+
let e = (0, X.parseAssertion)(s);
|
|
415
415
|
if (e.selector) try {
|
|
416
416
|
document.querySelector(e.selector);
|
|
417
417
|
} catch {
|
|
@@ -423,7 +423,7 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
423
423
|
}
|
|
424
424
|
},
|
|
425
425
|
children: "保存断言"
|
|
426
|
-
}), /* @__PURE__ */ G(
|
|
426
|
+
}), /* @__PURE__ */ G(T, {
|
|
427
427
|
onClick: a,
|
|
428
428
|
children: "取消"
|
|
429
429
|
})]
|
|
@@ -431,18 +431,19 @@ function et({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCance
|
|
|
431
431
|
]
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
var
|
|
434
|
+
var et = {
|
|
435
435
|
field: "_field_1qtxy_1 _field_13kbl_761",
|
|
436
436
|
formStack: "_formStack_1qtxy_4 _formStack_13kbl_763",
|
|
437
437
|
hint: "_hint_1qtxy_7 _hint_13kbl_515",
|
|
438
438
|
supplement: "_supplement_1qtxy_10"
|
|
439
439
|
};
|
|
440
440
|
// src/pages/assistant/components/StepSupplement/index.tsx
|
|
441
|
-
function
|
|
442
|
-
let
|
|
443
|
-
return /* @__PURE__ */ G(
|
|
444
|
-
className:
|
|
441
|
+
function tt({ step: e, disabled: t, defaultExpanded: n = !1, onApply: r }) {
|
|
442
|
+
let i = x(), [a, o] = S("click"), [s, c] = S(""), [l, u] = S(""), [d, f] = S(""), [p, m] = S(!0), [h, g] = S("");
|
|
443
|
+
return /* @__PURE__ */ G(E, {
|
|
444
|
+
className: et.supplement,
|
|
445
445
|
"data-assistant-part": "supplement",
|
|
446
|
+
defaultActiveKey: n ? ["details"] : [],
|
|
446
447
|
ghost: !0,
|
|
447
448
|
size: "small",
|
|
448
449
|
styles: {
|
|
@@ -457,25 +458,25 @@ function nt({ step: e, disabled: t, onApply: n }) {
|
|
|
457
458
|
key: "details",
|
|
458
459
|
label: /* @__PURE__ */ G(W, { children: "补充为可执行步骤" }),
|
|
459
460
|
children: /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("p", {
|
|
460
|
-
className:
|
|
461
|
+
className: et.hint,
|
|
461
462
|
"data-assistant-part": "hint",
|
|
462
463
|
children: "补充步骤不会改写原始事件。无法定位控件时,可退出选段后重新录制。"
|
|
463
464
|
}), /* @__PURE__ */ K("div", {
|
|
464
|
-
className:
|
|
465
|
+
className: et.formStack,
|
|
465
466
|
"data-assistant-part": "form-stack",
|
|
466
467
|
children: [
|
|
467
468
|
/* @__PURE__ */ K("div", {
|
|
468
|
-
className:
|
|
469
|
+
className: et.field,
|
|
469
470
|
"data-assistant-part": "field",
|
|
470
471
|
children: [/* @__PURE__ */ G("label", {
|
|
471
|
-
htmlFor:
|
|
472
|
+
htmlFor: i,
|
|
472
473
|
children: "操作类型"
|
|
473
|
-
}), /* @__PURE__ */ G(
|
|
474
|
-
id:
|
|
474
|
+
}), /* @__PURE__ */ G(O, {
|
|
475
|
+
id: i,
|
|
475
476
|
"aria-label": "补充操作类型",
|
|
476
|
-
value:
|
|
477
|
+
value: a,
|
|
477
478
|
disabled: t,
|
|
478
|
-
onChange:
|
|
479
|
+
onChange: o,
|
|
479
480
|
style: { width: "100%" },
|
|
480
481
|
options: [
|
|
481
482
|
{
|
|
@@ -505,35 +506,35 @@ function nt({ step: e, disabled: t, onApply: n }) {
|
|
|
505
506
|
]
|
|
506
507
|
})]
|
|
507
508
|
}),
|
|
508
|
-
|
|
509
|
-
className:
|
|
509
|
+
a !== "assert-text" && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K("div", {
|
|
510
|
+
className: et.field,
|
|
510
511
|
"data-assistant-part": "field",
|
|
511
512
|
children: [/* @__PURE__ */ G("label", {
|
|
512
|
-
htmlFor: `${
|
|
513
|
+
htmlFor: `${i}-selector`,
|
|
513
514
|
children: "CSS 定位"
|
|
514
|
-
}), /* @__PURE__ */ G(
|
|
515
|
-
id: `${
|
|
516
|
-
prefix: /* @__PURE__ */ G(
|
|
515
|
+
}), /* @__PURE__ */ G(D, {
|
|
516
|
+
id: `${i}-selector`,
|
|
517
|
+
prefix: /* @__PURE__ */ G(_e, {}),
|
|
517
518
|
placeholder: "例如 button[aria-label=\"展开\"]",
|
|
518
519
|
maxLength: 2e3,
|
|
519
|
-
value:
|
|
520
|
+
value: s,
|
|
520
521
|
disabled: t,
|
|
521
|
-
onChange: (e) =>
|
|
522
|
+
onChange: (e) => c(e.target.value)
|
|
522
523
|
})]
|
|
523
524
|
}), /* @__PURE__ */ K("div", {
|
|
524
|
-
className:
|
|
525
|
+
className: et.field,
|
|
525
526
|
"data-assistant-part": "field",
|
|
526
527
|
children: [/* @__PURE__ */ G("label", {
|
|
527
|
-
htmlFor: `${
|
|
528
|
+
htmlFor: `${i}-label`,
|
|
528
529
|
children: "控件文字"
|
|
529
|
-
}), /* @__PURE__ */ G(
|
|
530
|
-
id: `${
|
|
531
|
-
prefix: /* @__PURE__ */ G(
|
|
530
|
+
}), /* @__PURE__ */ G(D, {
|
|
531
|
+
id: `${i}-label`,
|
|
532
|
+
prefix: /* @__PURE__ */ G(be, {}),
|
|
532
533
|
placeholder: "如按钮文字、无障碍名称或输入提示",
|
|
533
534
|
maxLength: 200,
|
|
534
|
-
value:
|
|
535
|
+
value: l,
|
|
535
536
|
disabled: t,
|
|
536
|
-
onChange: (e) =>
|
|
537
|
+
onChange: (e) => u(e.target.value)
|
|
537
538
|
})]
|
|
538
539
|
})] }),
|
|
539
540
|
[
|
|
@@ -541,67 +542,67 @@ function nt({ step: e, disabled: t, onApply: n }) {
|
|
|
541
542
|
"select",
|
|
542
543
|
"press",
|
|
543
544
|
"assert-text"
|
|
544
|
-
].includes(
|
|
545
|
-
className:
|
|
545
|
+
].includes(a) && /* @__PURE__ */ K("div", {
|
|
546
|
+
className: et.field,
|
|
546
547
|
"data-assistant-part": "field",
|
|
547
548
|
children: [/* @__PURE__ */ G("label", {
|
|
548
|
-
htmlFor: `${
|
|
549
|
-
children:
|
|
550
|
-
}), /* @__PURE__ */ G(
|
|
551
|
-
id: `${
|
|
552
|
-
placeholder:
|
|
549
|
+
htmlFor: `${i}-value`,
|
|
550
|
+
children: a === "press" ? "按键" : a === "assert-text" ? "预期文字" : "输入值"
|
|
551
|
+
}), /* @__PURE__ */ G(D, {
|
|
552
|
+
id: `${i}-value`,
|
|
553
|
+
placeholder: a === "press" ? "Enter / Escape / Tab" : void 0,
|
|
553
554
|
maxLength: 2e3,
|
|
554
|
-
value:
|
|
555
|
+
value: d,
|
|
555
556
|
disabled: t,
|
|
556
|
-
onChange: (e) =>
|
|
557
|
+
onChange: (e) => f(e.target.value)
|
|
557
558
|
})]
|
|
558
559
|
}),
|
|
559
|
-
|
|
560
|
-
checked:
|
|
560
|
+
a === "check" && /* @__PURE__ */ G(oe, {
|
|
561
|
+
checked: p,
|
|
561
562
|
disabled: t,
|
|
562
|
-
onChange: (e) =>
|
|
563
|
+
onChange: (e) => m(e.target.checked),
|
|
563
564
|
children: "选中"
|
|
564
565
|
}),
|
|
565
|
-
/* @__PURE__ */ G(
|
|
566
|
-
icon: /* @__PURE__ */ G(
|
|
566
|
+
/* @__PURE__ */ G(T, {
|
|
567
|
+
icon: /* @__PURE__ */ G(he, {}),
|
|
567
568
|
disabled: t,
|
|
568
569
|
onClick: () => {
|
|
569
570
|
try {
|
|
570
|
-
if (
|
|
571
|
-
if (!
|
|
572
|
-
document.querySelector(
|
|
571
|
+
if (a !== "assert-text") {
|
|
572
|
+
if (!s.trim() || !l.trim()) throw Error("请补充定位及控件文字");
|
|
573
|
+
document.querySelector(s);
|
|
573
574
|
}
|
|
574
|
-
if (
|
|
575
|
-
if (
|
|
575
|
+
if (a === "assert-text" && !d.trim()) throw Error("检查点文字不能为空");
|
|
576
|
+
if (a === "press" && ![
|
|
576
577
|
"Enter",
|
|
577
578
|
"Escape",
|
|
578
579
|
"Tab"
|
|
579
|
-
].includes(
|
|
580
|
-
|
|
581
|
-
kind:
|
|
580
|
+
].includes(d)) throw Error("请选择支持的按键");
|
|
581
|
+
r({
|
|
582
|
+
kind: a,
|
|
582
583
|
supplemented: !0,
|
|
583
584
|
...e.sourceEventId ? { sourceEventId: e.sourceEventId } : {},
|
|
584
|
-
...
|
|
585
|
-
selector:
|
|
586
|
-
label:
|
|
585
|
+
...a === "assert-text" ? {} : { target: {
|
|
586
|
+
selector: s.trim(),
|
|
587
|
+
label: l.trim()
|
|
587
588
|
} },
|
|
588
589
|
...[
|
|
589
590
|
"fill",
|
|
590
591
|
"select",
|
|
591
592
|
"press",
|
|
592
593
|
"assert-text"
|
|
593
|
-
].includes(
|
|
594
|
-
...
|
|
595
|
-
}),
|
|
594
|
+
].includes(a) ? { value: d } : {},
|
|
595
|
+
...a === "check" ? { checked: p } : {}
|
|
596
|
+
}), g("");
|
|
596
597
|
} catch (e) {
|
|
597
|
-
|
|
598
|
+
g(e instanceof Error ? e.message : "内容无效");
|
|
598
599
|
}
|
|
599
600
|
},
|
|
600
601
|
children: "应用补充"
|
|
601
602
|
}),
|
|
602
|
-
|
|
603
|
+
h && /* @__PURE__ */ G("span", {
|
|
603
604
|
role: "alert",
|
|
604
|
-
children:
|
|
605
|
+
children: h
|
|
605
606
|
})
|
|
606
607
|
]
|
|
607
608
|
})] })
|
|
@@ -609,7 +610,7 @@ function nt({ step: e, disabled: t, onApply: n }) {
|
|
|
609
610
|
});
|
|
610
611
|
}
|
|
611
612
|
// src/api/automation.ts
|
|
612
|
-
async function
|
|
613
|
+
async function nt(e, t, n) {
|
|
613
614
|
let r = await fetch(`${e.replace(/\/$/, "")}/agent/${t}`, n === void 0 ? {} : {
|
|
614
615
|
method: "POST",
|
|
615
616
|
headers: {
|
|
@@ -631,10 +632,10 @@ async function rt(e, t, n) {
|
|
|
631
632
|
].includes(i.state)) throw Error("自主探索服务版本不匹配");
|
|
632
633
|
return i;
|
|
633
634
|
}
|
|
634
|
-
var
|
|
635
|
+
var rt = (e, t, n) => `${e.replace(/\/$/, "")}/agent/artifact?${new URLSearchParams({
|
|
635
636
|
id: t,
|
|
636
637
|
file: n
|
|
637
|
-
})}`,
|
|
638
|
+
})}`, it = {
|
|
638
639
|
card: "_card_1ixz9_1 _card_13kbl_633",
|
|
639
640
|
cardHeading: "_cardHeading_1ixz9_6 _cardHeading_13kbl_633",
|
|
640
641
|
buttonRow: "_buttonRow_1ixz9_9 _buttonRow_13kbl_627",
|
|
@@ -661,11 +662,11 @@ var it = (e, t, n) => `${e.replace(/\/$/, "")}/agent/artifact?${new URLSearchPar
|
|
|
661
662
|
decisions: 0
|
|
662
663
|
};
|
|
663
664
|
function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
664
|
-
let [r, i] =
|
|
665
|
-
|
|
665
|
+
let [r, i] = S(st), [a, o] = S(), [s, c] = S(""), [l, u] = S(!1), [d, f] = S(!1), [p, m] = S(""), [h, g] = S(!1), [_, v] = S();
|
|
666
|
+
b(() => {
|
|
666
667
|
let t = !1, r, a = async () => {
|
|
667
668
|
try {
|
|
668
|
-
let r = await
|
|
669
|
+
let r = await nt(e, "status");
|
|
669
670
|
t || (g(!0), i(r), o(r.capabilities), n(r.state === "running"), c((e) => e || r.capabilities?.targets[0] || ""));
|
|
670
671
|
} catch {
|
|
671
672
|
t || g(!1);
|
|
@@ -677,10 +678,10 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
677
678
|
t = !0, clearTimeout(r);
|
|
678
679
|
};
|
|
679
680
|
}, [e, n]);
|
|
680
|
-
let
|
|
681
|
+
let y = d || r.state === "running", x = async (t) => {
|
|
681
682
|
f(!0), m("");
|
|
682
683
|
try {
|
|
683
|
-
let r = await
|
|
684
|
+
let r = await nt(e, t, {
|
|
684
685
|
url: s,
|
|
685
686
|
allowWrite: l,
|
|
686
687
|
...t === "replay" ? { workbook: _?.data } : {}
|
|
@@ -691,14 +692,14 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
691
692
|
} finally {
|
|
692
693
|
f(!1);
|
|
693
694
|
}
|
|
694
|
-
},
|
|
695
|
+
}, ee = (t, n) => r.id && /* @__PURE__ */ G(T, {
|
|
695
696
|
type: "link",
|
|
696
|
-
icon: /* @__PURE__ */ G(
|
|
697
|
-
href:
|
|
697
|
+
icon: /* @__PURE__ */ G(ye, {}),
|
|
698
|
+
href: rt(e, r.id, t),
|
|
698
699
|
children: n
|
|
699
700
|
});
|
|
700
|
-
return /* @__PURE__ */ K(
|
|
701
|
-
className:
|
|
701
|
+
return /* @__PURE__ */ K(ae, {
|
|
702
|
+
className: it.card,
|
|
702
703
|
"aria-label": "自主探索",
|
|
703
704
|
"data-assistant-part": "agent-card",
|
|
704
705
|
styles: { body: {
|
|
@@ -709,31 +710,31 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
709
710
|
} },
|
|
710
711
|
children: [
|
|
711
712
|
/* @__PURE__ */ K("div", {
|
|
712
|
-
className:
|
|
713
|
-
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(
|
|
714
|
-
color:
|
|
713
|
+
className: it.cardHeading,
|
|
714
|
+
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(I, {}), "自主探索"] }), /* @__PURE__ */ G(k, {
|
|
715
|
+
color: y ? "processing" : r.state === "passed" ? "success" : "default",
|
|
715
716
|
children: at[r.state]
|
|
716
717
|
})]
|
|
717
718
|
}),
|
|
718
|
-
h ? !a?.configured && /* @__PURE__ */ G(
|
|
719
|
+
h ? !a?.configured && /* @__PURE__ */ G(w, {
|
|
719
720
|
type: "info",
|
|
720
721
|
title: a?.message ?? "模型尚未配置"
|
|
721
|
-
}) : /* @__PURE__ */ G(
|
|
722
|
+
}) : /* @__PURE__ */ G(w, {
|
|
722
723
|
type: "info",
|
|
723
724
|
title: "自主探索服务未连接,请启动宿主的 Laya 服务。"
|
|
724
725
|
}),
|
|
725
726
|
/* @__PURE__ */ K("div", {
|
|
726
|
-
className:
|
|
727
|
+
className: it.field,
|
|
727
728
|
children: [/* @__PURE__ */ G("label", {
|
|
728
729
|
htmlFor: "assistant-explore-target",
|
|
729
730
|
children: "测试页面"
|
|
730
|
-
}), /* @__PURE__ */ G(
|
|
731
|
+
}), /* @__PURE__ */ G(O, {
|
|
731
732
|
id: "assistant-explore-target",
|
|
732
733
|
"aria-label": "自主探索测试页面",
|
|
733
734
|
placeholder: "选择测试页面",
|
|
734
735
|
showSearch: !0,
|
|
735
736
|
value: s || void 0,
|
|
736
|
-
disabled:
|
|
737
|
+
disabled: y || t,
|
|
737
738
|
onChange: c,
|
|
738
739
|
options: a?.targets.map((e) => ({
|
|
739
740
|
label: e,
|
|
@@ -741,70 +742,70 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
741
742
|
})) ?? []
|
|
742
743
|
})]
|
|
743
744
|
}),
|
|
744
|
-
/* @__PURE__ */ G(
|
|
745
|
-
disabled:
|
|
745
|
+
/* @__PURE__ */ G(oe, {
|
|
746
|
+
disabled: y || t,
|
|
746
747
|
checked: l,
|
|
747
748
|
onChange: (e) => u(e.target.checked),
|
|
748
749
|
children: "允许创建、修改和删除本轮测试数据"
|
|
749
750
|
}),
|
|
750
751
|
/* @__PURE__ */ G("div", {
|
|
751
|
-
className:
|
|
752
|
-
children:
|
|
752
|
+
className: it.buttonRow,
|
|
753
|
+
children: y ? /* @__PURE__ */ G(T, {
|
|
753
754
|
type: "primary",
|
|
754
755
|
danger: !0,
|
|
755
|
-
icon: /* @__PURE__ */ G(
|
|
756
|
-
disabled: !
|
|
757
|
-
onClick: () => void
|
|
756
|
+
icon: /* @__PURE__ */ G(H, {}),
|
|
757
|
+
disabled: !y || d,
|
|
758
|
+
onClick: () => void x("stop"),
|
|
758
759
|
children: "停止探索"
|
|
759
|
-
}) : /* @__PURE__ */ G(
|
|
760
|
+
}) : /* @__PURE__ */ G(T, {
|
|
760
761
|
type: "primary",
|
|
761
|
-
icon: /* @__PURE__ */ G(
|
|
762
|
-
disabled:
|
|
763
|
-
onClick: () => void
|
|
762
|
+
icon: /* @__PURE__ */ G(I, {}),
|
|
763
|
+
disabled: y || t || !s || !h || !a?.configured,
|
|
764
|
+
onClick: () => void x("explore"),
|
|
764
765
|
children: "开始自主探索"
|
|
765
766
|
})
|
|
766
767
|
}),
|
|
767
768
|
r.state !== "idle" && /* @__PURE__ */ K("span", {
|
|
768
|
-
className:
|
|
769
|
+
className: it.hint,
|
|
769
770
|
children: [
|
|
770
771
|
r.message,
|
|
771
772
|
" ",
|
|
772
773
|
r.decisions > 0 && `· ${r.decisions} 次模型决策`
|
|
773
774
|
]
|
|
774
775
|
}),
|
|
775
|
-
p && /* @__PURE__ */ G(
|
|
776
|
+
p && /* @__PURE__ */ G(w, {
|
|
776
777
|
closable: !0,
|
|
777
778
|
type: "error",
|
|
778
779
|
title: p,
|
|
779
780
|
onClose: () => m("")
|
|
780
781
|
}),
|
|
781
782
|
/* @__PURE__ */ K("div", {
|
|
782
|
-
className:
|
|
783
|
+
className: it.buttonRow,
|
|
783
784
|
children: [
|
|
784
|
-
r.workbook &&
|
|
785
|
-
r.id && !
|
|
786
|
-
r.trace &&
|
|
785
|
+
r.workbook && ee(r.workbook, "下载 Excel 用例"),
|
|
786
|
+
r.id && !y && r.cases.length > 0 && ee("results.xlsx", "下载执行报告"),
|
|
787
|
+
r.trace && ee(r.trace, "下载 Trace")
|
|
787
788
|
]
|
|
788
789
|
}),
|
|
789
|
-
/* @__PURE__ */ G(
|
|
790
|
+
/* @__PURE__ */ G(E, {
|
|
790
791
|
size: "small",
|
|
791
792
|
items: [{
|
|
792
793
|
key: "replay",
|
|
793
794
|
label: "Excel 回放",
|
|
794
795
|
children: /* @__PURE__ */ K("div", {
|
|
795
|
-
className:
|
|
796
|
+
className: it.stack,
|
|
796
797
|
children: [
|
|
797
798
|
/* @__PURE__ */ G("span", {
|
|
798
|
-
className:
|
|
799
|
+
className: it.hint,
|
|
799
800
|
children: "使用自主探索生成的 Excel,入口需与所选测试页面一致。"
|
|
800
801
|
}),
|
|
801
802
|
/* @__PURE__ */ K("div", {
|
|
802
|
-
className:
|
|
803
|
-
children: [/* @__PURE__ */ G(
|
|
803
|
+
className: it.buttonRow,
|
|
804
|
+
children: [/* @__PURE__ */ G(pe, {
|
|
804
805
|
accept: ".xlsx",
|
|
805
806
|
maxCount: 1,
|
|
806
807
|
showUploadList: !1,
|
|
807
|
-
disabled:
|
|
808
|
+
disabled: y || t,
|
|
808
809
|
beforeUpload: async (e) => {
|
|
809
810
|
try {
|
|
810
811
|
if (e.size > 2097152) throw Error("Excel 文件不能超过 2 MB");
|
|
@@ -812,7 +813,7 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
812
813
|
let r = new FileReader();
|
|
813
814
|
r.onload = () => t(String(r.result).split(",")[1]), r.onerror = n, r.readAsDataURL(e);
|
|
814
815
|
});
|
|
815
|
-
|
|
816
|
+
v({
|
|
816
817
|
name: e.name,
|
|
817
818
|
data: t
|
|
818
819
|
}), m("");
|
|
@@ -821,17 +822,17 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
821
822
|
}
|
|
822
823
|
return !1;
|
|
823
824
|
},
|
|
824
|
-
children: /* @__PURE__ */ G(
|
|
825
|
+
children: /* @__PURE__ */ G(T, {
|
|
825
826
|
type: "text",
|
|
826
|
-
icon: /* @__PURE__ */ G(
|
|
827
|
-
disabled:
|
|
827
|
+
icon: /* @__PURE__ */ G(U, {}),
|
|
828
|
+
disabled: y || t,
|
|
828
829
|
children: "导入 Excel"
|
|
829
830
|
})
|
|
830
|
-
}), /* @__PURE__ */ G(
|
|
831
|
+
}), /* @__PURE__ */ G(T, {
|
|
831
832
|
type: "primary",
|
|
832
|
-
icon: /* @__PURE__ */ G(
|
|
833
|
-
disabled:
|
|
834
|
-
onClick: () => void
|
|
833
|
+
icon: /* @__PURE__ */ G(Ne, {}),
|
|
834
|
+
disabled: y || t || !h || !a?.configured || !s || !_,
|
|
835
|
+
onClick: () => void x("replay"),
|
|
835
836
|
children: "新会话回放"
|
|
836
837
|
})]
|
|
837
838
|
}),
|
|
@@ -840,35 +841,35 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
840
841
|
})
|
|
841
842
|
}]
|
|
842
843
|
}),
|
|
843
|
-
r.cases.length > 0 && /* @__PURE__ */ G(
|
|
844
|
+
r.cases.length > 0 && /* @__PURE__ */ G(E, {
|
|
844
845
|
size: "small",
|
|
845
846
|
items: r.cases.map((e) => ({
|
|
846
847
|
key: e.id,
|
|
847
848
|
label: /* @__PURE__ */ K("div", {
|
|
848
|
-
className:
|
|
849
|
-
children: [/* @__PURE__ */ G(
|
|
849
|
+
className: it.caseHeading,
|
|
850
|
+
children: [/* @__PURE__ */ G(k, {
|
|
850
851
|
color: e.state === "passed" ? "success" : e.state === "failed" ? "error" : "default",
|
|
851
852
|
children: ot[e.state]
|
|
852
853
|
}), /* @__PURE__ */ G("span", { children: e.title })]
|
|
853
854
|
}),
|
|
854
855
|
children: /* @__PURE__ */ K("div", {
|
|
855
|
-
className:
|
|
856
|
+
className: it.stack,
|
|
856
857
|
children: [
|
|
857
858
|
/* @__PURE__ */ G("span", { children: e.reason }),
|
|
858
|
-
e.assertions.map((e, t) => /* @__PURE__ */ G(
|
|
859
|
+
e.assertions.map((e, t) => /* @__PURE__ */ G(w, {
|
|
859
860
|
type: e.passed ? "success" : "error",
|
|
860
861
|
title: e.expected,
|
|
861
862
|
description: `实际:${e.actual}`
|
|
862
863
|
}, t)),
|
|
863
|
-
e.errors.map((e, t) => /* @__PURE__ */ G(
|
|
864
|
+
e.errors.map((e, t) => /* @__PURE__ */ G(w, {
|
|
864
865
|
type: "error",
|
|
865
866
|
title: e
|
|
866
867
|
}, t)),
|
|
867
868
|
e.cleanup && /* @__PURE__ */ G("span", {
|
|
868
|
-
className:
|
|
869
|
+
className: it.hint,
|
|
869
870
|
children: e.cleanup
|
|
870
871
|
}),
|
|
871
|
-
e.screenshot &&
|
|
872
|
+
e.screenshot && ee(e.screenshot, "查看截图证据")
|
|
872
873
|
]
|
|
873
874
|
})
|
|
874
875
|
}))
|
|
@@ -878,7 +879,7 @@ function ct({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
|
878
879
|
}
|
|
879
880
|
// src/pages/assistant/components/TestLibraryPanel/libraryRequest.ts
|
|
880
881
|
function lt(e) {
|
|
881
|
-
return
|
|
882
|
+
return y(async (t = "", n = "GET", r, i) => {
|
|
882
883
|
let a = await fetch(e + t, {
|
|
883
884
|
method: n,
|
|
884
885
|
headers: {
|
|
@@ -924,90 +925,93 @@ function dt({ run: e, base: t, onExport: n }) {
|
|
|
924
925
|
return /* @__PURE__ */ K("div", {
|
|
925
926
|
className: Q.stack,
|
|
926
927
|
children: [
|
|
927
|
-
/* @__PURE__ */ G("div", {
|
|
928
|
+
n && /* @__PURE__ */ G("div", {
|
|
928
929
|
className: Q.buttonRow,
|
|
929
|
-
children: /* @__PURE__ */ G(
|
|
930
|
+
children: /* @__PURE__ */ G(T, {
|
|
930
931
|
type: "text",
|
|
931
932
|
onClick: n,
|
|
932
933
|
children: "导出报告 JSON"
|
|
933
934
|
})
|
|
934
935
|
}),
|
|
935
|
-
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G(
|
|
936
|
-
e.iterations?.map(({ iteration:
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
/* @__PURE__ */ K("span", { children: [
|
|
954
|
-
/* @__PURE__ */ G(O, { children: ut[r.status.state] ?? r.status.state }),
|
|
955
|
-
"步骤 ",
|
|
956
|
-
r.status.step,
|
|
957
|
-
" / ",
|
|
958
|
-
r.status.total,
|
|
959
|
-
" · ",
|
|
960
|
-
r.status.message
|
|
961
|
-
] }),
|
|
962
|
-
r.status.failure && /* @__PURE__ */ K("div", { children: [
|
|
963
|
-
/* @__PURE__ */ G("strong", { children: "已观察" }),
|
|
964
|
-
/* @__PURE__ */ K("div", { children: [
|
|
965
|
-
r.status.failure.label,
|
|
966
|
-
" ",
|
|
967
|
-
r.status.failure.selector && /* @__PURE__ */ G("code", { children: r.status.failure.selector })
|
|
936
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ G(k, { children: ut[e.state] ?? e.state }), e.message] }),
|
|
937
|
+
e.iterations?.map(({ iteration: r, cases: i }) => /* @__PURE__ */ K("details", {
|
|
938
|
+
open: !n || void 0,
|
|
939
|
+
children: [/* @__PURE__ */ K("summary", { children: [
|
|
940
|
+
"第 ",
|
|
941
|
+
r,
|
|
942
|
+
" / ",
|
|
943
|
+
e.repeat,
|
|
944
|
+
" 轮 · ",
|
|
945
|
+
i.length,
|
|
946
|
+
" 个用例"
|
|
947
|
+
] }), /* @__PURE__ */ G("ul", {
|
|
948
|
+
className: Q.list,
|
|
949
|
+
children: i.map((n) => /* @__PURE__ */ K("li", { children: [
|
|
950
|
+
/* @__PURE__ */ K("strong", { children: [
|
|
951
|
+
n.suiteName,
|
|
952
|
+
" · ",
|
|
953
|
+
n.caseName
|
|
968
954
|
] }),
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
"
|
|
955
|
+
/* @__PURE__ */ G("code", { children: n.url ?? n.path }),
|
|
956
|
+
/* @__PURE__ */ K("span", { children: [
|
|
957
|
+
/* @__PURE__ */ G(k, { children: ut[n.status.state] ?? n.status.state }),
|
|
958
|
+
"步骤 ",
|
|
959
|
+
n.status.step,
|
|
960
|
+
" / ",
|
|
961
|
+
n.status.total,
|
|
962
|
+
" · ",
|
|
963
|
+
n.status.message
|
|
973
964
|
] }),
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
965
|
+
n.status.failure && /* @__PURE__ */ K("div", { children: [
|
|
966
|
+
/* @__PURE__ */ G("strong", { children: "已观察" }),
|
|
967
|
+
/* @__PURE__ */ K("div", { children: [
|
|
968
|
+
n.status.failure.label,
|
|
969
|
+
" ",
|
|
970
|
+
n.status.failure.selector && /* @__PURE__ */ G("code", { children: n.status.failure.selector })
|
|
971
|
+
] }),
|
|
972
|
+
n.status.failure.matchedCount !== void 0 && /* @__PURE__ */ K("div", { children: [
|
|
973
|
+
"匹配到 ",
|
|
974
|
+
n.status.failure.matchedCount,
|
|
975
|
+
" 个元素"
|
|
976
|
+
] }),
|
|
977
|
+
n.status.failure.hint && /* @__PURE__ */ K("div", { children: ["建议检查:", n.status.failure.hint] })
|
|
978
|
+
] }),
|
|
979
|
+
n.status.assertions?.map((e) => /* @__PURE__ */ K("div", { children: [
|
|
980
|
+
/* @__PURE__ */ G(k, {
|
|
981
|
+
color: e.passed ? "green" : "red",
|
|
982
|
+
children: e.passed ? "通过" : "失败"
|
|
983
|
+
}),
|
|
984
|
+
"第 ",
|
|
985
|
+
e.step,
|
|
986
|
+
" 步 · ",
|
|
987
|
+
e.name,
|
|
988
|
+
" · 期望 ",
|
|
989
|
+
e.expected,
|
|
990
|
+
" · 实际",
|
|
991
|
+
" ",
|
|
992
|
+
e.actual
|
|
993
|
+
] }, e.step)),
|
|
994
|
+
n.trace && /* @__PURE__ */ K("div", {
|
|
995
|
+
className: Q.buttonRow,
|
|
996
|
+
children: [/* @__PURE__ */ G(T, {
|
|
997
|
+
size: "small",
|
|
998
|
+
href: `${t}/runs/${e.id}/trace?iteration=${r}&caseIndex=${n.caseIndex}`,
|
|
999
|
+
download: !0,
|
|
1000
|
+
children: "下载 Trace"
|
|
1001
|
+
}), /* @__PURE__ */ G("small", {
|
|
1002
|
+
className: Q.hint,
|
|
1003
|
+
children: "含页面与网络信息,仅在本机查看"
|
|
1004
|
+
})]
|
|
1005
|
+
})
|
|
1006
|
+
] }, n.caseIndex))
|
|
1007
|
+
})]
|
|
1008
|
+
}, r))
|
|
1005
1009
|
]
|
|
1006
1010
|
});
|
|
1007
1011
|
}
|
|
1008
1012
|
// src/pages/assistant/components/TestLibraryPanel/LibraryDetail.tsx
|
|
1009
1013
|
function ft({ options: e, values: t, onChange: n }) {
|
|
1010
|
-
return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(
|
|
1014
|
+
return /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(O, {
|
|
1011
1015
|
"aria-label": "添加到执行顺序",
|
|
1012
1016
|
placeholder: "选择要添加的项目",
|
|
1013
1017
|
value: null,
|
|
@@ -1020,7 +1024,7 @@ function ft({ options: e, values: t, onChange: n }) {
|
|
|
1020
1024
|
className: Q.list,
|
|
1021
1025
|
children: t.map((r, i) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G("span", { children: e.find(({ value: e }) => e === r)?.label ?? r }), /* @__PURE__ */ K("div", {
|
|
1022
1026
|
className: Q.buttonRow,
|
|
1023
|
-
children: [/* @__PURE__ */ G(
|
|
1027
|
+
children: [/* @__PURE__ */ G(T, {
|
|
1024
1028
|
size: "small",
|
|
1025
1029
|
type: "text",
|
|
1026
1030
|
"aria-label": `上移第 ${i + 1} 项`,
|
|
@@ -1030,7 +1034,7 @@ function ft({ options: e, values: t, onChange: n }) {
|
|
|
1030
1034
|
[e[i - 1], e[i]] = [e[i], e[i - 1]], n(e);
|
|
1031
1035
|
},
|
|
1032
1036
|
children: "上移"
|
|
1033
|
-
}), /* @__PURE__ */ G(
|
|
1037
|
+
}), /* @__PURE__ */ G(T, {
|
|
1034
1038
|
size: "small",
|
|
1035
1039
|
type: "text",
|
|
1036
1040
|
"aria-label": `移除第 ${i + 1} 项`,
|
|
@@ -1041,113 +1045,114 @@ function ft({ options: e, values: t, onChange: n }) {
|
|
|
1041
1045
|
})] });
|
|
1042
1046
|
}
|
|
1043
1047
|
function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, onEdit: o, recording: s, incomingDraft: c, onConsumeDraft: l, renderCase: u }) {
|
|
1044
|
-
let [d, f] =
|
|
1045
|
-
o(e),
|
|
1048
|
+
let [d, f] = S(), [m, h] = S([]), [g, _] = S(), [v, x] = S("cases"), te = ne(null), [C, re] = S(!1), [ie, oe] = S(""), [E, se] = S(), [ce, fe] = S(), [pe, A] = S(!1), [me, j] = S(!1), [M, N] = S(), he = !!(M && M.baseline !== JSON.stringify(i)), ge = () => !s && (!he || window.confirm("当前用例有未保存修改,确定离开?")), _e = (e, t, n) => {
|
|
1049
|
+
o(e), se(t), xe(void 0), fe(n), N({
|
|
1046
1050
|
caseId: t,
|
|
1047
1051
|
suiteId: n,
|
|
1048
1052
|
baseline: JSON.stringify(e)
|
|
1049
|
-
}),
|
|
1050
|
-
},
|
|
1051
|
-
!
|
|
1052
|
-
}, [
|
|
1053
|
+
}), x("cases");
|
|
1054
|
+
}, ve = (e) => {
|
|
1055
|
+
!C && !s && ge() && Be() && Ve() && (N(void 0), A(!1), j(!1), x(e));
|
|
1056
|
+
}, [P, F] = S({
|
|
1053
1057
|
id: "",
|
|
1054
1058
|
name: "",
|
|
1055
1059
|
caseIds: []
|
|
1056
|
-
}),
|
|
1060
|
+
}), ye = ne(null), [be, xe] = S(), [I, Se] = S({
|
|
1057
1061
|
id: "",
|
|
1058
1062
|
name: "",
|
|
1059
1063
|
suiteIds: [],
|
|
1060
1064
|
repeat: 1
|
|
1061
|
-
}), [
|
|
1062
|
-
|
|
1063
|
-
c && d && !s && !
|
|
1065
|
+
}), [Ce, we] = S(), [Te, Ee] = S();
|
|
1066
|
+
b(() => {
|
|
1067
|
+
c && d && !s && !C && ((!he || window.confirm("时间线草稿会替换当前未保存的编辑。继续?")) && Be() && Ve() && (A(!1), j(!1), se(void 0), fe(void 0), o(c), N({ baseline: "" }), x("cases")), l?.());
|
|
1064
1068
|
}, [
|
|
1065
1069
|
c,
|
|
1066
1070
|
d,
|
|
1067
1071
|
s,
|
|
1068
|
-
|
|
1072
|
+
C,
|
|
1069
1073
|
he,
|
|
1070
1074
|
o,
|
|
1071
1075
|
l
|
|
1072
1076
|
]);
|
|
1073
|
-
let
|
|
1074
|
-
if (!
|
|
1075
|
-
|
|
1077
|
+
let De = Ce ?? m[0]?.id, Oe = g?.state === "running" || g?.state === "stopping", ke = Oe || m.some((e) => e.state === "running" || e.state === "stopping"), L = lt(e), R = async (e) => {
|
|
1078
|
+
if (!C) {
|
|
1079
|
+
re(!0), oe("");
|
|
1076
1080
|
try {
|
|
1077
1081
|
await e();
|
|
1078
1082
|
} catch (e) {
|
|
1079
|
-
|
|
1083
|
+
oe(e instanceof Error ? e.message : "操作失败");
|
|
1080
1084
|
} finally {
|
|
1081
|
-
|
|
1085
|
+
re(!1);
|
|
1082
1086
|
}
|
|
1083
1087
|
}
|
|
1084
|
-
},
|
|
1088
|
+
}, Ae = y(async (e) => {
|
|
1085
1089
|
let t = await L("", "GET", void 0, e);
|
|
1086
1090
|
if (t.version !== 1 || !Array.isArray(t.cases)) throw Error("本机测试库服务版本不匹配");
|
|
1087
|
-
let n = await L("/runs", "GET", void 0, e);
|
|
1088
|
-
e?.aborted || (f(t), h(n));
|
|
1089
|
-
}, [L]),
|
|
1090
|
-
|
|
1091
|
+
let n = await L("/runs", "GET", void 0, e), r = await L("/execution", "GET", void 0, e);
|
|
1092
|
+
e?.aborted || (_(r?.id ? r : void 0), f(t), h(n));
|
|
1093
|
+
}, [L]), je = () => void R(Ae);
|
|
1094
|
+
b(() => {
|
|
1091
1095
|
let e = new AbortController();
|
|
1092
|
-
return
|
|
1093
|
-
e.signal.aborted ||
|
|
1096
|
+
return re(!0), Ae(e.signal).catch((t) => {
|
|
1097
|
+
e.signal.aborted || oe(t instanceof Error ? t.message : "本机测试库服务未连接");
|
|
1094
1098
|
}).finally(() => {
|
|
1095
|
-
e.signal.aborted ||
|
|
1099
|
+
e.signal.aborted || re(!1);
|
|
1096
1100
|
}), () => e.abort();
|
|
1097
|
-
}, [
|
|
1098
|
-
if (!
|
|
1101
|
+
}, [Ae]), b(() => {
|
|
1102
|
+
if (!ke && (!De || v !== "reports")) return;
|
|
1099
1103
|
let e = new AbortController(), t = async () => {
|
|
1100
|
-
let t = await L("/runs", "GET", void 0, e.signal), n =
|
|
1101
|
-
e.signal.aborted || (h(t), n &&
|
|
1104
|
+
let t = await L("/runs", "GET", void 0, e.signal), n = await L("/execution", "GET", void 0, e.signal), r = v === "reports" && De ? await L(`/runs/${De}`, "GET", void 0, e.signal) : void 0;
|
|
1105
|
+
e.signal.aborted || (h(t), _(n?.id ? n : void 0), r && Ee(r));
|
|
1102
1106
|
}, n = () => void t().catch(() => {});
|
|
1103
1107
|
n();
|
|
1104
|
-
let r =
|
|
1108
|
+
let r = ke ? setInterval(n, 1e3) : void 0;
|
|
1105
1109
|
return () => {
|
|
1106
1110
|
clearInterval(r), e.abort();
|
|
1107
1111
|
};
|
|
1108
1112
|
}, [
|
|
1109
1113
|
L,
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1114
|
+
De,
|
|
1115
|
+
ke,
|
|
1116
|
+
v,
|
|
1117
|
+
g?.id
|
|
1113
1118
|
]);
|
|
1114
|
-
let
|
|
1119
|
+
let z = async (e) => {
|
|
1115
1120
|
f(await L("", "PUT", e));
|
|
1116
|
-
},
|
|
1121
|
+
}, Me = (e, t) => {
|
|
1117
1122
|
let n = URL.createObjectURL(new Blob([JSON.stringify(e, null, 2)], { type: "application/json" })), r = document.createElement("a");
|
|
1118
1123
|
r.href = n, r.download = t, r.click(), setTimeout(() => URL.revokeObjectURL(n), 3e4);
|
|
1119
|
-
},
|
|
1124
|
+
}, Ne = (e, t) => e.some(({ id: e }) => e === t.id) ? e.map((e) => e.id === t.id ? t : e) : [...e, t], B = !a && !C && !ke, Pe = d?.cases.map(({ id: e, testCase: t }) => ({
|
|
1120
1125
|
label: t.name,
|
|
1121
1126
|
value: e
|
|
1122
|
-
})) ?? [],
|
|
1127
|
+
})) ?? [], Fe = d?.suites.map(({ id: e, name: t }) => ({
|
|
1123
1128
|
label: t,
|
|
1124
1129
|
value: e
|
|
1125
|
-
})) ?? [], V = d?.cases.find(({ id: e }) => e ===
|
|
1126
|
-
|
|
1127
|
-
let e =
|
|
1128
|
-
if (e) for (let t =
|
|
1130
|
+
})) ?? [], V = d?.cases.find(({ id: e }) => e === E), Ie = V ? d?.suites.filter((e) => !e.caseIds.includes(V.id)) ?? [] : [], H = d?.suites.find(({ id: e }) => e === P.id), U = d?.plans.find(({ id: e }) => e === I.id), Le = H?.caseIds ?? [], Re = P.name !== (H?.name ?? "") || JSON.stringify(P.caseIds) !== JSON.stringify(Le), ze = I.name !== (U?.name ?? "") || I.repeat !== (U?.repeat ?? 1) || JSON.stringify(I.suiteIds) !== JSON.stringify(U?.suiteIds ?? []), Be = () => !pe || !Re || window.confirm("当前套件有未保存修改,确定放弃?"), Ve = () => !me || !ze || window.confirm("当前计划有未保存修改,确定放弃?");
|
|
1131
|
+
ee(() => {
|
|
1132
|
+
let e = te.current?.closest("[role=\"dialog\"]");
|
|
1133
|
+
if (e) for (let t = te.current?.parentElement; t && t !== e; t = t.parentElement) t.scrollTop && (t.scrollTop = 0);
|
|
1129
1134
|
}, [
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1135
|
+
v,
|
|
1136
|
+
E,
|
|
1137
|
+
M,
|
|
1138
|
+
P.id,
|
|
1139
|
+
pe,
|
|
1140
|
+
I.id,
|
|
1136
1141
|
me
|
|
1137
1142
|
]);
|
|
1138
|
-
let
|
|
1139
|
-
!
|
|
1143
|
+
let q = v === "cases" ? V?.testCase.name : v === "suites" ? H?.name : v === "plans" ? U?.name : void 0, He = () => {
|
|
1144
|
+
!C && ge() && Be() && Ve() && (se(void 0), N(void 0), A(!1), j(!1), F({
|
|
1140
1145
|
id: "",
|
|
1141
1146
|
name: "",
|
|
1142
1147
|
caseIds: []
|
|
1143
|
-
}),
|
|
1148
|
+
}), Se({
|
|
1144
1149
|
id: "",
|
|
1145
1150
|
name: "",
|
|
1146
1151
|
suiteIds: [],
|
|
1147
1152
|
repeat: 1
|
|
1148
1153
|
}));
|
|
1149
1154
|
};
|
|
1150
|
-
return /* @__PURE__ */ K(
|
|
1155
|
+
return /* @__PURE__ */ K(ae, {
|
|
1151
1156
|
className: Q.card,
|
|
1152
1157
|
"aria-label": "本机测试库",
|
|
1153
1158
|
styles: { body: {
|
|
@@ -1160,17 +1165,17 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1160
1165
|
/* @__PURE__ */ K("header", {
|
|
1161
1166
|
className: Q.header,
|
|
1162
1167
|
children: [/* @__PURE__ */ K("nav", {
|
|
1163
|
-
ref:
|
|
1168
|
+
ref: te,
|
|
1164
1169
|
"aria-label": "当前位置",
|
|
1165
1170
|
className: Q.breadcrumbs,
|
|
1166
1171
|
children: [
|
|
1167
|
-
/* @__PURE__ */ G(
|
|
1172
|
+
/* @__PURE__ */ G(T, {
|
|
1168
1173
|
type: "link",
|
|
1169
1174
|
size: "small",
|
|
1170
1175
|
className: Q.entryLink,
|
|
1171
|
-
disabled:
|
|
1176
|
+
disabled: C || s,
|
|
1172
1177
|
onClick: () => {
|
|
1173
|
-
|
|
1178
|
+
ge() && Be() && Ve() && n();
|
|
1174
1179
|
},
|
|
1175
1180
|
children: "测试库"
|
|
1176
1181
|
}),
|
|
@@ -1178,14 +1183,14 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1178
1183
|
"aria-hidden": "true",
|
|
1179
1184
|
children: "/"
|
|
1180
1185
|
}),
|
|
1181
|
-
|
|
1182
|
-
/* @__PURE__ */ G(
|
|
1186
|
+
q || M || pe || me ? /* @__PURE__ */ K(W, { children: [
|
|
1187
|
+
/* @__PURE__ */ G(T, {
|
|
1183
1188
|
type: "link",
|
|
1184
1189
|
size: "small",
|
|
1185
1190
|
className: Q.breadcrumbName,
|
|
1186
1191
|
title: t,
|
|
1187
|
-
disabled:
|
|
1188
|
-
onClick:
|
|
1192
|
+
disabled: C || s,
|
|
1193
|
+
onClick: He,
|
|
1189
1194
|
children: /* @__PURE__ */ G("span", {
|
|
1190
1195
|
className: Q.resourceName,
|
|
1191
1196
|
children: t
|
|
@@ -1198,8 +1203,8 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1198
1203
|
/* @__PURE__ */ G("span", {
|
|
1199
1204
|
"aria-current": "page",
|
|
1200
1205
|
className: Q.resourceName,
|
|
1201
|
-
title:
|
|
1202
|
-
children:
|
|
1206
|
+
title: q,
|
|
1207
|
+
children: q ?? (M ? "新建用例" : pe ? "新建套件" : "新建计划")
|
|
1203
1208
|
})
|
|
1204
1209
|
] }) : /* @__PURE__ */ G("h3", {
|
|
1205
1210
|
className: Q.resourceName,
|
|
@@ -1207,9 +1212,9 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1207
1212
|
children: t
|
|
1208
1213
|
})
|
|
1209
1214
|
]
|
|
1210
|
-
}), d && !
|
|
1215
|
+
}), d && !q && !M && !pe && !me && /* @__PURE__ */ K("div", {
|
|
1211
1216
|
className: Q.headerAction,
|
|
1212
|
-
children: [/* @__PURE__ */ G(
|
|
1217
|
+
children: [/* @__PURE__ */ G(Qe, {
|
|
1213
1218
|
label: "测试库更多操作",
|
|
1214
1219
|
items: [
|
|
1215
1220
|
{
|
|
@@ -1221,92 +1226,109 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1221
1226
|
{
|
|
1222
1227
|
key: "refresh",
|
|
1223
1228
|
label: "刷新测试库",
|
|
1224
|
-
disabled:
|
|
1225
|
-
onClick:
|
|
1229
|
+
disabled: C,
|
|
1230
|
+
onClick: je
|
|
1226
1231
|
},
|
|
1227
1232
|
{
|
|
1228
1233
|
key: "import",
|
|
1229
1234
|
label: "导入测试库",
|
|
1230
1235
|
disabled: !B,
|
|
1231
|
-
onClick: () =>
|
|
1236
|
+
onClick: () => ye.current?.click()
|
|
1232
1237
|
},
|
|
1233
1238
|
{
|
|
1234
1239
|
key: "export",
|
|
1235
1240
|
label: "导出测试库",
|
|
1236
1241
|
title: "导出包含用例入口的查询参数和片段,分享前请移除敏感值。",
|
|
1237
|
-
disabled:
|
|
1238
|
-
onClick: () =>
|
|
1242
|
+
disabled: C,
|
|
1243
|
+
onClick: () => Me(d, "研发小蜜测试库.json")
|
|
1239
1244
|
}
|
|
1240
1245
|
]
|
|
1241
1246
|
}), /* @__PURE__ */ G("input", {
|
|
1242
1247
|
hidden: !0,
|
|
1243
1248
|
type: "file",
|
|
1244
|
-
ref:
|
|
1249
|
+
ref: ye,
|
|
1245
1250
|
accept: ".json,application/json",
|
|
1246
1251
|
onChange: (e) => {
|
|
1247
1252
|
let t = e.target.files?.[0];
|
|
1248
1253
|
e.target.value = "", t && B && window.confirm("导入会替换当前测试库中的用例、套件和计划。继续?") && R(async () => {
|
|
1249
1254
|
if (t.size > 2097152) throw Error("测试库文件不能超过 2 MB");
|
|
1250
1255
|
let e = JSON.parse(await t.text());
|
|
1251
|
-
await
|
|
1256
|
+
await z({
|
|
1252
1257
|
...e,
|
|
1253
1258
|
revision: d.revision
|
|
1254
|
-
}),
|
|
1259
|
+
}), He(), we(void 0), x("cases");
|
|
1255
1260
|
});
|
|
1256
1261
|
}
|
|
1257
1262
|
})]
|
|
1258
1263
|
})]
|
|
1259
1264
|
}),
|
|
1260
|
-
ie && /* @__PURE__ */ G(
|
|
1265
|
+
ie && /* @__PURE__ */ G(w, {
|
|
1261
1266
|
type: "error",
|
|
1262
1267
|
title: ie,
|
|
1263
|
-
action: d && /* @__PURE__ */ G(
|
|
1268
|
+
action: d && /* @__PURE__ */ G(T, {
|
|
1264
1269
|
type: "text",
|
|
1265
1270
|
size: "small",
|
|
1266
|
-
disabled:
|
|
1267
|
-
onClick:
|
|
1271
|
+
disabled: C || s,
|
|
1272
|
+
onClick: je,
|
|
1268
1273
|
children: "刷新测试库"
|
|
1269
1274
|
})
|
|
1270
1275
|
}),
|
|
1271
|
-
d ? /* @__PURE__ */
|
|
1272
|
-
|
|
1273
|
-
|
|
1276
|
+
d ? /* @__PURE__ */ K(W, { children: [g && /* @__PURE__ */ K("section", {
|
|
1277
|
+
className: Q.stack,
|
|
1278
|
+
"aria-label": "单独执行状态",
|
|
1279
|
+
children: [/* @__PURE__ */ K("div", {
|
|
1280
|
+
className: Q.header,
|
|
1281
|
+
children: [/* @__PURE__ */ K("h4", { children: ["单独执行 · ", g.planName] }), Oe && /* @__PURE__ */ G(T, {
|
|
1282
|
+
danger: !0,
|
|
1283
|
+
disabled: C || g.state === "stopping",
|
|
1284
|
+
onClick: () => void R(async () => {
|
|
1285
|
+
_(await L("/stop", "POST", {}));
|
|
1286
|
+
}),
|
|
1287
|
+
children: "停止执行"
|
|
1288
|
+
})]
|
|
1289
|
+
}), /* @__PURE__ */ G(dt, {
|
|
1290
|
+
run: g,
|
|
1291
|
+
base: e
|
|
1292
|
+
})]
|
|
1293
|
+
}), /* @__PURE__ */ G(de, {
|
|
1294
|
+
activeKey: v,
|
|
1295
|
+
onChange: ve,
|
|
1274
1296
|
tabBarExtraContent: { right: /* @__PURE__ */ K("div", {
|
|
1275
1297
|
className: Q.tabAction,
|
|
1276
1298
|
children: [
|
|
1277
|
-
|
|
1299
|
+
v === "cases" && !M && !V && /* @__PURE__ */ G(T, {
|
|
1278
1300
|
type: "primary",
|
|
1279
1301
|
size: "small",
|
|
1280
1302
|
disabled: !B,
|
|
1281
1303
|
onClick: () => {
|
|
1282
|
-
|
|
1304
|
+
_e(p());
|
|
1283
1305
|
},
|
|
1284
1306
|
children: "新建用例"
|
|
1285
1307
|
}),
|
|
1286
|
-
|
|
1308
|
+
v === "suites" && !pe && !H && /* @__PURE__ */ G(T, {
|
|
1287
1309
|
type: "primary",
|
|
1288
1310
|
size: "small",
|
|
1289
1311
|
disabled: !B,
|
|
1290
1312
|
onClick: () => {
|
|
1291
|
-
|
|
1313
|
+
F({
|
|
1292
1314
|
id: "",
|
|
1293
1315
|
name: "",
|
|
1294
1316
|
caseIds: []
|
|
1295
|
-
}),
|
|
1317
|
+
}), A(!0);
|
|
1296
1318
|
},
|
|
1297
1319
|
children: "新建套件"
|
|
1298
1320
|
}),
|
|
1299
|
-
|
|
1321
|
+
v === "plans" && !me && !U && /* @__PURE__ */ G(T, {
|
|
1300
1322
|
type: "primary",
|
|
1301
1323
|
size: "small",
|
|
1302
1324
|
disabled: !B,
|
|
1303
1325
|
onClick: () => {
|
|
1304
|
-
|
|
1326
|
+
Se({
|
|
1305
1327
|
id: "",
|
|
1306
1328
|
name: "",
|
|
1307
1329
|
suiteIds: [],
|
|
1308
1330
|
repeat: 1
|
|
1309
|
-
}),
|
|
1331
|
+
}), j(!0);
|
|
1310
1332
|
},
|
|
1311
1333
|
children: "新建计划"
|
|
1312
1334
|
})
|
|
@@ -1316,35 +1338,35 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1316
1338
|
{
|
|
1317
1339
|
key: "cases",
|
|
1318
1340
|
label: "用例",
|
|
1319
|
-
children:
|
|
1341
|
+
children: M ? /* @__PURE__ */ K("div", {
|
|
1320
1342
|
className: Q.stack,
|
|
1321
1343
|
children: [/* @__PURE__ */ K("div", {
|
|
1322
1344
|
className: Q.buttonRow,
|
|
1323
|
-
children: [/* @__PURE__ */ G("h4", { children:
|
|
1345
|
+
children: [/* @__PURE__ */ G("h4", { children: M.caseId ? "编辑用例" : "新建用例" }), /* @__PURE__ */ G(k, { children: he ? "未保存" : M.caseId ? "已保存" : "新用例" })]
|
|
1324
1346
|
}), u({
|
|
1325
1347
|
testCase: i,
|
|
1326
|
-
busy:
|
|
1348
|
+
busy: C || ke || a && !s,
|
|
1327
1349
|
dirty: he,
|
|
1328
1350
|
cancel: () => {
|
|
1329
|
-
|
|
1351
|
+
ge() && (N(void 0), M.suiteId && !M.caseId && x("suites"));
|
|
1330
1352
|
},
|
|
1331
1353
|
save: (e) => R(async () => {
|
|
1332
|
-
let t =
|
|
1333
|
-
if (
|
|
1334
|
-
let n = d.suites.find(({ id: e }) => e ===
|
|
1335
|
-
if (
|
|
1354
|
+
let t = M.caseId ?? crypto.randomUUID();
|
|
1355
|
+
if (M.caseId && !d.cases.some(({ id: e }) => e === t)) throw Error("当前用例已被删除,可返回后另存为新用例");
|
|
1356
|
+
let n = d.suites.find(({ id: e }) => e === M.suiteId);
|
|
1357
|
+
if (M.suiteId && !n) throw Error("原套件已被删除");
|
|
1336
1358
|
let r = n && !n.caseIds.includes(t) ? {
|
|
1337
1359
|
...n,
|
|
1338
1360
|
caseIds: [...n.caseIds, t]
|
|
1339
1361
|
} : n;
|
|
1340
|
-
await
|
|
1362
|
+
await z({
|
|
1341
1363
|
...d,
|
|
1342
|
-
cases:
|
|
1364
|
+
cases: Ne(d.cases, {
|
|
1343
1365
|
id: t,
|
|
1344
1366
|
testCase: e
|
|
1345
1367
|
}),
|
|
1346
|
-
suites: r ?
|
|
1347
|
-
}), r &&
|
|
1368
|
+
suites: r ? Ne(d.suites, r) : d.suites
|
|
1369
|
+
}), r && F(r), o(e), se(t), N(void 0);
|
|
1348
1370
|
})
|
|
1349
1371
|
})]
|
|
1350
1372
|
}) : V ? /* @__PURE__ */ K("section", {
|
|
@@ -1353,36 +1375,47 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1353
1375
|
children: [
|
|
1354
1376
|
/* @__PURE__ */ K("div", {
|
|
1355
1377
|
className: Q.buttonRow,
|
|
1356
|
-
children: [/* @__PURE__ */ G("h4", { children: "用例详情" }), /* @__PURE__ */ G(
|
|
1378
|
+
children: [/* @__PURE__ */ G("h4", { children: "用例详情" }), /* @__PURE__ */ G(k, { children: "已保存" })]
|
|
1357
1379
|
}),
|
|
1358
1380
|
u({
|
|
1359
1381
|
testCase: V.testCase,
|
|
1360
1382
|
readOnly: !0,
|
|
1361
|
-
busy:
|
|
1383
|
+
busy: C || ke
|
|
1362
1384
|
}),
|
|
1363
1385
|
/* @__PURE__ */ K("div", {
|
|
1364
1386
|
className: Q.buttonRow,
|
|
1365
|
-
children: [
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
children: "编辑用例"
|
|
1370
|
-
}), /* @__PURE__ */ G($e, {
|
|
1371
|
-
label: "用例更多操作",
|
|
1372
|
-
disabled: !B,
|
|
1373
|
-
items: [{
|
|
1374
|
-
key: "delete",
|
|
1375
|
-
label: "删除用例",
|
|
1376
|
-
danger: !0,
|
|
1387
|
+
children: [
|
|
1388
|
+
/* @__PURE__ */ G(T, {
|
|
1389
|
+
type: "primary",
|
|
1390
|
+
disabled: !B,
|
|
1377
1391
|
onClick: () => void R(async () => {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1392
|
+
_(await L("/run", "POST", { caseId: V.id }));
|
|
1393
|
+
}),
|
|
1394
|
+
children: "执行用例"
|
|
1395
|
+
}),
|
|
1396
|
+
/* @__PURE__ */ G(T, {
|
|
1397
|
+
type: "text",
|
|
1398
|
+
disabled: !B,
|
|
1399
|
+
onClick: () => _e(V.testCase, V.id, ce),
|
|
1400
|
+
children: "编辑用例"
|
|
1401
|
+
}),
|
|
1402
|
+
/* @__PURE__ */ G(Qe, {
|
|
1403
|
+
label: "用例更多操作",
|
|
1404
|
+
disabled: !B,
|
|
1405
|
+
items: [{
|
|
1406
|
+
key: "delete",
|
|
1407
|
+
label: "删除用例",
|
|
1408
|
+
danger: !0,
|
|
1409
|
+
onClick: () => void R(async () => {
|
|
1410
|
+
if (d.suites.some((e) => e.caseIds.includes(V.id))) throw Error("请先从套件移除此用例");
|
|
1411
|
+
window.confirm("删除该用例?") && (await z({
|
|
1412
|
+
...d,
|
|
1413
|
+
cases: d.cases.filter(({ id: e }) => e !== V.id)
|
|
1414
|
+
}), se(void 0));
|
|
1415
|
+
})
|
|
1416
|
+
}]
|
|
1417
|
+
})
|
|
1418
|
+
]
|
|
1386
1419
|
}),
|
|
1387
1420
|
/* @__PURE__ */ K("section", {
|
|
1388
1421
|
className: Q.stack,
|
|
@@ -1390,52 +1423,52 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1390
1423
|
children: [/* @__PURE__ */ G("h5", { children: "所属套件" }), /* @__PURE__ */ K("div", {
|
|
1391
1424
|
className: Q.buttonRow,
|
|
1392
1425
|
children: [
|
|
1393
|
-
d.suites.filter((e) => e.caseIds.includes(V.id)).map((e) => /* @__PURE__ */ G(
|
|
1426
|
+
d.suites.filter((e) => e.caseIds.includes(V.id)).map((e) => /* @__PURE__ */ G(T, {
|
|
1394
1427
|
className: Q.entryLink,
|
|
1395
1428
|
type: "link",
|
|
1396
1429
|
size: "small",
|
|
1397
1430
|
onClick: () => {
|
|
1398
|
-
|
|
1431
|
+
F(e), x("suites");
|
|
1399
1432
|
},
|
|
1400
1433
|
children: e.name
|
|
1401
1434
|
}, e.id)),
|
|
1402
|
-
|
|
1435
|
+
Ie.length > 0 && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(O, {
|
|
1403
1436
|
"aria-label": "选择套件",
|
|
1404
1437
|
placeholder: "选择套件",
|
|
1405
|
-
value:
|
|
1406
|
-
options:
|
|
1438
|
+
value: be,
|
|
1439
|
+
options: Ie.map(({ id: e, name: t }) => ({
|
|
1407
1440
|
value: e,
|
|
1408
1441
|
label: t
|
|
1409
1442
|
})),
|
|
1410
|
-
loading:
|
|
1443
|
+
loading: C,
|
|
1411
1444
|
disabled: !B,
|
|
1412
|
-
onChange:
|
|
1413
|
-
}), /* @__PURE__ */ G(
|
|
1445
|
+
onChange: xe
|
|
1446
|
+
}), /* @__PURE__ */ G(T, {
|
|
1414
1447
|
type: "text",
|
|
1415
|
-
disabled: !B || !
|
|
1448
|
+
disabled: !B || !be,
|
|
1416
1449
|
onClick: () => {
|
|
1417
|
-
let e =
|
|
1450
|
+
let e = Ie.find((e) => e.id === be);
|
|
1418
1451
|
e && R(async () => {
|
|
1419
|
-
await
|
|
1452
|
+
await z({
|
|
1420
1453
|
...d,
|
|
1421
|
-
suites:
|
|
1454
|
+
suites: Ne(d.suites, {
|
|
1422
1455
|
...e,
|
|
1423
1456
|
caseIds: [...e.caseIds, V.id]
|
|
1424
1457
|
})
|
|
1425
|
-
}),
|
|
1458
|
+
}), xe(void 0);
|
|
1426
1459
|
});
|
|
1427
1460
|
},
|
|
1428
1461
|
children: "添加到套件"
|
|
1429
1462
|
})] }),
|
|
1430
|
-
/* @__PURE__ */ G(
|
|
1463
|
+
/* @__PURE__ */ G(T, {
|
|
1431
1464
|
type: "link",
|
|
1432
1465
|
disabled: !B,
|
|
1433
1466
|
onClick: () => {
|
|
1434
|
-
|
|
1467
|
+
F({
|
|
1435
1468
|
id: "",
|
|
1436
1469
|
name: "",
|
|
1437
1470
|
caseIds: [V.id]
|
|
1438
|
-
}),
|
|
1471
|
+
}), A(!0), x("suites");
|
|
1439
1472
|
},
|
|
1440
1473
|
children: "新建套件"
|
|
1441
1474
|
})
|
|
@@ -1445,15 +1478,15 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1445
1478
|
]
|
|
1446
1479
|
}) : /* @__PURE__ */ K("div", {
|
|
1447
1480
|
className: Q.stack,
|
|
1448
|
-
children: [!d.cases.length && /* @__PURE__ */ G(
|
|
1481
|
+
children: [!d.cases.length && /* @__PURE__ */ G(le, { description: "暂无用例" }), /* @__PURE__ */ G("ul", {
|
|
1449
1482
|
className: Q.resourceList,
|
|
1450
1483
|
children: d.cases.map(({ id: e, testCase: t, url: n }) => /* @__PURE__ */ G("li", { children: /* @__PURE__ */ K("div", { children: [
|
|
1451
|
-
/* @__PURE__ */ G(
|
|
1484
|
+
/* @__PURE__ */ G(T, {
|
|
1452
1485
|
type: "link",
|
|
1453
1486
|
size: "small",
|
|
1454
1487
|
className: Q.entryLink,
|
|
1455
1488
|
onClick: () => {
|
|
1456
|
-
|
|
1489
|
+
fe(void 0), se(e), xe(void 0);
|
|
1457
1490
|
},
|
|
1458
1491
|
children: /* @__PURE__ */ G("span", {
|
|
1459
1492
|
className: Q.resourceName,
|
|
@@ -1462,7 +1495,7 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1462
1495
|
})
|
|
1463
1496
|
}),
|
|
1464
1497
|
" ",
|
|
1465
|
-
/* @__PURE__ */ K(
|
|
1498
|
+
/* @__PURE__ */ K(k, { children: [t.steps.length, " 步"] }),
|
|
1466
1499
|
/* @__PURE__ */ G("br", {}),
|
|
1467
1500
|
/* @__PURE__ */ G("code", { children: n ?? t.path })
|
|
1468
1501
|
] }) }, e))
|
|
@@ -1472,18 +1505,18 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1472
1505
|
{
|
|
1473
1506
|
key: "suites",
|
|
1474
1507
|
label: "套件",
|
|
1475
|
-
children:
|
|
1508
|
+
children: pe ? /* @__PURE__ */ K("section", {
|
|
1476
1509
|
className: Q.stack,
|
|
1477
1510
|
"aria-label": "套件编辑",
|
|
1478
1511
|
children: [
|
|
1479
|
-
/* @__PURE__ */ G(
|
|
1480
|
-
disabled:
|
|
1512
|
+
/* @__PURE__ */ G(T, {
|
|
1513
|
+
disabled: C,
|
|
1481
1514
|
onClick: () => {
|
|
1482
|
-
|
|
1515
|
+
Be() && A(!1);
|
|
1483
1516
|
},
|
|
1484
1517
|
children: "取消"
|
|
1485
1518
|
}),
|
|
1486
|
-
/* @__PURE__ */ G("h4", { children:
|
|
1519
|
+
/* @__PURE__ */ G("h4", { children: P.id ? "编辑套件" : "新建套件" }),
|
|
1487
1520
|
/* @__PURE__ */ K("div", {
|
|
1488
1521
|
className: Q.stack,
|
|
1489
1522
|
children: [
|
|
@@ -1491,19 +1524,19 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1491
1524
|
htmlFor: "assistant-suite-name",
|
|
1492
1525
|
children: "套件名称"
|
|
1493
1526
|
}),
|
|
1494
|
-
/* @__PURE__ */ G(
|
|
1527
|
+
/* @__PURE__ */ G(D, {
|
|
1495
1528
|
id: "assistant-suite-name",
|
|
1496
1529
|
"aria-required": "true",
|
|
1497
|
-
"aria-invalid": !
|
|
1498
|
-
"aria-describedby":
|
|
1530
|
+
"aria-invalid": !P.name.trim(),
|
|
1531
|
+
"aria-describedby": P.name.trim() ? void 0 : "assistant-suite-name-error",
|
|
1499
1532
|
maxLength: 100,
|
|
1500
|
-
value:
|
|
1501
|
-
onChange: (e) =>
|
|
1502
|
-
...
|
|
1533
|
+
value: P.name,
|
|
1534
|
+
onChange: (e) => F({
|
|
1535
|
+
...P,
|
|
1503
1536
|
name: e.target.value
|
|
1504
1537
|
})
|
|
1505
1538
|
}),
|
|
1506
|
-
!
|
|
1539
|
+
!P.name.trim() && /* @__PURE__ */ G("span", {
|
|
1507
1540
|
className: Q.hint,
|
|
1508
1541
|
id: "assistant-suite-name-error",
|
|
1509
1542
|
children: "请输入套件名称"
|
|
@@ -1511,26 +1544,26 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1511
1544
|
]
|
|
1512
1545
|
}),
|
|
1513
1546
|
/* @__PURE__ */ G(ft, {
|
|
1514
|
-
options:
|
|
1515
|
-
values:
|
|
1516
|
-
onChange: (e) =>
|
|
1517
|
-
...
|
|
1547
|
+
options: Pe,
|
|
1548
|
+
values: P.caseIds,
|
|
1549
|
+
onChange: (e) => F({
|
|
1550
|
+
...P,
|
|
1518
1551
|
caseIds: e
|
|
1519
1552
|
})
|
|
1520
1553
|
}),
|
|
1521
|
-
/* @__PURE__ */ G(
|
|
1554
|
+
/* @__PURE__ */ G(T, {
|
|
1522
1555
|
type: "primary",
|
|
1523
|
-
disabled: !B || !
|
|
1556
|
+
disabled: !B || !P.name.trim() || !P.caseIds.length,
|
|
1524
1557
|
onClick: () => void R(async () => {
|
|
1525
1558
|
let e = {
|
|
1526
|
-
...
|
|
1527
|
-
id:
|
|
1528
|
-
name:
|
|
1559
|
+
...P,
|
|
1560
|
+
id: P.id || crypto.randomUUID(),
|
|
1561
|
+
name: P.name.trim()
|
|
1529
1562
|
};
|
|
1530
|
-
await
|
|
1563
|
+
await z({
|
|
1531
1564
|
...d,
|
|
1532
|
-
suites:
|
|
1533
|
-
}),
|
|
1565
|
+
suites: Ne(d.suites, e)
|
|
1566
|
+
}), F(e), A(!1);
|
|
1534
1567
|
}),
|
|
1535
1568
|
children: "保存套件"
|
|
1536
1569
|
})
|
|
@@ -1542,47 +1575,55 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1542
1575
|
/* @__PURE__ */ G("h4", { children: H.name }),
|
|
1543
1576
|
/* @__PURE__ */ G("ol", {
|
|
1544
1577
|
className: Q.list,
|
|
1545
|
-
children: H.caseIds.map((e, t) => /* @__PURE__ */ G("li", { children: /* @__PURE__ */ G(
|
|
1578
|
+
children: H.caseIds.map((e, t) => /* @__PURE__ */ G("li", { children: /* @__PURE__ */ G(T, {
|
|
1546
1579
|
type: "link",
|
|
1547
1580
|
size: "small",
|
|
1548
1581
|
className: Q.entryLink,
|
|
1549
1582
|
onClick: () => {
|
|
1550
|
-
|
|
1583
|
+
se(e), fe(H.id), xe(void 0), x("cases");
|
|
1551
1584
|
},
|
|
1552
|
-
children:
|
|
1585
|
+
children: Pe.find(({ value: t }) => t === e)?.label ?? e
|
|
1553
1586
|
}) }, t))
|
|
1554
1587
|
}),
|
|
1555
1588
|
/* @__PURE__ */ K("div", {
|
|
1556
1589
|
className: Q.buttonRow,
|
|
1557
1590
|
children: [
|
|
1558
|
-
/* @__PURE__ */ G(
|
|
1591
|
+
/* @__PURE__ */ G(T, {
|
|
1592
|
+
type: "primary",
|
|
1593
|
+
disabled: !B || !H.caseIds.length,
|
|
1594
|
+
onClick: () => void R(async () => {
|
|
1595
|
+
_(await L("/run", "POST", { suiteId: H.id }));
|
|
1596
|
+
}),
|
|
1597
|
+
children: "执行套件"
|
|
1598
|
+
}),
|
|
1599
|
+
/* @__PURE__ */ G(T, {
|
|
1559
1600
|
type: "primary",
|
|
1560
1601
|
disabled: !B,
|
|
1561
1602
|
onClick: () => {
|
|
1562
|
-
|
|
1603
|
+
F(H), A(!0);
|
|
1563
1604
|
},
|
|
1564
1605
|
children: "编辑套件"
|
|
1565
1606
|
}),
|
|
1566
|
-
/* @__PURE__ */ G(
|
|
1607
|
+
/* @__PURE__ */ G(T, {
|
|
1567
1608
|
type: "text",
|
|
1568
1609
|
disabled: !B,
|
|
1569
|
-
onClick: () =>
|
|
1610
|
+
onClick: () => _e(p(), void 0, H.id),
|
|
1570
1611
|
children: "新建用例"
|
|
1571
1612
|
}),
|
|
1572
|
-
/* @__PURE__ */ G(
|
|
1613
|
+
/* @__PURE__ */ G(T, {
|
|
1573
1614
|
type: "text",
|
|
1574
1615
|
disabled: !B,
|
|
1575
1616
|
onClick: () => {
|
|
1576
|
-
|
|
1617
|
+
Se({
|
|
1577
1618
|
id: "",
|
|
1578
1619
|
name: "",
|
|
1579
1620
|
suiteIds: [H.id],
|
|
1580
1621
|
repeat: 1
|
|
1581
|
-
}),
|
|
1622
|
+
}), j(!0), x("plans");
|
|
1582
1623
|
},
|
|
1583
1624
|
children: "创建计划"
|
|
1584
1625
|
}),
|
|
1585
|
-
/* @__PURE__ */ G(
|
|
1626
|
+
/* @__PURE__ */ G(Qe, {
|
|
1586
1627
|
label: "套件更多操作",
|
|
1587
1628
|
disabled: !B,
|
|
1588
1629
|
items: [{
|
|
@@ -1591,10 +1632,10 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1591
1632
|
danger: !0,
|
|
1592
1633
|
onClick: () => void R(async () => {
|
|
1593
1634
|
if (d.plans.some((e) => e.suiteIds.includes(H.id))) throw Error("请先从计划移除此套件");
|
|
1594
|
-
window.confirm("删除该套件?") && (await
|
|
1635
|
+
window.confirm("删除该套件?") && (await z({
|
|
1595
1636
|
...d,
|
|
1596
1637
|
suites: d.suites.filter(({ id: e }) => e !== H.id)
|
|
1597
|
-
}),
|
|
1638
|
+
}), F({
|
|
1598
1639
|
id: "",
|
|
1599
1640
|
name: "",
|
|
1600
1641
|
caseIds: []
|
|
@@ -1607,14 +1648,14 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1607
1648
|
]
|
|
1608
1649
|
}) : /* @__PURE__ */ K("div", {
|
|
1609
1650
|
className: Q.stack,
|
|
1610
|
-
children: [!d.suites.length && /* @__PURE__ */ G(
|
|
1651
|
+
children: [!d.suites.length && /* @__PURE__ */ G(le, { description: "暂无套件" }), /* @__PURE__ */ G("ul", {
|
|
1611
1652
|
className: Q.resourceList,
|
|
1612
|
-
children: d.suites.map((e) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G(
|
|
1653
|
+
children: d.suites.map((e) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G(T, {
|
|
1613
1654
|
type: "link",
|
|
1614
1655
|
size: "small",
|
|
1615
1656
|
className: Q.entryLink,
|
|
1616
1657
|
onClick: () => {
|
|
1617
|
-
|
|
1658
|
+
F(e);
|
|
1618
1659
|
},
|
|
1619
1660
|
children: /* @__PURE__ */ G("span", {
|
|
1620
1661
|
className: Q.resourceName,
|
|
@@ -1632,14 +1673,14 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1632
1673
|
className: Q.stack,
|
|
1633
1674
|
"aria-label": "计划编辑",
|
|
1634
1675
|
children: [
|
|
1635
|
-
/* @__PURE__ */ G(
|
|
1636
|
-
disabled:
|
|
1676
|
+
/* @__PURE__ */ G(T, {
|
|
1677
|
+
disabled: C,
|
|
1637
1678
|
onClick: () => {
|
|
1638
|
-
|
|
1679
|
+
Ve() && j(!1);
|
|
1639
1680
|
},
|
|
1640
1681
|
children: "取消"
|
|
1641
1682
|
}),
|
|
1642
|
-
/* @__PURE__ */ G("h4", { children:
|
|
1683
|
+
/* @__PURE__ */ G("h4", { children: I.id ? "编辑计划" : "新建计划" }),
|
|
1643
1684
|
/* @__PURE__ */ K("div", {
|
|
1644
1685
|
className: Q.stack,
|
|
1645
1686
|
children: [
|
|
@@ -1647,19 +1688,19 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1647
1688
|
htmlFor: "assistant-plan-name",
|
|
1648
1689
|
children: "计划名称"
|
|
1649
1690
|
}),
|
|
1650
|
-
/* @__PURE__ */ G(
|
|
1691
|
+
/* @__PURE__ */ G(D, {
|
|
1651
1692
|
id: "assistant-plan-name",
|
|
1652
1693
|
"aria-required": "true",
|
|
1653
|
-
"aria-invalid": !
|
|
1654
|
-
"aria-describedby":
|
|
1694
|
+
"aria-invalid": !I.name.trim(),
|
|
1695
|
+
"aria-describedby": I.name.trim() ? void 0 : "assistant-plan-name-error",
|
|
1655
1696
|
maxLength: 100,
|
|
1656
|
-
value:
|
|
1657
|
-
onChange: (e) =>
|
|
1658
|
-
...
|
|
1697
|
+
value: I.name,
|
|
1698
|
+
onChange: (e) => Se({
|
|
1699
|
+
...I,
|
|
1659
1700
|
name: e.target.value
|
|
1660
1701
|
})
|
|
1661
1702
|
}),
|
|
1662
|
-
!
|
|
1703
|
+
!I.name.trim() && /* @__PURE__ */ G("span", {
|
|
1663
1704
|
className: Q.hint,
|
|
1664
1705
|
id: "assistant-plan-name-error",
|
|
1665
1706
|
children: "请输入计划名称"
|
|
@@ -1669,39 +1710,39 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1669
1710
|
/* @__PURE__ */ K("label", { children: [
|
|
1670
1711
|
"重复轮数",
|
|
1671
1712
|
" ",
|
|
1672
|
-
/* @__PURE__ */ G(
|
|
1713
|
+
/* @__PURE__ */ G(ue, {
|
|
1673
1714
|
min: 1,
|
|
1674
1715
|
max: 20,
|
|
1675
1716
|
precision: 0,
|
|
1676
1717
|
"aria-label": "重复轮数",
|
|
1677
|
-
value:
|
|
1678
|
-
onChange: (e) =>
|
|
1679
|
-
...
|
|
1718
|
+
value: I.repeat,
|
|
1719
|
+
onChange: (e) => Se({
|
|
1720
|
+
...I,
|
|
1680
1721
|
repeat: e ?? 1
|
|
1681
1722
|
})
|
|
1682
1723
|
})
|
|
1683
1724
|
] }),
|
|
1684
1725
|
/* @__PURE__ */ G(ft, {
|
|
1685
|
-
options:
|
|
1686
|
-
values:
|
|
1687
|
-
onChange: (e) =>
|
|
1688
|
-
...
|
|
1726
|
+
options: Fe,
|
|
1727
|
+
values: I.suiteIds,
|
|
1728
|
+
onChange: (e) => Se({
|
|
1729
|
+
...I,
|
|
1689
1730
|
suiteIds: e
|
|
1690
1731
|
})
|
|
1691
1732
|
}),
|
|
1692
|
-
/* @__PURE__ */ G(
|
|
1733
|
+
/* @__PURE__ */ G(T, {
|
|
1693
1734
|
type: "primary",
|
|
1694
|
-
disabled: !B || !
|
|
1735
|
+
disabled: !B || !I.name.trim() || !I.suiteIds.length,
|
|
1695
1736
|
onClick: () => void R(async () => {
|
|
1696
1737
|
let e = {
|
|
1697
|
-
...
|
|
1698
|
-
id:
|
|
1699
|
-
name:
|
|
1738
|
+
...I,
|
|
1739
|
+
id: I.id || crypto.randomUUID(),
|
|
1740
|
+
name: I.name.trim()
|
|
1700
1741
|
};
|
|
1701
|
-
await
|
|
1742
|
+
await z({
|
|
1702
1743
|
...d,
|
|
1703
|
-
plans:
|
|
1704
|
-
}),
|
|
1744
|
+
plans: Ne(d.plans, e)
|
|
1745
|
+
}), Se(e), j(!1);
|
|
1705
1746
|
}),
|
|
1706
1747
|
children: "保存计划"
|
|
1707
1748
|
})
|
|
@@ -1718,27 +1759,27 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1718
1759
|
] }),
|
|
1719
1760
|
/* @__PURE__ */ G("ol", {
|
|
1720
1761
|
className: Q.list,
|
|
1721
|
-
children: U.suiteIds.map((e, t) => /* @__PURE__ */ G("li", { children: /* @__PURE__ */ G(
|
|
1762
|
+
children: U.suiteIds.map((e, t) => /* @__PURE__ */ G("li", { children: /* @__PURE__ */ G(T, {
|
|
1722
1763
|
type: "link",
|
|
1723
1764
|
size: "small",
|
|
1724
1765
|
className: Q.entryLink,
|
|
1725
1766
|
onClick: () => {
|
|
1726
1767
|
let t = d.suites.find((t) => t.id === e);
|
|
1727
|
-
t && (
|
|
1768
|
+
t && (F(t), x("suites"));
|
|
1728
1769
|
},
|
|
1729
|
-
children:
|
|
1770
|
+
children: Fe.find(({ value: t }) => t === e)?.label ?? e
|
|
1730
1771
|
}) }, t))
|
|
1731
1772
|
}),
|
|
1732
1773
|
/* @__PURE__ */ K("div", {
|
|
1733
1774
|
className: Q.buttonRow,
|
|
1734
|
-
children: [/* @__PURE__ */ G(
|
|
1775
|
+
children: [/* @__PURE__ */ G(T, {
|
|
1735
1776
|
type: "text",
|
|
1736
1777
|
disabled: !B,
|
|
1737
1778
|
onClick: () => {
|
|
1738
|
-
|
|
1779
|
+
Se(U), j(!0);
|
|
1739
1780
|
},
|
|
1740
1781
|
children: "编辑计划"
|
|
1741
|
-
}), /* @__PURE__ */ G(
|
|
1782
|
+
}), /* @__PURE__ */ G(Qe, {
|
|
1742
1783
|
label: "计划更多操作",
|
|
1743
1784
|
disabled: !B,
|
|
1744
1785
|
items: [{
|
|
@@ -1746,10 +1787,10 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1746
1787
|
label: "删除计划",
|
|
1747
1788
|
danger: !0,
|
|
1748
1789
|
onClick: () => void R(async () => {
|
|
1749
|
-
window.confirm("删除该计划?") && (await
|
|
1790
|
+
window.confirm("删除该计划?") && (await z({
|
|
1750
1791
|
...d,
|
|
1751
1792
|
plans: d.plans.filter(({ id: e }) => e !== U.id)
|
|
1752
|
-
}),
|
|
1793
|
+
}), Se({
|
|
1753
1794
|
id: "",
|
|
1754
1795
|
name: "",
|
|
1755
1796
|
suiteIds: [],
|
|
@@ -1763,25 +1804,25 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1763
1804
|
className: Q.hint,
|
|
1764
1805
|
children: "回放会实际操作测试数据,且不会自动恢复。"
|
|
1765
1806
|
}),
|
|
1766
|
-
/* @__PURE__ */ G(
|
|
1807
|
+
/* @__PURE__ */ G(T, {
|
|
1767
1808
|
type: "primary",
|
|
1768
1809
|
disabled: !B,
|
|
1769
1810
|
onClick: () => void R(async () => {
|
|
1770
1811
|
let e = await L("/run", "POST", { planId: U.id });
|
|
1771
|
-
h([e, ...m]),
|
|
1812
|
+
h([e, ...m]), we(e.id), x("reports");
|
|
1772
1813
|
}),
|
|
1773
1814
|
children: "运行计划"
|
|
1774
1815
|
})
|
|
1775
1816
|
]
|
|
1776
1817
|
}) : /* @__PURE__ */ K("div", {
|
|
1777
1818
|
className: Q.stack,
|
|
1778
|
-
children: [!d.plans.length && /* @__PURE__ */ G(
|
|
1819
|
+
children: [!d.plans.length && /* @__PURE__ */ G(le, { description: "暂无计划" }), /* @__PURE__ */ G("ul", {
|
|
1779
1820
|
className: Q.resourceList,
|
|
1780
|
-
children: d.plans.map((e) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G(
|
|
1821
|
+
children: d.plans.map((e) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G(T, {
|
|
1781
1822
|
type: "link",
|
|
1782
1823
|
size: "small",
|
|
1783
1824
|
className: Q.entryLink,
|
|
1784
|
-
onClick: () =>
|
|
1825
|
+
onClick: () => Se(e),
|
|
1785
1826
|
children: /* @__PURE__ */ G("span", {
|
|
1786
1827
|
className: Q.resourceName,
|
|
1787
1828
|
title: e.name,
|
|
@@ -1804,17 +1845,17 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1804
1845
|
children: [
|
|
1805
1846
|
/* @__PURE__ */ K("div", {
|
|
1806
1847
|
className: Q.buttonRow,
|
|
1807
|
-
children: [/* @__PURE__ */ G(
|
|
1848
|
+
children: [/* @__PURE__ */ G(T, {
|
|
1808
1849
|
type: "text",
|
|
1809
|
-
disabled:
|
|
1850
|
+
disabled: C,
|
|
1810
1851
|
onClick: () => void R(async () => {
|
|
1811
|
-
h(await L("/runs")),
|
|
1852
|
+
h(await L("/runs")), De && Ee(await L(`/runs/${De}`));
|
|
1812
1853
|
}),
|
|
1813
1854
|
children: "刷新报告"
|
|
1814
|
-
}), /* @__PURE__ */ G(
|
|
1855
|
+
}), /* @__PURE__ */ G(T, {
|
|
1815
1856
|
type: "primary",
|
|
1816
1857
|
danger: !0,
|
|
1817
|
-
disabled:
|
|
1858
|
+
disabled: C || !ke,
|
|
1818
1859
|
onClick: () => void R(async () => {
|
|
1819
1860
|
let e = await L("/stop", "POST", {});
|
|
1820
1861
|
h(m.map((t) => t.id === e.id ? e : t));
|
|
@@ -1822,37 +1863,37 @@ function pt({ base: e, name: t, onBack: n, onRename: r, draft: i, disabled: a, o
|
|
|
1822
1863
|
children: "停止计划"
|
|
1823
1864
|
})]
|
|
1824
1865
|
}),
|
|
1825
|
-
!m.length && /* @__PURE__ */ G(
|
|
1826
|
-
m.length > 0 && /* @__PURE__ */ G(
|
|
1866
|
+
!m.length && /* @__PURE__ */ G(le, { description: "暂无运行报告" }),
|
|
1867
|
+
m.length > 0 && /* @__PURE__ */ G(O, {
|
|
1827
1868
|
"aria-label": "运行报告",
|
|
1828
|
-
value:
|
|
1829
|
-
onChange:
|
|
1869
|
+
value: Ce ?? m[0].id,
|
|
1870
|
+
onChange: we,
|
|
1830
1871
|
options: m.map((e) => ({
|
|
1831
1872
|
value: e.id,
|
|
1832
1873
|
label: `${e.planName} · ${ut[e.state] ?? e.state} · ${e.id.slice(0, 8)}`
|
|
1833
1874
|
}))
|
|
1834
1875
|
}),
|
|
1835
|
-
|
|
1836
|
-
run:
|
|
1876
|
+
Te && Te.id === De && /* @__PURE__ */ G(dt, {
|
|
1877
|
+
run: Te,
|
|
1837
1878
|
base: e,
|
|
1838
|
-
onExport: () =>
|
|
1879
|
+
onExport: () => Me(Te, `研发小蜜报告-${Te.id}.json`)
|
|
1839
1880
|
})
|
|
1840
1881
|
]
|
|
1841
1882
|
})
|
|
1842
1883
|
}
|
|
1843
1884
|
]
|
|
1844
|
-
}) }) : /* @__PURE__ */ G(
|
|
1885
|
+
})] }) : /* @__PURE__ */ G(T, {
|
|
1845
1886
|
className: Q.fitButton,
|
|
1846
|
-
loading:
|
|
1847
|
-
onClick:
|
|
1848
|
-
children:
|
|
1887
|
+
loading: C,
|
|
1888
|
+
onClick: je,
|
|
1889
|
+
children: C ? "正在读取测试库" : "重试读取测试库"
|
|
1849
1890
|
})
|
|
1850
1891
|
]
|
|
1851
1892
|
});
|
|
1852
1893
|
}
|
|
1853
1894
|
// src/pages/assistant/components/TestLibraryPanel/index.tsx
|
|
1854
1895
|
function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
1855
|
-
let r = `${e.replace(/\/$/, "")}/library`, i = lt(r), [a, o] =
|
|
1896
|
+
let r = `${e.replace(/\/$/, "")}/library`, i = lt(r), [a, o] = S(), [s, c] = S(), [l, u] = S(), [d, f] = S(!1), [p, m] = S(""), h = async (e) => {
|
|
1856
1897
|
let t = await i("/collections", "GET", void 0, e);
|
|
1857
1898
|
e?.aborted || o(t.collections);
|
|
1858
1899
|
}, g = async (e, t) => {
|
|
@@ -1865,11 +1906,11 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
1865
1906
|
t?.aborted || f(!1);
|
|
1866
1907
|
}
|
|
1867
1908
|
};
|
|
1868
|
-
|
|
1909
|
+
b(() => {
|
|
1869
1910
|
let e = new AbortController();
|
|
1870
1911
|
return g(() => h(e.signal), e.signal), () => e.abort();
|
|
1871
1912
|
}, [i]);
|
|
1872
|
-
let _ = /* @__PURE__ */ K(
|
|
1913
|
+
let _ = /* @__PURE__ */ K(ae, {
|
|
1873
1914
|
className: Q.card,
|
|
1874
1915
|
"aria-label": "测试库列表",
|
|
1875
1916
|
styles: { body: {
|
|
@@ -1881,18 +1922,18 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
1881
1922
|
children: [
|
|
1882
1923
|
/* @__PURE__ */ K("header", {
|
|
1883
1924
|
className: Q.header,
|
|
1884
|
-
children: [/* @__PURE__ */ G("h3", { children: "测试库" }), a && !l && /* @__PURE__ */ G(
|
|
1925
|
+
children: [/* @__PURE__ */ G("h3", { children: "测试库" }), a && !l && /* @__PURE__ */ G(T, {
|
|
1885
1926
|
type: "primary",
|
|
1886
1927
|
disabled: d || n.disabled,
|
|
1887
1928
|
onClick: () => u({ name: "" }),
|
|
1888
1929
|
children: "新建测试库"
|
|
1889
1930
|
})]
|
|
1890
1931
|
}),
|
|
1891
|
-
p && /* @__PURE__ */ G(
|
|
1932
|
+
p && /* @__PURE__ */ G(w, {
|
|
1892
1933
|
type: "error",
|
|
1893
1934
|
title: p
|
|
1894
1935
|
}),
|
|
1895
|
-
n.incomingDraft && /* @__PURE__ */ G(
|
|
1936
|
+
n.incomingDraft && /* @__PURE__ */ G(w, {
|
|
1896
1937
|
type: "info",
|
|
1897
1938
|
title: "请选择测试库,继续编辑时间线用例"
|
|
1898
1939
|
}),
|
|
@@ -1909,7 +1950,7 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
1909
1950
|
htmlFor: "assistant-library-name",
|
|
1910
1951
|
children: "测试库名称"
|
|
1911
1952
|
}),
|
|
1912
|
-
/* @__PURE__ */ G(
|
|
1953
|
+
/* @__PURE__ */ G(D, {
|
|
1913
1954
|
id: "assistant-library-name",
|
|
1914
1955
|
"aria-required": "true",
|
|
1915
1956
|
"aria-invalid": !l.name.trim(),
|
|
@@ -1929,22 +1970,22 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
1929
1970
|
}),
|
|
1930
1971
|
/* @__PURE__ */ K("div", {
|
|
1931
1972
|
className: Q.buttonRow,
|
|
1932
|
-
children: [/* @__PURE__ */ G(
|
|
1973
|
+
children: [/* @__PURE__ */ G(T, {
|
|
1933
1974
|
htmlType: "submit",
|
|
1934
1975
|
type: "primary",
|
|
1935
1976
|
loading: d,
|
|
1936
1977
|
disabled: !l.name.trim(),
|
|
1937
1978
|
children: l.id ? "保存" : "创建"
|
|
1938
|
-
}), /* @__PURE__ */ G(
|
|
1979
|
+
}), /* @__PURE__ */ G(T, {
|
|
1939
1980
|
disabled: d,
|
|
1940
1981
|
onClick: () => u(void 0),
|
|
1941
1982
|
children: "取消"
|
|
1942
1983
|
})]
|
|
1943
1984
|
})
|
|
1944
1985
|
]
|
|
1945
|
-
}) : /* @__PURE__ */ K(W, { children: [!a.length && /* @__PURE__ */ G(
|
|
1986
|
+
}) : /* @__PURE__ */ K(W, { children: [!a.length && /* @__PURE__ */ G(le, { description: "暂无测试库" }), /* @__PURE__ */ G("ul", {
|
|
1946
1987
|
className: Q.resourceList,
|
|
1947
|
-
children: a.map((e) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G(
|
|
1988
|
+
children: a.map((e) => /* @__PURE__ */ K("li", { children: [/* @__PURE__ */ G(T, {
|
|
1948
1989
|
type: "link",
|
|
1949
1990
|
size: "small",
|
|
1950
1991
|
className: Q.entryLink,
|
|
@@ -1964,7 +2005,7 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
1964
2005
|
e.planCount,
|
|
1965
2006
|
" 个计划"
|
|
1966
2007
|
] })] }, e.id))
|
|
1967
|
-
})] }) : /* @__PURE__ */ G(
|
|
2008
|
+
})] }) : /* @__PURE__ */ G(T, {
|
|
1968
2009
|
className: Q.fitButton,
|
|
1969
2010
|
loading: d,
|
|
1970
2011
|
onClick: () => void g(h),
|
|
@@ -1975,7 +2016,7 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
1975
2016
|
return /* @__PURE__ */ K(W, { children: [
|
|
1976
2017
|
s && /* @__PURE__ */ G("div", {
|
|
1977
2018
|
hidden: !!l,
|
|
1978
|
-
children: /* @__PURE__ */
|
|
2019
|
+
children: /* @__PURE__ */ v(pt, {
|
|
1979
2020
|
...n,
|
|
1980
2021
|
key: s.id,
|
|
1981
2022
|
base: `${r}/collections/${encodeURIComponent(s.id)}`,
|
|
@@ -2003,43 +2044,63 @@ function mt({ bridgeUrl: e, exploration: t, ...n }) {
|
|
|
2003
2044
|
}
|
|
2004
2045
|
// src/pages/assistant/components/AutomationPanel/index.tsx
|
|
2005
2046
|
function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
2006
|
-
let i =
|
|
2047
|
+
let i = C(s.subscribe, s.getState), a = ne(null), [o, c] = S(""), [l, u] = S(null), d = (e, t, n) => {
|
|
2007
2048
|
u({
|
|
2008
2049
|
position: e,
|
|
2009
|
-
edit: t
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
}));
|
|
2014
|
-
}, [p, m] = x(!1), h = async (e) => {
|
|
2050
|
+
edit: t,
|
|
2051
|
+
anchor: n
|
|
2052
|
+
});
|
|
2053
|
+
}, [f, p] = S(!1), m = async (e) => {
|
|
2015
2054
|
try {
|
|
2016
2055
|
c(""), await e();
|
|
2017
2056
|
} catch (e) {
|
|
2018
2057
|
c(e instanceof Error ? e.message : "操作失败");
|
|
2019
2058
|
}
|
|
2020
|
-
},
|
|
2059
|
+
}, h = (e, t) => s.edit({
|
|
2021
2060
|
...i.draft,
|
|
2022
2061
|
steps: i.draft.steps.map((n, r) => r === e ? {
|
|
2023
2062
|
...n,
|
|
2024
2063
|
...t,
|
|
2025
2064
|
supplemented: !0
|
|
2026
2065
|
} : n)
|
|
2027
|
-
})
|
|
2066
|
+
}), g = (e, t) => l && /* @__PURE__ */ G($e, {
|
|
2067
|
+
initial: l.edit === void 0 ? void 0 : e.steps[l.edit]?.assertion,
|
|
2068
|
+
steps: e.steps,
|
|
2069
|
+
position: l.position,
|
|
2070
|
+
disabled: t || i.recording,
|
|
2071
|
+
onCancel: () => u(null),
|
|
2072
|
+
onSave: (t, n) => {
|
|
2073
|
+
let r = [...e.steps];
|
|
2074
|
+
l.edit === void 0 ? r.splice(n, 0, {
|
|
2075
|
+
kind: "assert",
|
|
2076
|
+
assertion: t,
|
|
2077
|
+
supplemented: !0
|
|
2078
|
+
}) : r[l.edit] = {
|
|
2079
|
+
...r[l.edit],
|
|
2080
|
+
kind: "assert",
|
|
2081
|
+
assertion: t,
|
|
2082
|
+
supplemented: !0
|
|
2083
|
+
}, s.edit((0, X.parseCase)({
|
|
2084
|
+
...e,
|
|
2085
|
+
steps: r
|
|
2086
|
+
})), u(null);
|
|
2087
|
+
}
|
|
2088
|
+
}, `${l.position}-${l.edit ?? "new"}`);
|
|
2028
2089
|
return /* @__PURE__ */ K("div", {
|
|
2029
|
-
className:
|
|
2090
|
+
className: Y.section,
|
|
2030
2091
|
"data-assistant-part": "section automation",
|
|
2031
|
-
children: [o && /* @__PURE__ */ G(
|
|
2092
|
+
children: [o && /* @__PURE__ */ G(w, {
|
|
2032
2093
|
closable: !0,
|
|
2033
2094
|
onClose: () => c(""),
|
|
2034
2095
|
type: "error",
|
|
2035
2096
|
title: o
|
|
2036
2097
|
}), /* @__PURE__ */ G("div", {
|
|
2037
|
-
className:
|
|
2098
|
+
className: Y.automationLayout,
|
|
2038
2099
|
"data-assistant-part": "automation-layout",
|
|
2039
2100
|
children: /* @__PURE__ */ G(mt, {
|
|
2040
2101
|
bridgeUrl: t,
|
|
2041
2102
|
draft: i.draft,
|
|
2042
|
-
disabled:
|
|
2103
|
+
disabled: f || i.recording,
|
|
2043
2104
|
recording: i.recording,
|
|
2044
2105
|
incomingDraft: n,
|
|
2045
2106
|
onConsumeDraft: r,
|
|
@@ -2049,18 +2110,18 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2049
2110
|
exploration: /* @__PURE__ */ G(ct, {
|
|
2050
2111
|
bridgeUrl: t,
|
|
2051
2112
|
disabled: i.recording,
|
|
2052
|
-
onRunningChange:
|
|
2113
|
+
onRunningChange: p
|
|
2053
2114
|
}),
|
|
2054
|
-
renderCase: ({ testCase: t, readOnly: n = !1, save: r, busy: o, dirty: c, cancel:
|
|
2115
|
+
renderCase: ({ testCase: t, readOnly: n = !1, save: r, busy: o, dirty: c, cancel: f }) => /* @__PURE__ */ K(W, { children: [
|
|
2055
2116
|
/* @__PURE__ */ K("div", {
|
|
2056
|
-
className:
|
|
2117
|
+
className: Y.field,
|
|
2057
2118
|
"data-assistant-part": "field",
|
|
2058
2119
|
children: [
|
|
2059
2120
|
/* @__PURE__ */ G("label", {
|
|
2060
2121
|
htmlFor: "assistant-case-name",
|
|
2061
2122
|
children: "用例名称"
|
|
2062
2123
|
}),
|
|
2063
|
-
/* @__PURE__ */ G(
|
|
2124
|
+
/* @__PURE__ */ G(D, {
|
|
2064
2125
|
id: "assistant-case-name",
|
|
2065
2126
|
readOnly: n,
|
|
2066
2127
|
"aria-required": !n,
|
|
@@ -2077,19 +2138,19 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2077
2138
|
})
|
|
2078
2139
|
}),
|
|
2079
2140
|
!t.name.trim() && /* @__PURE__ */ G("span", {
|
|
2080
|
-
className:
|
|
2141
|
+
className: Y.hint,
|
|
2081
2142
|
id: "assistant-case-name-error",
|
|
2082
2143
|
children: "请输入用例名称"
|
|
2083
2144
|
})
|
|
2084
2145
|
]
|
|
2085
2146
|
}),
|
|
2086
2147
|
/* @__PURE__ */ K("div", {
|
|
2087
|
-
className:
|
|
2148
|
+
className: Y.field,
|
|
2088
2149
|
"data-assistant-part": "field",
|
|
2089
2150
|
children: [/* @__PURE__ */ G("label", {
|
|
2090
2151
|
htmlFor: "assistant-case-path",
|
|
2091
2152
|
children: "用例入口"
|
|
2092
|
-
}), /* @__PURE__ */ G(
|
|
2153
|
+
}), /* @__PURE__ */ G(D, {
|
|
2093
2154
|
id: "assistant-case-path",
|
|
2094
2155
|
readOnly: n,
|
|
2095
2156
|
value: t.path,
|
|
@@ -2101,8 +2162,8 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2101
2162
|
})
|
|
2102
2163
|
})]
|
|
2103
2164
|
}),
|
|
2104
|
-
/* @__PURE__ */ K(
|
|
2105
|
-
className:
|
|
2165
|
+
/* @__PURE__ */ K(ae, {
|
|
2166
|
+
className: Y.card,
|
|
2106
2167
|
"data-assistant-part": "card record-card",
|
|
2107
2168
|
"aria-label": "录制操作",
|
|
2108
2169
|
styles: { body: {
|
|
@@ -2113,9 +2174,9 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2113
2174
|
} },
|
|
2114
2175
|
children: [
|
|
2115
2176
|
/* @__PURE__ */ K("div", {
|
|
2116
|
-
className:
|
|
2177
|
+
className: Y.cardHeading,
|
|
2117
2178
|
"data-assistant-part": "card-heading",
|
|
2118
|
-
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(Le, {}), "录制操作"] }), /* @__PURE__ */ K(
|
|
2179
|
+
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(Le, {}), "录制操作"] }), /* @__PURE__ */ K(k, {
|
|
2119
2180
|
color: i.recording ? "red" : "default",
|
|
2120
2181
|
children: [
|
|
2121
2182
|
n ? "已保存" : i.recording ? "录制中" : "待录制",
|
|
@@ -2127,20 +2188,20 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2127
2188
|
})]
|
|
2128
2189
|
}),
|
|
2129
2190
|
!n && /* @__PURE__ */ G("div", {
|
|
2130
|
-
className:
|
|
2191
|
+
className: Y.buttonRow,
|
|
2131
2192
|
"data-assistant-part": "button-row",
|
|
2132
|
-
children: i.recording ? /* @__PURE__ */ G(
|
|
2193
|
+
children: i.recording ? /* @__PURE__ */ G(T, {
|
|
2133
2194
|
type: "primary",
|
|
2134
2195
|
danger: !0,
|
|
2135
|
-
icon: /* @__PURE__ */ G(
|
|
2196
|
+
icon: /* @__PURE__ */ G(H, {}),
|
|
2136
2197
|
disabled: !i.recording,
|
|
2137
2198
|
onClick: () => s.stop(),
|
|
2138
2199
|
children: "结束录制"
|
|
2139
|
-
}) : /* @__PURE__ */ G(
|
|
2200
|
+
}) : /* @__PURE__ */ G(T, {
|
|
2140
2201
|
icon: /* @__PURE__ */ G(Le, {}),
|
|
2141
2202
|
type: "primary",
|
|
2142
2203
|
disabled: o || i.recording,
|
|
2143
|
-
onClick: () => void
|
|
2204
|
+
onClick: () => void m(() => {
|
|
2144
2205
|
(!t.steps.length || window.confirm("新录制会替换当前用例的步骤。继续?")) && (u(null), s.start(), s.edit({
|
|
2145
2206
|
...s.getState().draft,
|
|
2146
2207
|
name: t.name
|
|
@@ -2150,12 +2211,12 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2150
2211
|
})
|
|
2151
2212
|
}),
|
|
2152
2213
|
/* @__PURE__ */ G("p", {
|
|
2153
|
-
className:
|
|
2214
|
+
className: Y.hint,
|
|
2154
2215
|
"data-assistant-part": "hint",
|
|
2155
2216
|
children: "展开、切换页签等准备操作也需录下来。"
|
|
2156
2217
|
}),
|
|
2157
|
-
/* @__PURE__ */ G(
|
|
2158
|
-
className:
|
|
2218
|
+
/* @__PURE__ */ G(E, {
|
|
2219
|
+
className: Y.help,
|
|
2159
2220
|
"data-assistant-part": "help",
|
|
2160
2221
|
ghost: !0,
|
|
2161
2222
|
size: "small",
|
|
@@ -2169,13 +2230,13 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2169
2230
|
},
|
|
2170
2231
|
items: [{
|
|
2171
2232
|
key: "details",
|
|
2172
|
-
label: /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(
|
|
2233
|
+
label: /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(L, {}), "录制范围"] }),
|
|
2173
2234
|
children: /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("p", {
|
|
2174
|
-
className:
|
|
2235
|
+
className: Y.hint,
|
|
2175
2236
|
"data-assistant-part": "hint",
|
|
2176
2237
|
children: "从业务页面的初始状态开始录制。回放目标由宿主配置。"
|
|
2177
2238
|
}), /* @__PURE__ */ G("p", {
|
|
2178
|
-
className:
|
|
2239
|
+
className: Y.hint,
|
|
2179
2240
|
"data-assistant-part": "hint",
|
|
2180
2241
|
children: "普通字段的输入值会写入用例。密码等敏感输入、文件上传、跨域 iframe、拖动和刷新不记录或不支持。"
|
|
2181
2242
|
})] })
|
|
@@ -2183,8 +2244,8 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2183
2244
|
})
|
|
2184
2245
|
]
|
|
2185
2246
|
}),
|
|
2186
|
-
/* @__PURE__ */ K(
|
|
2187
|
-
className:
|
|
2247
|
+
/* @__PURE__ */ K(ae, {
|
|
2248
|
+
className: Y.card,
|
|
2188
2249
|
"data-assistant-part": "card editor-card",
|
|
2189
2250
|
"aria-label": "用例步骤",
|
|
2190
2251
|
styles: { body: {
|
|
@@ -2195,58 +2256,58 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2195
2256
|
} },
|
|
2196
2257
|
children: [
|
|
2197
2258
|
/* @__PURE__ */ K("div", {
|
|
2198
|
-
className:
|
|
2259
|
+
className: Y.cardHeading,
|
|
2199
2260
|
"data-assistant-part": "card-heading",
|
|
2200
|
-
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(
|
|
2261
|
+
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(be, {}), "用例步骤"] }), /* @__PURE__ */ K("span", { children: [t.steps.length, " 个步骤"] })]
|
|
2201
2262
|
}),
|
|
2202
2263
|
!t.steps.length && /* @__PURE__ */ K("div", {
|
|
2203
|
-
className:
|
|
2264
|
+
className: Y.emptySteps,
|
|
2204
2265
|
"data-assistant-part": "empty-steps",
|
|
2205
2266
|
children: [/* @__PURE__ */ G(we, {}), /* @__PURE__ */ G("span", { children: "暂无操作步骤" })]
|
|
2206
2267
|
}),
|
|
2207
2268
|
/* @__PURE__ */ G("ol", {
|
|
2208
|
-
className:
|
|
2269
|
+
className: Y.caseSteps,
|
|
2209
2270
|
"data-assistant-part": "case-steps",
|
|
2210
2271
|
children: t.steps.map((e, r) => /* @__PURE__ */ K("li", { children: [
|
|
2211
2272
|
/* @__PURE__ */ K("div", {
|
|
2212
|
-
className:
|
|
2273
|
+
className: Y.stepHeading,
|
|
2213
2274
|
"data-assistant-part": "step-heading",
|
|
2214
2275
|
children: [
|
|
2215
2276
|
/* @__PURE__ */ G("span", {
|
|
2216
|
-
className:
|
|
2277
|
+
className: Y.stepNumber,
|
|
2217
2278
|
"data-assistant-part": "step-number",
|
|
2218
2279
|
children: String(r + 1).padStart(2, "0")
|
|
2219
2280
|
}),
|
|
2220
|
-
/* @__PURE__ */ G(
|
|
2281
|
+
/* @__PURE__ */ G(k, {
|
|
2221
2282
|
color: e.kind === "unsupported" ? "red" : "blue",
|
|
2222
|
-
children:
|
|
2283
|
+
children: Xe[e.kind]
|
|
2223
2284
|
}),
|
|
2224
2285
|
/* @__PURE__ */ G("strong", { children: e.assertion?.name ?? e.target?.label ?? e.value }),
|
|
2225
|
-
e.sourceEventId && /* @__PURE__ */ K(
|
|
2226
|
-
e.supplemented && /* @__PURE__ */ G(
|
|
2286
|
+
e.sourceEventId && /* @__PURE__ */ K(k, { children: ["源事件 #", e.sourceEventId] }),
|
|
2287
|
+
e.supplemented && /* @__PURE__ */ G(k, {
|
|
2227
2288
|
color: "orange",
|
|
2228
2289
|
children: "人工补充"
|
|
2229
2290
|
})
|
|
2230
2291
|
]
|
|
2231
2292
|
}),
|
|
2232
2293
|
e.assertion && /* @__PURE__ */ K("div", {
|
|
2233
|
-
className:
|
|
2294
|
+
className: Y.assertionSummary,
|
|
2234
2295
|
"data-assistant-part": "assertion-summary",
|
|
2235
2296
|
children: [
|
|
2236
|
-
/* @__PURE__ */ G(
|
|
2297
|
+
/* @__PURE__ */ G(k, {
|
|
2237
2298
|
color: "green",
|
|
2238
|
-
children:
|
|
2299
|
+
children: X.assertionSources[e.assertion.source]
|
|
2239
2300
|
}),
|
|
2240
2301
|
/* @__PURE__ */ K("span", { children: [
|
|
2241
|
-
|
|
2302
|
+
X.assertionOperators[e.assertion.operator],
|
|
2242
2303
|
" ",
|
|
2243
2304
|
e.assertion.expected === "" ? "空字符串" : e.assertion.expected
|
|
2244
2305
|
] }),
|
|
2245
2306
|
/* @__PURE__ */ K("span", {
|
|
2246
|
-
className:
|
|
2307
|
+
className: Y.hint,
|
|
2247
2308
|
"data-assistant-part": "hint",
|
|
2248
2309
|
children: [
|
|
2249
|
-
(0,
|
|
2310
|
+
(0, X.isRequestAssertion)(e.assertion.source) ? "观察" : "最多等待",
|
|
2250
2311
|
" ",
|
|
2251
2312
|
e.assertion.timeout / 1e3,
|
|
2252
2313
|
" 秒"
|
|
@@ -2260,24 +2321,25 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2260
2321
|
] })
|
|
2261
2322
|
]
|
|
2262
2323
|
}),
|
|
2263
|
-
e.kind === "unsupported" && !n && /* @__PURE__ */ G(
|
|
2324
|
+
e.kind === "unsupported" && !n && /* @__PURE__ */ G(tt, {
|
|
2264
2325
|
step: e,
|
|
2326
|
+
defaultExpanded: e.supplemented,
|
|
2265
2327
|
disabled: i.recording || o,
|
|
2266
2328
|
onApply: (e) => s.edit({
|
|
2267
2329
|
...t,
|
|
2268
2330
|
steps: t.steps.map((t, n) => n === r ? e : t)
|
|
2269
2331
|
})
|
|
2270
2332
|
}, JSON.stringify(e)),
|
|
2271
|
-
e.value !== void 0 && (n || e.kind !== "unsupported") && /* @__PURE__ */ G(
|
|
2333
|
+
e.value !== void 0 && (n || e.kind !== "unsupported") && /* @__PURE__ */ G(D, {
|
|
2272
2334
|
"aria-label": `第 ${r + 1} 步内容`,
|
|
2273
2335
|
readOnly: n,
|
|
2274
2336
|
value: e.value,
|
|
2275
2337
|
maxLength: 2e3,
|
|
2276
2338
|
disabled: i.recording || o,
|
|
2277
|
-
onChange: (e) =>
|
|
2339
|
+
onChange: (e) => h(r, { value: e.target.value })
|
|
2278
2340
|
}),
|
|
2279
2341
|
e.kind === "check" && /* @__PURE__ */ G("span", { children: e.checked ? "选中" : "取消选中" }),
|
|
2280
|
-
e.target && /* @__PURE__ */ G(
|
|
2342
|
+
e.target && /* @__PURE__ */ G(E, {
|
|
2281
2343
|
ghost: !0,
|
|
2282
2344
|
size: "small",
|
|
2283
2345
|
styles: {
|
|
@@ -2295,20 +2357,20 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2295
2357
|
}]
|
|
2296
2358
|
}),
|
|
2297
2359
|
!n && /* @__PURE__ */ K("div", {
|
|
2298
|
-
className: [
|
|
2360
|
+
className: [Y.buttonRow, Y.stepActions].join(" "),
|
|
2299
2361
|
"data-assistant-part": "button-row step-actions",
|
|
2300
2362
|
children: [
|
|
2301
|
-
/* @__PURE__ */ G(
|
|
2363
|
+
/* @__PURE__ */ G(T, {
|
|
2302
2364
|
size: "small",
|
|
2303
2365
|
type: "text",
|
|
2304
|
-
icon: /* @__PURE__ */ G(
|
|
2366
|
+
icon: /* @__PURE__ */ G(N, {}),
|
|
2305
2367
|
disabled: i.recording || o || !e.assertion && t.steps.length >= 100,
|
|
2306
|
-
onClick: () =>
|
|
2368
|
+
onClick: () => d(r + 1, e.assertion ? r : void 0, r),
|
|
2307
2369
|
children: e.assertion ? "编辑断言" : "在此步后添加断言"
|
|
2308
2370
|
}),
|
|
2309
|
-
/* @__PURE__ */ K(
|
|
2371
|
+
/* @__PURE__ */ K(T, {
|
|
2310
2372
|
type: "text",
|
|
2311
|
-
icon: /* @__PURE__ */ G(
|
|
2373
|
+
icon: /* @__PURE__ */ G(B, {}),
|
|
2312
2374
|
size: "small",
|
|
2313
2375
|
disabled: i.recording || o || t.steps.length >= 100,
|
|
2314
2376
|
onClick: () => {
|
|
@@ -2318,6 +2380,7 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2318
2380
|
...t.steps.slice(0, r),
|
|
2319
2381
|
{
|
|
2320
2382
|
kind: "unsupported",
|
|
2383
|
+
supplemented: !0,
|
|
2321
2384
|
value: "人工前置步骤待补充"
|
|
2322
2385
|
},
|
|
2323
2386
|
...t.steps.slice(r)
|
|
@@ -2330,9 +2393,9 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2330
2393
|
" 步前插入"
|
|
2331
2394
|
]
|
|
2332
2395
|
}),
|
|
2333
|
-
/* @__PURE__ */ K(
|
|
2396
|
+
/* @__PURE__ */ K(T, {
|
|
2334
2397
|
type: "text",
|
|
2335
|
-
icon: /* @__PURE__ */ G(
|
|
2398
|
+
icon: /* @__PURE__ */ G(P, {}),
|
|
2336
2399
|
danger: !0,
|
|
2337
2400
|
size: "small",
|
|
2338
2401
|
disabled: i.recording || o,
|
|
@@ -2349,10 +2412,11 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2349
2412
|
]
|
|
2350
2413
|
})
|
|
2351
2414
|
]
|
|
2352
|
-
})
|
|
2415
|
+
}),
|
|
2416
|
+
!n && l?.anchor === r && g(t, o)
|
|
2353
2417
|
] }, r))
|
|
2354
2418
|
}),
|
|
2355
|
-
t.timeline && /* @__PURE__ */ G(
|
|
2419
|
+
t.timeline && /* @__PURE__ */ G(E, {
|
|
2356
2420
|
ghost: !0,
|
|
2357
2421
|
size: "small",
|
|
2358
2422
|
styles: {
|
|
@@ -2371,74 +2435,51 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2371
2435
|
" 条,只读)"
|
|
2372
2436
|
] }),
|
|
2373
2437
|
children: /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("p", { children: "接口、异常和性能事件不执行;人工补充与移除步骤不会改写这里的来源记录。" }), /* @__PURE__ */ G("pre", {
|
|
2374
|
-
className:
|
|
2438
|
+
className: Y.json,
|
|
2375
2439
|
"data-assistant-part": "json",
|
|
2376
2440
|
children: JSON.stringify(t.timeline, null, 2)
|
|
2377
2441
|
})] })
|
|
2378
2442
|
}]
|
|
2379
2443
|
}),
|
|
2380
2444
|
/* @__PURE__ */ K("div", {
|
|
2381
|
-
|
|
2382
|
-
className: J.assertionArea,
|
|
2445
|
+
className: Y.assertionArea,
|
|
2383
2446
|
"data-assistant-part": "assertion-area",
|
|
2384
2447
|
children: [/* @__PURE__ */ K("div", {
|
|
2385
|
-
className:
|
|
2448
|
+
className: Y.cardHeading,
|
|
2386
2449
|
"data-assistant-part": "card-heading",
|
|
2387
|
-
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(
|
|
2450
|
+
children: [/* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(N, {}), " 结果断言"] }), /* @__PURE__ */ K(k, { children: [
|
|
2388
2451
|
t.steps.filter((e) => e.kind === "assert" || e.kind === "assert-text").length,
|
|
2389
2452
|
" ",
|
|
2390
2453
|
"条"
|
|
2391
2454
|
] })]
|
|
2392
|
-
}), !n && (l ? /* @__PURE__ */ G(
|
|
2393
|
-
initial: l.edit === void 0 ? void 0 : t.steps[l.edit]?.assertion,
|
|
2394
|
-
steps: t.steps,
|
|
2395
|
-
position: l.position,
|
|
2396
|
-
disabled: o || i.recording,
|
|
2397
|
-
onCancel: () => u(null),
|
|
2398
|
-
onSave: (e, n) => {
|
|
2399
|
-
let r = [...t.steps];
|
|
2400
|
-
l.edit === void 0 ? r.splice(n, 0, {
|
|
2401
|
-
kind: "assert",
|
|
2402
|
-
assertion: e,
|
|
2403
|
-
supplemented: !0
|
|
2404
|
-
}) : r[l.edit] = {
|
|
2405
|
-
...r[l.edit],
|
|
2406
|
-
kind: "assert",
|
|
2407
|
-
assertion: e,
|
|
2408
|
-
supplemented: !0
|
|
2409
|
-
}, s.edit((0, Y.parseCase)({
|
|
2410
|
-
...t,
|
|
2411
|
-
steps: r
|
|
2412
|
-
})), u(null);
|
|
2413
|
-
}
|
|
2414
|
-
}, `${l.position}-${l.edit ?? "new"}`) : /* @__PURE__ */ G(C, {
|
|
2455
|
+
}), !n && (l?.anchor === void 0 && l ? g(t, o) : !l && /* @__PURE__ */ G(T, {
|
|
2415
2456
|
type: "text",
|
|
2416
|
-
icon: /* @__PURE__ */ G(
|
|
2457
|
+
icon: /* @__PURE__ */ G(B, {}),
|
|
2417
2458
|
disabled: o || i.recording || t.steps.length >= 100,
|
|
2418
|
-
onClick: () =>
|
|
2459
|
+
onClick: () => d(t.steps.length),
|
|
2419
2460
|
children: "添加断言"
|
|
2420
2461
|
}))]
|
|
2421
2462
|
}),
|
|
2422
2463
|
!n && /* @__PURE__ */ K("div", {
|
|
2423
|
-
className: [
|
|
2464
|
+
className: [Y.buttonRow, Y.cardActions].join(" "),
|
|
2424
2465
|
"data-assistant-part": "button-row card-actions",
|
|
2425
2466
|
children: [
|
|
2426
|
-
/* @__PURE__ */ G(
|
|
2427
|
-
icon: /* @__PURE__ */ G(
|
|
2467
|
+
/* @__PURE__ */ G(T, {
|
|
2468
|
+
icon: /* @__PURE__ */ G(Fe, {}),
|
|
2428
2469
|
type: "primary",
|
|
2429
2470
|
disabled: i.recording || o || !t.name.trim() || !t.steps.length,
|
|
2430
|
-
onClick: () => void
|
|
2431
|
-
let e = (0,
|
|
2471
|
+
onClick: () => void m(() => {
|
|
2472
|
+
let e = (0, X.parseCase)(t);
|
|
2432
2473
|
return r?.(e);
|
|
2433
2474
|
}),
|
|
2434
2475
|
children: "保存用例"
|
|
2435
2476
|
}),
|
|
2436
|
-
/* @__PURE__ */ G(
|
|
2477
|
+
/* @__PURE__ */ G(T, {
|
|
2437
2478
|
disabled: o || i.recording,
|
|
2438
|
-
onClick:
|
|
2479
|
+
onClick: f,
|
|
2439
2480
|
children: "取消"
|
|
2440
2481
|
}),
|
|
2441
|
-
/* @__PURE__ */ G(
|
|
2482
|
+
/* @__PURE__ */ G(Qe, {
|
|
2442
2483
|
label: "用例文件操作",
|
|
2443
2484
|
disabled: o || i.recording,
|
|
2444
2485
|
items: [{
|
|
@@ -2449,8 +2490,8 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2449
2490
|
key: "export",
|
|
2450
2491
|
label: "导出用例 JSON",
|
|
2451
2492
|
disabled: !t.steps.length,
|
|
2452
|
-
onClick: () => void
|
|
2453
|
-
let e = (0,
|
|
2493
|
+
onClick: () => void m(() => {
|
|
2494
|
+
let e = (0, X.parseCase)(t), n = URL.createObjectURL(new Blob([JSON.stringify(e, null, 2)], { type: "application/json" })), r = document.createElement("a");
|
|
2454
2495
|
r.href = n, r.download = "页面录制用例.json", document.body.append(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 3e4);
|
|
2455
2496
|
})
|
|
2456
2497
|
}]
|
|
@@ -2462,9 +2503,9 @@ function ht({ close: e, bridgeUrl: t, incomingDraft: n, onConsumeDraft: r }) {
|
|
|
2462
2503
|
accept: ".json,application/json",
|
|
2463
2504
|
onChange: (e) => {
|
|
2464
2505
|
let t = e.target.files?.[0];
|
|
2465
|
-
e.target.value = "", !t || i.recording || o ||
|
|
2506
|
+
e.target.value = "", !t || i.recording || o || m(async () => {
|
|
2466
2507
|
if (t.size > 524288) throw Error("用例不能超过 512 KB");
|
|
2467
|
-
(!c || window.confirm("导入会替换当前未保存草稿。继续?")) && (s.loadDraft((0,
|
|
2508
|
+
(!c || window.confirm("导入会替换当前未保存草稿。继续?")) && (s.loadDraft((0, X.parseCase)(JSON.parse(await t.text()))), u(null));
|
|
2468
2509
|
});
|
|
2469
2510
|
}
|
|
2470
2511
|
})
|
|
@@ -2520,7 +2561,7 @@ function yt(e, t, n) {
|
|
|
2520
2561
|
if (i.length >= 100) throw Error("操作过多,请缩小选段范围(需为前置步骤预留一个位置)");
|
|
2521
2562
|
let a = new URL(i[0].page);
|
|
2522
2563
|
if (!["http:", "https:"].includes(a.protocol) || i.some((e) => new URL(e.page).origin !== a.origin)) throw Error("请选择同一站点内的片段");
|
|
2523
|
-
return (0,
|
|
2564
|
+
return (0, X.parseCase)({
|
|
2524
2565
|
schema: "zhidao-recorded-case",
|
|
2525
2566
|
version: 1,
|
|
2526
2567
|
name: `时间线片段 #${t}–#${n}`,
|
|
@@ -2549,7 +2590,7 @@ var bt = {
|
|
|
2549
2590
|
performance: "性能"
|
|
2550
2591
|
};
|
|
2551
2592
|
function xt({ events: e, onDraft: t }) {
|
|
2552
|
-
let n =
|
|
2593
|
+
let n = C(s.subscribe, s.getState), [r, i] = S(null), [a, o] = S(), [c, l] = S(), [u, d] = S("all"), [f, p] = S(""), [m, h] = S(""), g = r ? vt(r, a, c) : [], _ = new Set(g.map((e) => e.id)), v = r ?? e.filter((e) => (u === "all" || e.kind === u) && (e.title + e.page).includes(f));
|
|
2553
2594
|
return /* @__PURE__ */ K("div", {
|
|
2554
2595
|
className: gt.section,
|
|
2555
2596
|
"data-assistant-part": "section",
|
|
@@ -2560,14 +2601,14 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2560
2601
|
children: [/* @__PURE__ */ G("span", {
|
|
2561
2602
|
className: gt.headingIcon,
|
|
2562
2603
|
"data-assistant-part": "heading-icon",
|
|
2563
|
-
children: /* @__PURE__ */ G(
|
|
2604
|
+
children: /* @__PURE__ */ G(ke, {})
|
|
2564
2605
|
}), /* @__PURE__ */ G("div", { children: /* @__PURE__ */ G("h3", { children: "操作时间线" }) })]
|
|
2565
2606
|
}),
|
|
2566
2607
|
t && /* @__PURE__ */ K("div", {
|
|
2567
2608
|
className: gt.buttonRow,
|
|
2568
2609
|
"data-assistant-part": "button-row",
|
|
2569
|
-
children: [!r && /* @__PURE__ */ G(
|
|
2570
|
-
icon: /* @__PURE__ */ G(
|
|
2610
|
+
children: [!r && /* @__PURE__ */ G(T, {
|
|
2611
|
+
icon: /* @__PURE__ */ G(V, {}),
|
|
2571
2612
|
disabled: n.recording || !e.length,
|
|
2572
2613
|
onClick: () => {
|
|
2573
2614
|
try {
|
|
@@ -2577,13 +2618,13 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2577
2618
|
}
|
|
2578
2619
|
},
|
|
2579
2620
|
children: "开始选段"
|
|
2580
|
-
}), r && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(
|
|
2581
|
-
icon: /* @__PURE__ */ G(
|
|
2621
|
+
}), r && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(T, {
|
|
2622
|
+
icon: /* @__PURE__ */ G(ge, {}),
|
|
2582
2623
|
onClick: () => {
|
|
2583
2624
|
i(null), o(void 0), l(void 0), h("");
|
|
2584
2625
|
},
|
|
2585
2626
|
children: "退出选段"
|
|
2586
|
-
}), /* @__PURE__ */ G(
|
|
2627
|
+
}), /* @__PURE__ */ G(T, {
|
|
2587
2628
|
icon: /* @__PURE__ */ G(Ce, {}),
|
|
2588
2629
|
type: "primary",
|
|
2589
2630
|
disabled: !g.length || n.recording,
|
|
@@ -2610,14 +2651,14 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2610
2651
|
g.length > 0 && " · 输入值与定位需补充"
|
|
2611
2652
|
]
|
|
2612
2653
|
}),
|
|
2613
|
-
m && /* @__PURE__ */ G(
|
|
2654
|
+
m && /* @__PURE__ */ G(w, {
|
|
2614
2655
|
type: "warning",
|
|
2615
2656
|
title: m
|
|
2616
2657
|
}),
|
|
2617
2658
|
!r && /* @__PURE__ */ K("div", {
|
|
2618
2659
|
className: gt.filters,
|
|
2619
2660
|
"data-assistant-part": "filters",
|
|
2620
|
-
children: [/* @__PURE__ */ G(
|
|
2661
|
+
children: [/* @__PURE__ */ G(O, {
|
|
2621
2662
|
"aria-label": "事件类型",
|
|
2622
2663
|
value: u,
|
|
2623
2664
|
onChange: d,
|
|
@@ -2628,8 +2669,8 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2628
2669
|
value: e,
|
|
2629
2670
|
label: t
|
|
2630
2671
|
}))]
|
|
2631
|
-
}), /* @__PURE__ */ G(
|
|
2632
|
-
prefix: /* @__PURE__ */ G(
|
|
2672
|
+
}), /* @__PURE__ */ G(D, {
|
|
2673
|
+
prefix: /* @__PURE__ */ G(Ie, {}),
|
|
2633
2674
|
"aria-label": "搜索时间线",
|
|
2634
2675
|
placeholder: "搜索操作或页面",
|
|
2635
2676
|
value: f,
|
|
@@ -2637,24 +2678,24 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2637
2678
|
allowClear: !0
|
|
2638
2679
|
})]
|
|
2639
2680
|
}),
|
|
2640
|
-
!
|
|
2681
|
+
!v.length && /* @__PURE__ */ G(le, { description: e.length ? "没有匹配的事件" : "暂无时间线记录" }),
|
|
2641
2682
|
/* @__PURE__ */ G("ol", {
|
|
2642
2683
|
className: gt.timeline,
|
|
2643
2684
|
"data-assistant-part": "timeline",
|
|
2644
|
-
children:
|
|
2685
|
+
children: v.slice().sort((e, t) => t.time - e.time || t.id - e.id).map((e) => /* @__PURE__ */ K("li", {
|
|
2645
2686
|
className: e.kind === "error" ? gt.error : "",
|
|
2646
2687
|
children: [
|
|
2647
2688
|
/* @__PURE__ */ K("div", {
|
|
2648
2689
|
className: gt.eventMeta,
|
|
2649
2690
|
"data-assistant-part": "event-meta",
|
|
2650
2691
|
children: [
|
|
2651
|
-
/* @__PURE__ */ G(
|
|
2692
|
+
/* @__PURE__ */ G(k, {
|
|
2652
2693
|
color: e.kind === "error" ? "red" : "blue",
|
|
2653
2694
|
children: bt[e.kind]
|
|
2654
2695
|
}),
|
|
2655
2696
|
/* @__PURE__ */ G("time", { children: new Date(e.time).toLocaleTimeString("zh-CN", { hour12: !1 }) }),
|
|
2656
2697
|
/* @__PURE__ */ K("small", { children: ["#", e.id] }),
|
|
2657
|
-
_.has(e.id) && /* @__PURE__ */ G(
|
|
2698
|
+
_.has(e.id) && /* @__PURE__ */ G(k, {
|
|
2658
2699
|
color: "gold",
|
|
2659
2700
|
children: "已选"
|
|
2660
2701
|
})
|
|
@@ -2664,7 +2705,7 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2664
2705
|
r && /* @__PURE__ */ K("div", {
|
|
2665
2706
|
className: gt.buttonRow,
|
|
2666
2707
|
"data-assistant-part": "button-row",
|
|
2667
|
-
children: [/* @__PURE__ */ G(
|
|
2708
|
+
children: [/* @__PURE__ */ G(T, {
|
|
2668
2709
|
icon: /* @__PURE__ */ G(Te, {}),
|
|
2669
2710
|
size: "small",
|
|
2670
2711
|
"aria-label": `从事件 ${e.id} 开始`,
|
|
@@ -2673,8 +2714,8 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2673
2714
|
o(e.id), l(void 0);
|
|
2674
2715
|
},
|
|
2675
2716
|
children: "设为起点"
|
|
2676
|
-
}), /* @__PURE__ */ G(
|
|
2677
|
-
icon: /* @__PURE__ */ G(
|
|
2717
|
+
}), /* @__PURE__ */ G(T, {
|
|
2718
|
+
icon: /* @__PURE__ */ G(N, {}),
|
|
2678
2719
|
size: "small",
|
|
2679
2720
|
"aria-label": `到事件 ${e.id} 结束`,
|
|
2680
2721
|
"aria-pressed": c === e.id,
|
|
@@ -2683,7 +2724,7 @@ function xt({ events: e, onDraft: t }) {
|
|
|
2683
2724
|
children: "设为终点"
|
|
2684
2725
|
})]
|
|
2685
2726
|
}),
|
|
2686
|
-
/* @__PURE__ */ G(
|
|
2727
|
+
/* @__PURE__ */ G(E, {
|
|
2687
2728
|
ghost: !0,
|
|
2688
2729
|
size: "small",
|
|
2689
2730
|
styles: {
|
|
@@ -2799,7 +2840,7 @@ var wt = {
|
|
|
2799
2840
|
};
|
|
2800
2841
|
// src/layouts/FloatingPanel/useOverlayScrollbars.ts
|
|
2801
2842
|
function Tt(e, t) {
|
|
2802
|
-
|
|
2843
|
+
b(() => {
|
|
2803
2844
|
let n = e.current;
|
|
2804
2845
|
if (!n || !t) return;
|
|
2805
2846
|
let r = /* @__PURE__ */ new Map(), i = 0, a = () => {
|
|
@@ -2840,18 +2881,18 @@ var Et = 12, Dt = (e) => {
|
|
|
2840
2881
|
y: Math.max(Et, Math.min(e.y, window.innerHeight - n - Et))
|
|
2841
2882
|
};
|
|
2842
2883
|
}, Ot = (e) => {
|
|
2843
|
-
let { open: t, onMinimize: n, children: r, developer: i } = e, [a, o] =
|
|
2884
|
+
let { open: t, onMinimize: n, children: r, developer: i } = e, [a, o] = S(() => Dt({
|
|
2844
2885
|
x: window.innerWidth - 564,
|
|
2845
2886
|
y: window.innerHeight - 744,
|
|
2846
2887
|
width: 540,
|
|
2847
2888
|
height: 720
|
|
2848
|
-
})), [s, c] =
|
|
2889
|
+
})), [s, c] = S(!1), [l, u] = S(!1), d = ne(null);
|
|
2849
2890
|
Tt(d, t);
|
|
2850
|
-
let f =
|
|
2851
|
-
|
|
2891
|
+
let f = ne(null);
|
|
2892
|
+
b(() => {
|
|
2852
2893
|
let e = () => o((e) => Dt(e));
|
|
2853
2894
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
2854
|
-
}, []),
|
|
2895
|
+
}, []), b(() => {
|
|
2855
2896
|
t && d.current?.focus({ preventScroll: !0 });
|
|
2856
2897
|
}, [t]);
|
|
2857
2898
|
let p = (e, t = !1) => {
|
|
@@ -2941,18 +2982,18 @@ var Et = 12, Dt = (e) => {
|
|
|
2941
2982
|
}), /* @__PURE__ */ K("div", {
|
|
2942
2983
|
className: wt.windowActions,
|
|
2943
2984
|
"data-assistant-part": "window-actions",
|
|
2944
|
-
children: [/* @__PURE__ */ G(
|
|
2985
|
+
children: [/* @__PURE__ */ G(T, {
|
|
2945
2986
|
type: "text",
|
|
2946
2987
|
"aria-label": s ? "还原小窗" : "放大分析",
|
|
2947
2988
|
title: s ? "还原小窗" : "放大分析",
|
|
2948
2989
|
onClick: () => c((e) => !e),
|
|
2949
|
-
children: G(s ?
|
|
2950
|
-
}), /* @__PURE__ */ G(
|
|
2990
|
+
children: G(s ? De : Oe, {})
|
|
2991
|
+
}), /* @__PURE__ */ G(T, {
|
|
2951
2992
|
type: "text",
|
|
2952
2993
|
"aria-label": "最小化研发小蜜",
|
|
2953
2994
|
title: "最小化",
|
|
2954
2995
|
onClick: n,
|
|
2955
|
-
children: /* @__PURE__ */ G(
|
|
2996
|
+
children: /* @__PURE__ */ G(z, {})
|
|
2956
2997
|
})]
|
|
2957
2998
|
})]
|
|
2958
2999
|
}),
|
|
@@ -3010,17 +3051,17 @@ function kt({ metrics: e, data: t, now: n, paused: r, offline: i }) {
|
|
|
3010
3051
|
/* @__PURE__ */ G("span", {
|
|
3011
3052
|
className: $.headingIcon,
|
|
3012
3053
|
"data-assistant-part": "heading-icon",
|
|
3013
|
-
children: /* @__PURE__ */ G(
|
|
3054
|
+
children: /* @__PURE__ */ G(ve, {})
|
|
3014
3055
|
}),
|
|
3015
3056
|
/* @__PURE__ */ G("div", { children: /* @__PURE__ */ G("h3", { children: "性能诊断" }) }),
|
|
3016
|
-
/* @__PURE__ */ G(
|
|
3017
|
-
!a.length && /* @__PURE__ */ G(
|
|
3057
|
+
/* @__PURE__ */ G(k, { children: i ? "快照分析" : r ? "采集已暂停" : "自动监测中" }),
|
|
3058
|
+
!a.length && /* @__PURE__ */ G(k, { children: "未触发告警" })
|
|
3018
3059
|
]
|
|
3019
3060
|
}),
|
|
3020
3061
|
/* @__PURE__ */ G("div", {
|
|
3021
3062
|
className: $.issueList,
|
|
3022
3063
|
"data-assistant-part": "issue-list",
|
|
3023
|
-
children: a.map((e) => /* @__PURE__ */ K(
|
|
3064
|
+
children: a.map((e) => /* @__PURE__ */ K(ae, {
|
|
3024
3065
|
className: [$.card, $.performanceIssue].join(" "),
|
|
3025
3066
|
"data-assistant-part": "card performance-issue",
|
|
3026
3067
|
styles: { body: {
|
|
@@ -3033,13 +3074,13 @@ function kt({ metrics: e, data: t, now: n, paused: r, offline: i }) {
|
|
|
3033
3074
|
/* @__PURE__ */ G("div", {
|
|
3034
3075
|
className: $.cardHeading,
|
|
3035
3076
|
"data-assistant-part": "card-heading",
|
|
3036
|
-
children: /* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(
|
|
3077
|
+
children: /* @__PURE__ */ K("h3", { children: [/* @__PURE__ */ G(k, {
|
|
3037
3078
|
color: e.severity === "error" ? "red" : "orange",
|
|
3038
3079
|
children: e.severity === "error" ? "较高风险" : "需关注"
|
|
3039
3080
|
}), e.title] })
|
|
3040
3081
|
}),
|
|
3041
3082
|
/* @__PURE__ */ G("p", { children: e.evidence }),
|
|
3042
|
-
/* @__PURE__ */ G(
|
|
3083
|
+
/* @__PURE__ */ G(E, {
|
|
3043
3084
|
ghost: !0,
|
|
3044
3085
|
size: "small",
|
|
3045
3086
|
styles: {
|
|
@@ -3064,7 +3105,7 @@ function kt({ metrics: e, data: t, now: n, paused: r, offline: i }) {
|
|
|
3064
3105
|
href: e.url,
|
|
3065
3106
|
target: "_blank",
|
|
3066
3107
|
rel: "noreferrer",
|
|
3067
|
-
children: [/* @__PURE__ */ G(
|
|
3108
|
+
children: [/* @__PURE__ */ G(Ae, {}), " 查看官方排查文档"]
|
|
3068
3109
|
})
|
|
3069
3110
|
] })
|
|
3070
3111
|
}]
|
|
@@ -3072,7 +3113,7 @@ function kt({ metrics: e, data: t, now: n, paused: r, offline: i }) {
|
|
|
3072
3113
|
]
|
|
3073
3114
|
}, e.id))
|
|
3074
3115
|
}),
|
|
3075
|
-
/* @__PURE__ */ K(
|
|
3116
|
+
/* @__PURE__ */ K(ae, {
|
|
3076
3117
|
className: $.card,
|
|
3077
3118
|
"data-assistant-part": "card",
|
|
3078
3119
|
styles: { body: {
|
|
@@ -3123,7 +3164,7 @@ function kt({ metrics: e, data: t, now: n, paused: r, offline: i }) {
|
|
|
3123
3164
|
/* @__PURE__ */ K("h3", {
|
|
3124
3165
|
className: $.subheading,
|
|
3125
3166
|
"data-assistant-part": "subheading",
|
|
3126
|
-
children: [/* @__PURE__ */ G(
|
|
3167
|
+
children: [/* @__PURE__ */ G(ve, {}), " 页面指标"]
|
|
3127
3168
|
}),
|
|
3128
3169
|
/* @__PURE__ */ G("div", {
|
|
3129
3170
|
className: $.metrics,
|
|
@@ -3157,53 +3198,53 @@ function kt({ metrics: e, data: t, now: n, paused: r, offline: i }) {
|
|
|
3157
3198
|
// src/pages/assistant/index.tsx
|
|
3158
3199
|
function At({ value: e }) {
|
|
3159
3200
|
return /* @__PURE__ */ G("pre", {
|
|
3160
|
-
className:
|
|
3201
|
+
className: J.json,
|
|
3161
3202
|
"data-assistant-part": "json",
|
|
3162
3203
|
children: JSON.stringify(e, null, 2)
|
|
3163
3204
|
});
|
|
3164
3205
|
}
|
|
3165
3206
|
var jt = (e) => new Date(e).toLocaleTimeString("zh-CN", { hour12: !1 });
|
|
3166
3207
|
function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly: i = !1 } = {}) {
|
|
3167
|
-
let a =
|
|
3168
|
-
p(!1), requestAnimationFrame(() =>
|
|
3169
|
-
}, [
|
|
3170
|
-
Te(!1), p(!0),
|
|
3208
|
+
let a = C(m.subscribe, m.getState), o = C(s.subscribe, s.getState), [u, p] = S(!1), [h, _] = S(i ? "diagnostics" : "feedback"), [v, x] = S("timeline"), [ee, te] = S(), re = ne(null), ae = () => {
|
|
3209
|
+
p(!1), requestAnimationFrame(() => re.current?.focus({ preventScroll: !0 }));
|
|
3210
|
+
}, [oe, se] = S(""), [ce, ue] = S(""), [O, A] = S(null), [j, N] = S("live"), [he, _e] = S(c), [xe, Ce] = S(!1), [we, Te] = S(!1), De = y(() => {
|
|
3211
|
+
Te(!1), p(!0), _e(c());
|
|
3171
3212
|
}, []);
|
|
3172
|
-
|
|
3213
|
+
Ye(re, De, y((e) => {
|
|
3173
3214
|
Ce(e), e && Te(!1);
|
|
3174
3215
|
}, []));
|
|
3175
|
-
let
|
|
3176
|
-
m.clear(), i && s.clear(),
|
|
3216
|
+
let Oe = y(() => {
|
|
3217
|
+
m.clear(), i && s.clear(), N("live"), A(null), ue("内存记录已清空");
|
|
3177
3218
|
}, [i]);
|
|
3178
|
-
|
|
3179
|
-
if (i) return window.addEventListener("gz-research-assistant:clear-data",
|
|
3180
|
-
}, [i,
|
|
3219
|
+
b(() => {
|
|
3220
|
+
if (i) return window.addEventListener("gz-research-assistant:clear-data", Oe), () => window.removeEventListener("gz-research-assistant:clear-data", Oe);
|
|
3221
|
+
}, [i, Oe]), b(() => {
|
|
3181
3222
|
if (!u) return;
|
|
3182
|
-
let e = setInterval(() =>
|
|
3223
|
+
let e = setInterval(() => _e(c()), 2e3);
|
|
3183
3224
|
return () => clearInterval(e);
|
|
3184
3225
|
}, [u]);
|
|
3185
|
-
let
|
|
3186
|
-
className:
|
|
3226
|
+
let L = j === "imported" ? O : j === "frozen" ? a.frozen : null, Ae = L?.events ?? a.events, z = L?.requests ?? a.requests, B = L?.metrics ?? a.metrics, Fe = L?.environment ?? he, V = L ?? a.frozen, Ie = /* @__PURE__ */ K("div", {
|
|
3227
|
+
className: J.section,
|
|
3187
3228
|
"data-assistant-part": "section",
|
|
3188
3229
|
children: [
|
|
3189
3230
|
/* @__PURE__ */ K("div", {
|
|
3190
|
-
className:
|
|
3231
|
+
className: J.stats,
|
|
3191
3232
|
"data-assistant-part": "stats",
|
|
3192
3233
|
children: [
|
|
3193
|
-
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("strong", { children: [
|
|
3194
|
-
className:
|
|
3234
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("strong", { children: [Ae.length, /* @__PURE__ */ G("small", { children: "条" })] }), /* @__PURE__ */ K("span", {
|
|
3235
|
+
className: J.statLabel,
|
|
3195
3236
|
"data-assistant-part": "stat-label",
|
|
3196
|
-
children: [/* @__PURE__ */ G(
|
|
3237
|
+
children: [/* @__PURE__ */ G(ke, {}), "操作与事件"]
|
|
3197
3238
|
})] }),
|
|
3198
|
-
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("strong", { children: [
|
|
3199
|
-
className:
|
|
3239
|
+
/* @__PURE__ */ K("div", { children: [/* @__PURE__ */ K("strong", { children: [z.length, /* @__PURE__ */ G("small", { children: "条" })] }), /* @__PURE__ */ K("span", {
|
|
3240
|
+
className: J.statLabel,
|
|
3200
3241
|
"data-assistant-part": "stat-label",
|
|
3201
|
-
children: [/* @__PURE__ */ G(
|
|
3242
|
+
children: [/* @__PURE__ */ G(me, {}), "接口记录"]
|
|
3202
3243
|
})] }),
|
|
3203
3244
|
/* @__PURE__ */ K("div", {
|
|
3204
|
-
className:
|
|
3205
|
-
children: [/* @__PURE__ */ K("strong", { children: [
|
|
3206
|
-
className:
|
|
3245
|
+
className: z.some((e) => e.failed) ? J.hasErrors : "",
|
|
3246
|
+
children: [/* @__PURE__ */ K("strong", { children: [z.filter((e) => e.failed).length, /* @__PURE__ */ G("small", { children: "条" })] }), /* @__PURE__ */ K("span", {
|
|
3247
|
+
className: J.statLabel,
|
|
3207
3248
|
"data-assistant-part": "stat-label",
|
|
3208
3249
|
children: [/* @__PURE__ */ G(Re, {}), "失败接口"]
|
|
3209
3250
|
})]
|
|
@@ -3211,46 +3252,46 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3211
3252
|
]
|
|
3212
3253
|
}),
|
|
3213
3254
|
/* @__PURE__ */ K("div", {
|
|
3214
|
-
className: [
|
|
3255
|
+
className: [J.buttonRow, J.actions].join(" "),
|
|
3215
3256
|
"data-assistant-part": "button-row actions",
|
|
3216
|
-
children: [/* @__PURE__ */ G(
|
|
3257
|
+
children: [/* @__PURE__ */ G(T, {
|
|
3217
3258
|
type: "primary",
|
|
3218
|
-
icon: /* @__PURE__ */ G(
|
|
3259
|
+
icon: /* @__PURE__ */ G(M, {}),
|
|
3219
3260
|
onClick: () => {
|
|
3220
|
-
g("用户手动截取现场"),
|
|
3261
|
+
g("用户手动截取现场"), N("frozen"), ue("已冻结现场。后续操作不会改变这份快照。");
|
|
3221
3262
|
},
|
|
3222
3263
|
children: "截取当前现场"
|
|
3223
|
-
}), /* @__PURE__ */ G(
|
|
3224
|
-
icon: /* @__PURE__ */ G(
|
|
3264
|
+
}), /* @__PURE__ */ G(T, {
|
|
3265
|
+
icon: /* @__PURE__ */ G(ye, {}),
|
|
3225
3266
|
onClick: () => {
|
|
3226
|
-
let e =
|
|
3227
|
-
t(e,
|
|
3267
|
+
let e = V ?? n();
|
|
3268
|
+
t(e, oe), ue(`已导出 ${jt(e.capturedAt)} 的快照,请将 JSON 文件发送给研发人员。`);
|
|
3228
3269
|
},
|
|
3229
3270
|
children: "导出快照 JSON"
|
|
3230
3271
|
})]
|
|
3231
3272
|
}),
|
|
3232
3273
|
/* @__PURE__ */ K("p", {
|
|
3233
|
-
className:
|
|
3274
|
+
className: J.hint,
|
|
3234
3275
|
"data-assistant-part": "hint",
|
|
3235
|
-
children: [
|
|
3276
|
+
children: [V ? `导出:${V.reason} · ${jt(V.capturedAt)}` : "导出:当前现场", " · 现场仅存于内存,刷新或关闭前请导出"]
|
|
3236
3277
|
}),
|
|
3237
3278
|
/* @__PURE__ */ K("div", {
|
|
3238
|
-
className:
|
|
3279
|
+
className: J.field,
|
|
3239
3280
|
"data-assistant-part": "field",
|
|
3240
3281
|
children: [/* @__PURE__ */ K("label", {
|
|
3241
3282
|
htmlFor: "research-feedback",
|
|
3242
|
-
children: [/* @__PURE__ */ G(
|
|
3243
|
-
}), /* @__PURE__ */ G(
|
|
3283
|
+
children: [/* @__PURE__ */ G(be, {}), "问题描述"]
|
|
3284
|
+
}), /* @__PURE__ */ G(D.TextArea, {
|
|
3244
3285
|
id: "research-feedback",
|
|
3245
|
-
value:
|
|
3246
|
-
onChange: (e) =>
|
|
3286
|
+
value: oe,
|
|
3287
|
+
onChange: (e) => se(e.target.value),
|
|
3247
3288
|
maxLength: 1e3,
|
|
3248
3289
|
showCount: !0,
|
|
3249
3290
|
rows: 3,
|
|
3250
3291
|
placeholder: "例如:保存表单时报错"
|
|
3251
3292
|
})]
|
|
3252
3293
|
}),
|
|
3253
|
-
/* @__PURE__ */ G(
|
|
3294
|
+
/* @__PURE__ */ G(E, {
|
|
3254
3295
|
ghost: !0,
|
|
3255
3296
|
size: "small",
|
|
3256
3297
|
styles: {
|
|
@@ -3268,35 +3309,35 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3268
3309
|
}]
|
|
3269
3310
|
})
|
|
3270
3311
|
]
|
|
3271
|
-
}),
|
|
3272
|
-
events:
|
|
3312
|
+
}), H = /* @__PURE__ */ G(xt, {
|
|
3313
|
+
events: Ae,
|
|
3273
3314
|
onDraft: i ? void 0 : (e) => {
|
|
3274
|
-
|
|
3315
|
+
te(e), _("automation");
|
|
3275
3316
|
}
|
|
3276
|
-
}, 0 + j + (
|
|
3277
|
-
className:
|
|
3317
|
+
}, 0 + j + (L?.capturedAt ?? "live")), Le = /* @__PURE__ */ K("div", {
|
|
3318
|
+
className: J.section,
|
|
3278
3319
|
"data-assistant-part": "section",
|
|
3279
3320
|
children: [
|
|
3280
3321
|
/* @__PURE__ */ K("div", {
|
|
3281
|
-
className:
|
|
3322
|
+
className: J.sectionHeading,
|
|
3282
3323
|
"data-assistant-part": "section-heading",
|
|
3283
3324
|
children: [
|
|
3284
3325
|
/* @__PURE__ */ G("span", {
|
|
3285
|
-
className:
|
|
3326
|
+
className: J.headingIcon,
|
|
3286
3327
|
"data-assistant-part": "heading-icon",
|
|
3287
|
-
children: /* @__PURE__ */ G(
|
|
3328
|
+
children: /* @__PURE__ */ G(me, {})
|
|
3288
3329
|
}),
|
|
3289
3330
|
/* @__PURE__ */ G("div", { children: /* @__PURE__ */ G("h3", { children: "接口记录" }) }),
|
|
3290
|
-
/* @__PURE__ */ K(
|
|
3331
|
+
/* @__PURE__ */ K(k, { children: [z.length, " 条"] })
|
|
3291
3332
|
]
|
|
3292
3333
|
}),
|
|
3293
3334
|
/* @__PURE__ */ K("details", {
|
|
3294
|
-
className:
|
|
3335
|
+
className: J.hint,
|
|
3295
3336
|
children: [/* @__PURE__ */ G("summary", { children: "采集范围" }), "Fetch / XHR 正文最多读取 16 KB,认证接口不采集正文。 耗时截至 Fetch 响应头到达或 XHR 请求结束。"]
|
|
3296
3337
|
}),
|
|
3297
|
-
!
|
|
3298
|
-
|
|
3299
|
-
className:
|
|
3338
|
+
!z.length && /* @__PURE__ */ G(le, { description: "暂无接口记录" }),
|
|
3339
|
+
z.slice().sort((e, t) => e.time - t.time).map((e) => /* @__PURE__ */ G(E, {
|
|
3340
|
+
className: J.request,
|
|
3300
3341
|
"data-assistant-part": "request",
|
|
3301
3342
|
ghost: !0,
|
|
3302
3343
|
size: "small",
|
|
@@ -3311,10 +3352,10 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3311
3352
|
items: [{
|
|
3312
3353
|
key: "details",
|
|
3313
3354
|
label: /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K("span", {
|
|
3314
|
-
className:
|
|
3355
|
+
className: J.requestMeta,
|
|
3315
3356
|
"data-assistant-part": "request-meta",
|
|
3316
3357
|
children: [
|
|
3317
|
-
/* @__PURE__ */ G(
|
|
3358
|
+
/* @__PURE__ */ G(k, {
|
|
3318
3359
|
color: e.failed ? "red" : "green",
|
|
3319
3360
|
children: e.status || "失败"
|
|
3320
3361
|
}),
|
|
@@ -3327,7 +3368,7 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3327
3368
|
] })
|
|
3328
3369
|
]
|
|
3329
3370
|
}), /* @__PURE__ */ G("span", {
|
|
3330
|
-
className:
|
|
3371
|
+
className: J.requestUrl,
|
|
3331
3372
|
"data-assistant-part": "request-url",
|
|
3332
3373
|
children: e.url
|
|
3333
3374
|
})] }),
|
|
@@ -3335,186 +3376,186 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3335
3376
|
}]
|
|
3336
3377
|
}, e.id))
|
|
3337
3378
|
]
|
|
3338
|
-
}), ze =
|
|
3339
|
-
metrics:
|
|
3379
|
+
}), ze = L ? L.performance ?? l() : a.performance, Be = L ? Date.parse(L.capturedAt) : a.performanceUpdatedAt, Ve = f(B, ze, Be), q = f(a.metrics, a.performance, a.performanceUpdatedAt).length, He = /* @__PURE__ */ G(kt, {
|
|
3380
|
+
metrics: B,
|
|
3340
3381
|
data: ze,
|
|
3341
3382
|
now: Be,
|
|
3342
3383
|
paused: a.paused,
|
|
3343
|
-
offline: !!
|
|
3344
|
-
}),
|
|
3345
|
-
className:
|
|
3384
|
+
offline: !!L
|
|
3385
|
+
}), Ue = /* @__PURE__ */ K("div", {
|
|
3386
|
+
className: J.section,
|
|
3346
3387
|
"data-assistant-part": "section",
|
|
3347
3388
|
children: [
|
|
3348
3389
|
/* @__PURE__ */ K("div", {
|
|
3349
|
-
className:
|
|
3390
|
+
className: J.sectionHeading,
|
|
3350
3391
|
"data-assistant-part": "section-heading",
|
|
3351
3392
|
children: [/* @__PURE__ */ G("span", {
|
|
3352
|
-
className:
|
|
3393
|
+
className: J.headingIcon,
|
|
3353
3394
|
"data-assistant-part": "heading-icon",
|
|
3354
|
-
children: /* @__PURE__ */ G(
|
|
3395
|
+
children: /* @__PURE__ */ G(F, {})
|
|
3355
3396
|
}), /* @__PURE__ */ G("div", { children: /* @__PURE__ */ G("h3", { children: "环境与数据" }) })]
|
|
3356
3397
|
}),
|
|
3357
3398
|
/* @__PURE__ */ K("dl", { children: [
|
|
3358
3399
|
/* @__PURE__ */ G("dt", { children: "网络状态" }),
|
|
3359
|
-
/* @__PURE__ */ G("dd", { children:
|
|
3400
|
+
/* @__PURE__ */ G("dd", { children: Fe.online == null ? "未知" : Fe.online ? "在线" : "离线" }),
|
|
3360
3401
|
/* @__PURE__ */ G("dt", { children: "浏览器语言" }),
|
|
3361
|
-
/* @__PURE__ */ G("dd", { children:
|
|
3402
|
+
/* @__PURE__ */ G("dd", { children: Fe.language || "未知" }),
|
|
3362
3403
|
/* @__PURE__ */ G("dt", { children: "时区" }),
|
|
3363
|
-
/* @__PURE__ */ G("dd", { children:
|
|
3404
|
+
/* @__PURE__ */ G("dd", { children: Fe.timezone || "未知" }),
|
|
3364
3405
|
/* @__PURE__ */ G("dt", { children: "设备内存" }),
|
|
3365
|
-
/* @__PURE__ */ G("dd", { children: typeof
|
|
3406
|
+
/* @__PURE__ */ G("dd", { children: typeof Fe.deviceMemoryGB == "number" ? `${Fe.deviceMemoryGB} GB` : "不可用" })
|
|
3366
3407
|
] }),
|
|
3367
3408
|
/* @__PURE__ */ K("details", { children: [
|
|
3368
3409
|
/* @__PURE__ */ G("summary", { children: "完整环境与采集范围" }),
|
|
3369
3410
|
/* @__PURE__ */ G("p", {
|
|
3370
|
-
className:
|
|
3411
|
+
className: J.hint,
|
|
3371
3412
|
children: "不采集 Cookie、localStorage、sessionStorage 的值。"
|
|
3372
3413
|
}),
|
|
3373
|
-
/* @__PURE__ */ G(At, { value:
|
|
3414
|
+
/* @__PURE__ */ G(At, { value: Fe })
|
|
3374
3415
|
] }),
|
|
3375
|
-
|
|
3416
|
+
L && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("h3", { children: "现场页面状态" }), /* @__PURE__ */ G(At, { value: L.page })] })
|
|
3376
3417
|
]
|
|
3377
|
-
}),
|
|
3378
|
-
className:
|
|
3418
|
+
}), We = /* @__PURE__ */ G("div", {
|
|
3419
|
+
className: J.section,
|
|
3379
3420
|
"data-assistant-part": "section",
|
|
3380
|
-
children: /* @__PURE__ */ G(
|
|
3421
|
+
children: /* @__PURE__ */ G(le, { description: "知识问答尚未接入" })
|
|
3381
3422
|
});
|
|
3382
3423
|
return /* @__PURE__ */ K("div", {
|
|
3383
3424
|
"data-research-assistant": !0,
|
|
3384
3425
|
children: [/* @__PURE__ */ K("div", {
|
|
3385
|
-
className:
|
|
3426
|
+
className: J.dock,
|
|
3386
3427
|
"data-assistant-part": "dock",
|
|
3387
3428
|
"data-recording": o.recording,
|
|
3388
3429
|
hidden: u,
|
|
3389
|
-
children: [/* @__PURE__ */ G(
|
|
3390
|
-
open: we && !
|
|
3391
|
-
trigger:
|
|
3392
|
-
onOpenChange: (e) => Te(e && !
|
|
3393
|
-
title: o.recording ? `研发小蜜 · 录制中 ${o.draft.steps.length} 步` :
|
|
3394
|
-
children: /* @__PURE__ */ G(
|
|
3395
|
-
dot: o.recording || !!a.frozen ||
|
|
3430
|
+
children: [/* @__PURE__ */ G(fe, {
|
|
3431
|
+
open: we && !xe && !u,
|
|
3432
|
+
trigger: xe ? [] : "hover",
|
|
3433
|
+
onOpenChange: (e) => Te(e && !xe && !u),
|
|
3434
|
+
title: o.recording ? `研发小蜜 · 录制中 ${o.draft.steps.length} 步` : q ? `研发小蜜 · ${q} 项性能告警` : a.frozen ? "研发小蜜 · 已保留异常现场" : "研发小蜜",
|
|
3435
|
+
children: /* @__PURE__ */ G(ie, {
|
|
3436
|
+
dot: o.recording || !!a.frozen || q > 0,
|
|
3396
3437
|
color: o.recording ? "red" : "orange",
|
|
3397
3438
|
offset: [-5, 5],
|
|
3398
|
-
children: /* @__PURE__ */ G(
|
|
3399
|
-
ref:
|
|
3400
|
-
className:
|
|
3439
|
+
children: /* @__PURE__ */ G(T, {
|
|
3440
|
+
ref: re,
|
|
3441
|
+
className: J.launcher,
|
|
3401
3442
|
"data-assistant-part": "launcher",
|
|
3402
3443
|
"data-draggable": !0,
|
|
3403
3444
|
"aria-label": "打开研发小蜜",
|
|
3404
3445
|
"aria-expanded": u,
|
|
3405
3446
|
"aria-controls": "research-assistant-window",
|
|
3406
|
-
onClick:
|
|
3407
|
-
icon: /* @__PURE__ */ G(Ct, { className:
|
|
3447
|
+
onClick: De,
|
|
3448
|
+
icon: /* @__PURE__ */ G(Ct, { className: J.launcherAvatar })
|
|
3408
3449
|
})
|
|
3409
3450
|
})
|
|
3410
3451
|
}), /* @__PURE__ */ G("span", {
|
|
3411
|
-
className:
|
|
3452
|
+
className: J.srOnly,
|
|
3412
3453
|
"data-assistant-part": "sr-only",
|
|
3413
3454
|
role: "status",
|
|
3414
|
-
children: o.recording ? `录制中 ${o.draft.steps.length} 步` :
|
|
3455
|
+
children: o.recording ? `录制中 ${o.draft.steps.length} 步` : q ? `${q} 项性能告警` : a.frozen ? "已保留异常现场" : ""
|
|
3415
3456
|
})]
|
|
3416
3457
|
}), /* @__PURE__ */ G(Ot, {
|
|
3417
3458
|
open: u,
|
|
3418
|
-
onMinimize:
|
|
3459
|
+
onMinimize: ae,
|
|
3419
3460
|
developer: e,
|
|
3420
3461
|
children: /* @__PURE__ */ K("div", {
|
|
3421
3462
|
"data-research-assistant": !0,
|
|
3422
|
-
className:
|
|
3463
|
+
className: J.body,
|
|
3423
3464
|
"data-assistant-part": "body",
|
|
3424
3465
|
children: [
|
|
3425
3466
|
/* @__PURE__ */ K("div", {
|
|
3426
|
-
className:
|
|
3467
|
+
className: J.toolbar,
|
|
3427
3468
|
"data-assistant-part": "toolbar",
|
|
3428
|
-
children: [/* @__PURE__ */ K("span", { children: [/* @__PURE__ */ G("i", { className: a.paused ?
|
|
3429
|
-
className: [
|
|
3469
|
+
children: [/* @__PURE__ */ K("span", { children: [/* @__PURE__ */ G("i", { className: a.paused ? J.paused : "" }), L ? "查看离线现场" : a.paused ? "采集已暂停" : "正在采集"] }), /* @__PURE__ */ K("div", {
|
|
3470
|
+
className: [J.buttonRow, J.toolbarActions].join(" "),
|
|
3430
3471
|
"data-assistant-part": "button-row toolbar-actions",
|
|
3431
|
-
children: [/* @__PURE__ */ G(
|
|
3472
|
+
children: [/* @__PURE__ */ G(T, {
|
|
3432
3473
|
type: "text",
|
|
3433
3474
|
size: "small",
|
|
3434
|
-
icon: a.paused ? /* @__PURE__ */ G(
|
|
3475
|
+
icon: a.paused ? /* @__PURE__ */ G(Ne, {}) : /* @__PURE__ */ G(Me, {}),
|
|
3435
3476
|
onClick: () => m.pause(!a.paused),
|
|
3436
3477
|
children: a.paused ? "继续采集" : "暂停采集"
|
|
3437
|
-
}), /* @__PURE__ */ G(
|
|
3478
|
+
}), /* @__PURE__ */ G(T, {
|
|
3438
3479
|
type: "text",
|
|
3439
3480
|
danger: !0,
|
|
3440
3481
|
size: "small",
|
|
3441
|
-
icon: /* @__PURE__ */ G(
|
|
3442
|
-
onClick:
|
|
3482
|
+
icon: /* @__PURE__ */ G(P, {}),
|
|
3483
|
+
onClick: Oe,
|
|
3443
3484
|
children: "清空记录"
|
|
3444
3485
|
})]
|
|
3445
3486
|
})]
|
|
3446
3487
|
}),
|
|
3447
|
-
|
|
3488
|
+
ce && /* @__PURE__ */ G(w, {
|
|
3448
3489
|
closable: !0,
|
|
3449
|
-
title:
|
|
3490
|
+
title: ce,
|
|
3450
3491
|
type: "info",
|
|
3451
|
-
onClose: () =>
|
|
3492
|
+
onClose: () => ue("")
|
|
3452
3493
|
}),
|
|
3453
|
-
|
|
3494
|
+
L?.feedback && /* @__PURE__ */ G(w, {
|
|
3454
3495
|
title: "快照中的问题描述",
|
|
3455
|
-
description:
|
|
3496
|
+
description: L.feedback,
|
|
3456
3497
|
type: "info"
|
|
3457
3498
|
}),
|
|
3458
3499
|
e && /* @__PURE__ */ K("div", {
|
|
3459
|
-
className:
|
|
3500
|
+
className: J.sources,
|
|
3460
3501
|
"data-assistant-part": "sources",
|
|
3461
3502
|
children: [
|
|
3462
|
-
/* @__PURE__ */ G(
|
|
3503
|
+
/* @__PURE__ */ G(T, {
|
|
3463
3504
|
size: "small",
|
|
3464
|
-
icon: /* @__PURE__ */ G(
|
|
3505
|
+
icon: /* @__PURE__ */ G(ke, {}),
|
|
3465
3506
|
"aria-pressed": j === "live",
|
|
3466
3507
|
type: j === "live" ? "primary" : "text",
|
|
3467
|
-
onClick: () =>
|
|
3508
|
+
onClick: () => N("live"),
|
|
3468
3509
|
children: "实时记录"
|
|
3469
3510
|
}),
|
|
3470
|
-
(!i || a.frozen) && /* @__PURE__ */ G(
|
|
3511
|
+
(!i || a.frozen) && /* @__PURE__ */ G(T, {
|
|
3471
3512
|
size: "small",
|
|
3472
|
-
icon: /* @__PURE__ */ G(
|
|
3513
|
+
icon: /* @__PURE__ */ G(M, {}),
|
|
3473
3514
|
disabled: !a.frozen,
|
|
3474
3515
|
"aria-pressed": j === "frozen",
|
|
3475
3516
|
type: j === "frozen" ? "primary" : "text",
|
|
3476
|
-
onClick: () =>
|
|
3517
|
+
onClick: () => N("frozen"),
|
|
3477
3518
|
children: "已冻结现场"
|
|
3478
3519
|
}),
|
|
3479
|
-
/* @__PURE__ */ G(
|
|
3520
|
+
/* @__PURE__ */ G(pe, {
|
|
3480
3521
|
accept: ".json,application/json",
|
|
3481
3522
|
showUploadList: !1,
|
|
3482
3523
|
beforeUpload: async (e) => {
|
|
3483
3524
|
try {
|
|
3484
3525
|
if (e.size > 2097152) throw Error("快照不能超过 2 MB");
|
|
3485
|
-
|
|
3526
|
+
A(d(await e.text())), N("imported"), _("diagnostics"), x("timeline"), ue("已载入本地快照,未上传文件");
|
|
3486
3527
|
} catch (e) {
|
|
3487
|
-
|
|
3528
|
+
ue(e instanceof Error ? e.message : "快照读取失败");
|
|
3488
3529
|
}
|
|
3489
|
-
return
|
|
3530
|
+
return pe.LIST_IGNORE;
|
|
3490
3531
|
},
|
|
3491
|
-
children: /* @__PURE__ */ G(
|
|
3532
|
+
children: /* @__PURE__ */ G(T, {
|
|
3492
3533
|
type: "text",
|
|
3493
3534
|
size: "small",
|
|
3494
|
-
icon: /* @__PURE__ */ G(
|
|
3535
|
+
icon: /* @__PURE__ */ G(U, {}),
|
|
3495
3536
|
children: "导入快照"
|
|
3496
3537
|
})
|
|
3497
3538
|
}),
|
|
3498
|
-
|
|
3539
|
+
O && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(T, {
|
|
3499
3540
|
size: "small",
|
|
3500
3541
|
icon: /* @__PURE__ */ G(Ee, {}),
|
|
3501
3542
|
"aria-pressed": j === "imported",
|
|
3502
3543
|
type: j === "imported" ? "primary" : "text",
|
|
3503
|
-
onClick: () =>
|
|
3544
|
+
onClick: () => N("imported"),
|
|
3504
3545
|
children: "导入的现场"
|
|
3505
|
-
}), /* @__PURE__ */ G(
|
|
3546
|
+
}), /* @__PURE__ */ G(T, {
|
|
3506
3547
|
type: "text",
|
|
3507
3548
|
"aria-label": "关闭导入现场",
|
|
3508
3549
|
size: "small",
|
|
3509
|
-
icon: /* @__PURE__ */ G(
|
|
3550
|
+
icon: /* @__PURE__ */ G(ge, {}),
|
|
3510
3551
|
onClick: () => {
|
|
3511
|
-
|
|
3552
|
+
A(null), N("live");
|
|
3512
3553
|
}
|
|
3513
3554
|
})] })
|
|
3514
3555
|
]
|
|
3515
3556
|
}),
|
|
3516
|
-
/* @__PURE__ */ G(
|
|
3517
|
-
className:
|
|
3557
|
+
/* @__PURE__ */ G(de, {
|
|
3558
|
+
className: J.mainTabs,
|
|
3518
3559
|
"data-assistant-part": "main-tabs",
|
|
3519
3560
|
"data-diagnostics-only": i || void 0,
|
|
3520
3561
|
activeKey: h,
|
|
@@ -3523,52 +3564,52 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3523
3564
|
{
|
|
3524
3565
|
key: "feedback",
|
|
3525
3566
|
label: "问题反馈",
|
|
3526
|
-
icon: /* @__PURE__ */ G(
|
|
3527
|
-
children:
|
|
3567
|
+
icon: /* @__PURE__ */ G(je, { "aria-hidden": !0 }),
|
|
3568
|
+
children: Ie
|
|
3528
3569
|
},
|
|
3529
3570
|
...e ? [{
|
|
3530
3571
|
key: "automation",
|
|
3531
3572
|
label: "自动化测试",
|
|
3532
|
-
icon: /* @__PURE__ */ G(
|
|
3573
|
+
icon: /* @__PURE__ */ G(I, { "aria-hidden": !0 }),
|
|
3533
3574
|
children: /* @__PURE__ */ G(ht, {
|
|
3534
|
-
close:
|
|
3575
|
+
close: ae,
|
|
3535
3576
|
bridgeUrl: r,
|
|
3536
|
-
incomingDraft:
|
|
3537
|
-
onConsumeDraft: () =>
|
|
3577
|
+
incomingDraft: ee,
|
|
3578
|
+
onConsumeDraft: () => te(void 0)
|
|
3538
3579
|
})
|
|
3539
3580
|
}, {
|
|
3540
3581
|
key: "diagnostics",
|
|
3541
|
-
label: !
|
|
3542
|
-
icon: /* @__PURE__ */ G(
|
|
3543
|
-
children: /* @__PURE__ */ G(
|
|
3544
|
-
className:
|
|
3582
|
+
label: !L && q > 0 ? `诊断(${q})` : "诊断",
|
|
3583
|
+
icon: /* @__PURE__ */ G(R, { "aria-hidden": !0 }),
|
|
3584
|
+
children: /* @__PURE__ */ G(de, {
|
|
3585
|
+
className: J.diagnosticTabs,
|
|
3545
3586
|
"data-assistant-part": "diagnostic-tabs",
|
|
3546
|
-
activeKey:
|
|
3547
|
-
onChange:
|
|
3587
|
+
activeKey: v,
|
|
3588
|
+
onChange: x,
|
|
3548
3589
|
items: [
|
|
3549
3590
|
{
|
|
3550
3591
|
key: "timeline",
|
|
3551
3592
|
label: "时间线",
|
|
3552
|
-
icon: /* @__PURE__ */ G(
|
|
3553
|
-
children:
|
|
3593
|
+
icon: /* @__PURE__ */ G(ke, { "aria-hidden": !0 }),
|
|
3594
|
+
children: H
|
|
3554
3595
|
},
|
|
3555
3596
|
{
|
|
3556
3597
|
key: "network",
|
|
3557
3598
|
label: "接口",
|
|
3558
|
-
icon: /* @__PURE__ */ G(
|
|
3599
|
+
icon: /* @__PURE__ */ G(me, { "aria-hidden": !0 }),
|
|
3559
3600
|
children: Le
|
|
3560
3601
|
},
|
|
3561
3602
|
{
|
|
3562
3603
|
key: "performance",
|
|
3563
3604
|
label: Ve.length ? `性能 (${Ve.length})` : "性能",
|
|
3564
|
-
icon: /* @__PURE__ */ G(
|
|
3565
|
-
children:
|
|
3605
|
+
icon: /* @__PURE__ */ G(ve, { "aria-hidden": !0 }),
|
|
3606
|
+
children: He
|
|
3566
3607
|
},
|
|
3567
3608
|
{
|
|
3568
3609
|
key: "data",
|
|
3569
3610
|
label: "环境与数据",
|
|
3570
|
-
icon: /* @__PURE__ */ G(
|
|
3571
|
-
children:
|
|
3611
|
+
icon: /* @__PURE__ */ G(F, { "aria-hidden": !0 }),
|
|
3612
|
+
children: Ue
|
|
3572
3613
|
}
|
|
3573
3614
|
]
|
|
3574
3615
|
})
|
|
@@ -3576,8 +3617,8 @@ function Mt({ developer: e = !0, bridgeUrl: r = "/__laya-pilot", diagnosticsOnly
|
|
|
3576
3617
|
{
|
|
3577
3618
|
key: "knowledge",
|
|
3578
3619
|
label: "知识问答",
|
|
3579
|
-
icon: /* @__PURE__ */ G(
|
|
3580
|
-
children:
|
|
3620
|
+
icon: /* @__PURE__ */ G(Pe, { "aria-hidden": !0 }),
|
|
3621
|
+
children: We
|
|
3581
3622
|
}
|
|
3582
3623
|
].filter((e) => !i || e.key === "diagnostics")
|
|
3583
3624
|
})
|
|
@@ -3602,7 +3643,7 @@ var Nt = class extends _ {
|
|
|
3602
3643
|
// src/App.tsx
|
|
3603
3644
|
function Pt({ developer: e, bridgeUrl: t = "/__laya-pilot", runtimeOptions: n, themeMode: r = "gold-dark", popupContainer: a, diagnosticsOnly: o }) {
|
|
3604
3645
|
let { isBusinessFailure: c, ignoreRequest: l } = n ?? {};
|
|
3605
|
-
|
|
3646
|
+
b(() => {
|
|
3606
3647
|
if (m.isActive()) throw Error("每页只能启动一个研发小蜜;npm 组件和浏览器扩展已管理采集,请勿额外调用 startAssistant");
|
|
3607
3648
|
let e = new URL(t, location.href), n = e.pathname.replace(/\/$/, "");
|
|
3608
3649
|
m.clear(), m.pause(!1), s.clear();
|
|
@@ -3618,13 +3659,13 @@ function Pt({ developer: e, bridgeUrl: t = "/__laya-pilot", runtimeOptions: n, t
|
|
|
3618
3659
|
c,
|
|
3619
3660
|
l
|
|
3620
3661
|
]);
|
|
3621
|
-
let u =
|
|
3662
|
+
let u = te(() => A({
|
|
3622
3663
|
themeMode: r,
|
|
3623
3664
|
includeCustom: !1
|
|
3624
3665
|
}), [r]);
|
|
3625
|
-
return /* @__PURE__ */ G(
|
|
3666
|
+
return /* @__PURE__ */ G(re, {
|
|
3626
3667
|
hashPriority: "high",
|
|
3627
|
-
children: /* @__PURE__ */ G(
|
|
3668
|
+
children: /* @__PURE__ */ G(se, {
|
|
3628
3669
|
themeMode: r,
|
|
3629
3670
|
theme: {
|
|
3630
3671
|
inherit: !1,
|
|
@@ -3659,7 +3700,7 @@ function Pt({ developer: e, bridgeUrl: t = "/__laya-pilot", runtimeOptions: n, t
|
|
|
3659
3700
|
children: /* @__PURE__ */ G("div", {
|
|
3660
3701
|
"data-research-assistant": !0,
|
|
3661
3702
|
"data-assistant-part": "scope",
|
|
3662
|
-
className:
|
|
3703
|
+
className: qe.scope,
|
|
3663
3704
|
style: u,
|
|
3664
3705
|
children: /* @__PURE__ */ G(Mt, {
|
|
3665
3706
|
developer: e,
|