dsh-uitest 2.1.2 → 2.1.4
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/README.md +23 -23
- package/lib/{vendor/ab.mjs → ab.mjs} +0 -1
- package/lib/browser-ab.mjs +1 -1
- package/lib/xlsx.mjs +14 -9
- package/package.json +7 -2
- package/skills/uitest/SKILL.md +11 -11
- package/skills/uitest/references/cases-xlsx.md +44 -18
- package/skills/uitest/references/convert-knowledge.md +32 -32
- package/skills/uitest/references/flows.md +1 -1
- package/skills/uitest/references/results-report.md +3 -3
- package/skills/uitest/references/troubleshooting.md +9 -9
- package/studio/accounts.mjs +1 -0
- package/studio/export.mjs +7 -5
- package/studio/model.mjs +1 -0
- package/scripts/sync-ab.mjs +0 -20
- package/studio/preview/index.html +0 -88
- package/studio/preview/sample.json +0 -2215
- package/studio/preview/server.mjs +0 -498
- package/studio/test/accounts.test.mjs +0 -90
- package/studio/test/agent-live.test.mjs +0 -53
- package/studio/test/browser-profile.test.mjs +0 -85
- package/studio/test/documents.test.mjs +0 -305
- package/studio/test/export.test.mjs +0 -196
- package/studio/test/feedback.test.mjs +0 -199
- package/studio/test/host.test.mjs +0 -723
- package/studio/test/knowledge.test.mjs +0 -450
- package/studio/test/live-proxy.test.mjs +0 -161
- package/studio/test/live.test.mjs +0 -43
- package/studio/test/queue.test.mjs +0 -157
- package/studio/test/studio.test.mjs +0 -1462
package/studio/export.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// 用例/测试结果 xlsx
|
|
1
|
+
// 用例/测试结果 xlsx 导出:列结构以 OMS二期订单用例表为参考(编号/模块/一级功能/二级功能/
|
|
2
|
+
// 测试类型/测试内容/前提条件/测试步骤/预期结果/实际结果/备注),并用「用例编号」列保证再次导入时编号稳定。
|
|
2
3
|
// 只读用例库与结果库;写文件前用临时文件再原子替换。
|
|
3
4
|
import fs from 'node:fs';
|
|
4
5
|
import path from 'node:path';
|
|
@@ -10,9 +11,9 @@ import { latestByCase, readResults } from '../lib/results.mjs';
|
|
|
10
11
|
import { ensureDir, formatDuration, nowIso, slug, timeStamp } from '../lib/util.mjs';
|
|
11
12
|
import { mergeBatchRuns, readBatch, readCaseRuns } from './store.mjs';
|
|
12
13
|
|
|
13
|
-
const CASE_HEADERS = ['
|
|
14
|
+
const CASE_HEADERS = ['编号', '优先级', '模块', '一级功能', '二级功能', '测试类型', '测试内容', '前提条件', '测试步骤', '预期结果', '实际结果', '备注'];
|
|
14
15
|
const RESULT_HEADERS = [...CASE_HEADERS, '是否可自动化', '用例编号', '执行批次', '耗时', '执行说明'];
|
|
15
|
-
const CASE_WIDTHS = [
|
|
16
|
+
const CASE_WIDTHS = [6, 8, 14, 16, 20, 12, 40, 32, 55, 55, 14, 26, 18, 10];
|
|
16
17
|
const RESULT_WIDTHS = [...CASE_WIDTHS, 18, 10, 40];
|
|
17
18
|
const FONT_NAME = '微软雅黑';
|
|
18
19
|
const BORDER = Object.fromEntries(['top', 'left', 'bottom', 'right'].map((side) => [side, { style: 'thin', color: { argb: 'FF000000' } }]));
|
|
@@ -184,7 +185,7 @@ function addCoverSheet(workbook, { kind, title, config, summary, scope, batch })
|
|
|
184
185
|
const note = ws.getCell(`A${rowNumber}`);
|
|
185
186
|
note.value = kind === 'results'
|
|
186
187
|
? '测试结果来自批次执行记录或结果库;未执行用例保留在文档中,便于再次导入后继续执行。'
|
|
187
|
-
: '
|
|
188
|
+
: '列结构沿用 OMS二期订单用例表;末尾「用例编号」列用于再次导入时保持编号稳定。';
|
|
188
189
|
styleCoverCell(note);
|
|
189
190
|
return ws;
|
|
190
191
|
}
|
|
@@ -233,6 +234,7 @@ function caseValues(item, { result, run, includeResultDetail = false, defaultSta
|
|
|
233
234
|
moduleOf(item),
|
|
234
235
|
l1Of(item),
|
|
235
236
|
item.l2 || '',
|
|
237
|
+
item.type || '',
|
|
236
238
|
item.functionPoint || item.title || '',
|
|
237
239
|
item.precondition || '',
|
|
238
240
|
item.steps || '',
|
|
@@ -249,7 +251,7 @@ function caseValues(item, { result, run, includeResultDetail = false, defaultSta
|
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
function caseAligns(includeResultDetail) {
|
|
252
|
-
const aligns = ['center', 'center', 'center', 'left', 'center', 'left', 'left', 'left', 'left', 'center', 'center', 'center', 'center'];
|
|
254
|
+
const aligns = ['center', 'center', 'center', 'left', 'center', 'center', 'left', 'left', 'left', 'left', 'center', 'center', 'center', 'center'];
|
|
253
255
|
if (includeResultDetail) aligns.push('center', 'center', 'left');
|
|
254
256
|
return aligns;
|
|
255
257
|
}
|
package/studio/model.mjs
CHANGED
|
@@ -139,6 +139,7 @@ export function normalizeStudioCase(caseItem, { flow = null, preconditionFlows =
|
|
|
139
139
|
tcId,
|
|
140
140
|
seq: caseItem?.seq ?? tcId,
|
|
141
141
|
title: caseItem?.functionPoint || caseItem?.title || tcId,
|
|
142
|
+
type: caseItem?.type || '',
|
|
142
143
|
module: caseItem?.module || caseItem?.l1 || '',
|
|
143
144
|
l1: caseItem?.l1 || '',
|
|
144
145
|
l2: caseItem?.l2 || '',
|
package/scripts/sync-ab.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// 把 test/fixtures/lib/ab.mjs 同步进插件包的 lib/vendor/。
|
|
2
|
-
// 插件安装到 profile 的 node_modules 后不存在 ../../fixtures,
|
|
3
|
-
// 仓库内仍以 test/fixtures/lib/ab.mjs 为事实来源,发布前用本脚本生成副本。
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
|
|
8
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const src = path.resolve(here, '../../fixtures/lib/ab.mjs');
|
|
10
|
-
const dest = path.resolve(here, '../lib/vendor/ab.mjs');
|
|
11
|
-
const header = '// 由 scripts/sync-ab.mjs 从 test/fixtures/lib/ab.mjs 生成,不要手改。\n';
|
|
12
|
-
const next = header + fs.readFileSync(src, 'utf8');
|
|
13
|
-
const prev = fs.existsSync(dest) ? fs.readFileSync(dest, 'utf8') : '';
|
|
14
|
-
if (prev === next) {
|
|
15
|
-
console.log(`sync-ab: 已是最新 ${path.relative(process.cwd(), dest)}`);
|
|
16
|
-
} else {
|
|
17
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
18
|
-
fs.writeFileSync(dest, next);
|
|
19
|
-
console.log(`sync-ab: 已更新 ${path.relative(process.cwd(), dest)}`);
|
|
20
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="zh-CN">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>测试工作室 · 预览</title>
|
|
7
|
-
<style>
|
|
8
|
-
:root {
|
|
9
|
-
--dsw-alias-bg-base: #f7f8fa;
|
|
10
|
-
--dsw-alias-bg-layer-1: #ffffff;
|
|
11
|
-
--dsw-alias-bg-layer-2: #f1f3f5;
|
|
12
|
-
--dsw-alias-label-primary: #1f2329;
|
|
13
|
-
--dsw-alias-label-secondary: #4e5969;
|
|
14
|
-
--dsw-alias-label-tertiary: #86909c;
|
|
15
|
-
--dsw-alias-label-primary-inverted: #ffffff;
|
|
16
|
-
--dsw-alias-border-l1: #e5e6eb;
|
|
17
|
-
--dsw-alias-button-primary-fill: #1f6feb;
|
|
18
|
-
--dsw-alias-button-primary-hover: #1a5fc7;
|
|
19
|
-
--dsw-alias-link: #1f6feb;
|
|
20
|
-
--dsw-alias-state-success-primary: #12a150;
|
|
21
|
-
--dsw-alias-state-error-primary: #d92d20;
|
|
22
|
-
--dsw-alias-state-warn-primary: #d97706;
|
|
23
|
-
--dsw-alias-state-business-primary: #7c3aed;
|
|
24
|
-
--dsw-alias-interactive-bg-hover: #f2f3f5;
|
|
25
|
-
--dsw-alias-interactive-bg-active: #e8f0fe;
|
|
26
|
-
}
|
|
27
|
-
body.dark {
|
|
28
|
-
--dsw-alias-bg-base: #111318;
|
|
29
|
-
--dsw-alias-bg-layer-1: #171a21;
|
|
30
|
-
--dsw-alias-bg-layer-2: #1f232b;
|
|
31
|
-
--dsw-alias-label-primary: #eef1f6;
|
|
32
|
-
--dsw-alias-label-secondary: #aab2c0;
|
|
33
|
-
--dsw-alias-label-tertiary: #737d8c;
|
|
34
|
-
--dsw-alias-label-primary-inverted: #0b0d12;
|
|
35
|
-
--dsw-alias-border-l1: #2a303a;
|
|
36
|
-
--dsw-alias-button-primary-fill: #5b9dff;
|
|
37
|
-
--dsw-alias-button-primary-hover: #7cb2ff;
|
|
38
|
-
--dsw-alias-link: #6ea8ff;
|
|
39
|
-
--dsw-alias-state-success-primary: #3ddc97;
|
|
40
|
-
--dsw-alias-state-error-primary: #ff6b6b;
|
|
41
|
-
--dsw-alias-state-warn-primary: #f4b740;
|
|
42
|
-
--dsw-alias-state-business-primary: #b18cff;
|
|
43
|
-
--dsw-alias-interactive-bg-hover: #20252e;
|
|
44
|
-
--dsw-alias-interactive-bg-active: #1d2a44;
|
|
45
|
-
}
|
|
46
|
-
html, body, #root { height: 100%; margin: 0; }
|
|
47
|
-
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); }
|
|
48
|
-
#root { display: flex; flex-direction: column; }
|
|
49
|
-
.preview-toggle { position: fixed; right: 14px; bottom: 14px; z-index: 999; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-secondary); font-size: 12px; cursor: pointer; }
|
|
50
|
-
</style>
|
|
51
|
-
</head>
|
|
52
|
-
<body>
|
|
53
|
-
<div id="root"></div>
|
|
54
|
-
<button class="preview-toggle" onclick="document.body.classList.toggle('dark')">切换明暗</button>
|
|
55
|
-
<script src="/node_modules/react/umd/react.development.js"></script>
|
|
56
|
-
<script src="/node_modules/react-dom/umd/react-dom.development.js"></script>
|
|
57
|
-
<script>
|
|
58
|
-
window.__ModuleLoader__ = {
|
|
59
|
-
load: function (definition) {
|
|
60
|
-
window.__studioPlugin = definition.factory(function (name) {
|
|
61
|
-
if (name === 'react') return window.React;
|
|
62
|
-
throw new Error('unsupported module: ' + name);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
</script>
|
|
67
|
-
<script src="/client.js"></script>
|
|
68
|
-
<script>
|
|
69
|
-
(function () {
|
|
70
|
-
var slots = {
|
|
71
|
-
main: null,
|
|
72
|
-
inject: function (_name, fn) { fn(); },
|
|
73
|
-
register: function (spec, component) {
|
|
74
|
-
if (spec && spec.name === 'main') slots.main = component;
|
|
75
|
-
return function () {};
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var ctx = {
|
|
79
|
-
effect: function (fn) { fn(); },
|
|
80
|
-
locale: { register: function () {}, bind: function () { return function (key) { return key; }; } },
|
|
81
|
-
slots: slots
|
|
82
|
-
};
|
|
83
|
-
window.__studioPlugin.apply(ctx);
|
|
84
|
-
ReactDOM.createRoot(document.getElementById('root')).render(React.createElement(slots.main));
|
|
85
|
-
})();
|
|
86
|
-
</script>
|
|
87
|
-
</body>
|
|
88
|
-
</html>
|