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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  **这是什么**:一个 DSH bundle 插件,同时提供 Web 工作台、7 个模型工具、一条 CLI 和一套单测。它不是单元测试框架,也不替代接口测试。
8
8
 
9
- **和旧版的关系**:产品层与 UI 已重写;agent-browser 会话、flow DSL、seed 配方、backfill、knowledge 等引擎层保留。旧 CLI uitest/bin/uitest.mjs 仍可用于 flow 只读回归与报告。
9
+ **和旧版的关系**:产品层与 UI 已重写;agent-browser 会话、flow DSL、seed 配方、backfill、knowledge 等引擎层保留。旧 CLI bin/uitest.mjs 仍可用于 flow 只读回归与报告。
10
10
 
11
11
  ## 1. 主线
12
12
 
@@ -36,10 +36,10 @@ flow 不是执行前提。自然语言用例才是事实来源。
36
36
 
37
37
  本地视觉预览:
38
38
 
39
- node uitest/studio/preview/server.mjs
39
+ node studio/preview/server.mjs
40
40
  # 打开 http://127.0.0.1:4173/
41
41
 
42
- 预览使用 uitest/studio/preview/sample.json,不访问真实项目。
42
+ 预览使用 studio/preview/sample.json,不访问真实项目。
43
43
 
44
44
  ## 3. Host API
45
45
 
@@ -87,20 +87,20 @@ flow 不是执行前提。自然语言用例才是事实来源。
87
87
 
88
88
  ## 5. CLI
89
89
 
90
- node uitest/bin/studio.mjs import 文件或目录 --project .
91
- node uitest/bin/studio.mjs cases --project . --mode agent
92
- node uitest/bin/studio.mjs plan --project . --case TC-FP001-01
93
- node uitest/bin/studio.mjs batch create --project . --flow-only --workers 3
94
- node uitest/bin/studio.mjs batch create --project . --case TC-FP001-01 --workers 3
95
- node uitest/bin/studio.mjs batch run --project . --id <batchId>
96
- node uitest/bin/studio.mjs batch status --project . --id <batchId>
97
- node uitest/bin/studio.mjs batch backfill --project . --id <batchId> --apply
98
- node uitest/bin/studio.mjs run-case <caseId> --project .
99
- node uitest/bin/uitest.mjs agent-session knowledge --id <sessionId> --query "列表未加载" --project . --json
100
- node uitest/bin/studio.mjs flows --project .
101
- node uitest/bin/studio.mjs knowledge --project .
102
- npm run knowledge:central:sync
103
- node uitest/bin/studio.mjs doctor --project .
90
+ node bin/studio.mjs import 文件或目录 --project .
91
+ node bin/studio.mjs cases --project . --mode agent
92
+ node bin/studio.mjs plan --project . --case TC-FP001-01
93
+ node bin/studio.mjs batch create --project . --flow-only --workers 3
94
+ node bin/studio.mjs batch create --project . --case TC-FP001-01 --workers 3
95
+ node bin/studio.mjs batch run --project . --id <batchId>
96
+ node bin/studio.mjs batch status --project . --id <batchId>
97
+ node bin/studio.mjs batch backfill --project . --id <batchId> --apply
98
+ node bin/studio.mjs run-case <caseId> --project .
99
+ node bin/uitest.mjs agent-session knowledge --id <sessionId> --query "列表未加载" --project . --json
100
+ node bin/studio.mjs flows --project .
101
+ node bin/studio.mjs knowledge --project .
102
+ node scripts/knowledge-central-sync.mjs --project .
103
+ node bin/studio.mjs doctor --project .
104
104
 
105
105
  纯 CLI 只能跑 flow 泳道;Agent 泳道需要 DSH Host 的 subagents/agents 服务。没有活跃父 Agent 时,Host 会通过 sessionController 创建并复用「测试工作室 Agent 执行」会话,再启动测试子 Agent。CLI 会把 Agent 用例标为阻塞,不会卡住其它用例。只想跑 flow 时加 --flow-only。
106
106
 
@@ -134,13 +134,13 @@ flow 不是执行前提。自然语言用例才是事实来源。
134
134
 
135
135
  ## 5.1.2 中心知识库(Graphiti)
136
136
 
137
- - 启动:`cd test/knowledge-poc && docker compose up -d --build`;健康检查 `curl http://127.0.0.1:8000/health`。
138
- - Docker 服务在 `test/knowledge-poc`,默认 `http://127.0.0.1:8000`,Neo4j 在 7474/7687。
137
+ - 中心知识库是本仓库的 `test/knowledge-poc`(Graphiti + Neo4j),不随插件包分发;健康检查 `curl http://127.0.0.1:8000/health`。
138
+ - 启动:`cd test/knowledge-poc && docker compose up -d --build`;默认地址 `http://127.0.0.1:8000`,Neo4j 在 7474/7687;服务不可用时插件退回本地 `knowledge/`。
139
139
  - 配置:`knowledge.central = { enabled, url, groupId, timeoutMs, batchSize }`;也支持 `UITEST_KNOWLEDGE_URL` / `UITEST_KNOWLEDGE_GROUP` 覆盖。
140
140
  - 中心知识库是主知识源;本地 `knowledge/` 是缓存与离线兜底。批次沉淀后会增量同步页面、流程、case-run、纠错、复盘到中心库。
141
141
  - Agent 执行前的 `agent-session knowledge` 先查中心库 `/search`,再合并本地缓存;prompt 先列中心知识,本地页面/流程标注为「本地缓存」,冲突以真实页面为准。
142
142
  - 知识页默认打开中心知识库:可浏览近况/事实/实体、按关键词服务端检索、查看 Episode 全文,并直接导入知识文件或文件夹(支持仅预览)。
143
- - 全量迁移:`npm run knowledge:central:sync`;预演:`npm run knowledge:central:dry`。同步状态文件在 `.uitest/studio/knowledge-central-ingested.json`,相同内容自动跳过。
143
+ - 全量迁移:`node scripts/knowledge-central-sync.mjs --project .`;预演加 `--dry-run`。同步状态文件在 `.uitest/studio/knowledge-central-ingested.json`,相同内容自动跳过。
144
144
  - 批次 case-run 用稳定键 `case:<caseId>`(batchId 在正文);中心 `/ingest` 按 group+name+内容幂等,同内容跳过,内容变化替换旧版本并清理 `case:<caseId>:*` 旧键;学习事件按 `kind|runDir|stepId` 幂等。
145
145
  - 规范 Episode 归最新一次实际执行所有:旧批次重新沉淀不覆盖更新批次;手动/阻断执行没有 run 目录,不发 case Episode。
146
146
  - 批次内重跑累计页面、动作与等待,观察变少不缩小正文;页面/流程 Episode 与 `knowledge-central-sync.mjs` 共用同一套序列化,避免互相替换。
@@ -199,7 +199,7 @@ flow 不是执行前提。自然语言用例才是事实来源。
199
199
 
200
200
  ## 8. 目录
201
201
 
202
- uitest/
202
+ .
203
203
  studio/
204
204
  model.mjs 领域模型与纯函数
205
205
  store.mjs 批次/用例执行/事件/锁/文档索引
@@ -229,8 +229,8 @@ flow 不是执行前提。自然语言用例才是事实来源。
229
229
 
230
230
  ## 10. 测试
231
231
 
232
- node --test uitest/studio/test/
233
- node --test uitest/test/
232
+ npm test
233
+ # 等价于 node --test test/ studio/test/
234
234
 
235
235
  工作室单测覆盖:自然语言拆分、导入幂等、计划分泳道、批次存储、flow+Agent 双泳道、按批次回写、回写锁、Host 路由。旧单测覆盖引擎层与旧路由契约。
236
236
 
@@ -1,4 +1,3 @@
1
- // 由 scripts/sync-ab.mjs 从 test/fixtures/lib/ab.mjs 生成,不要手改。
2
1
  /**
3
2
  * agent-browser 会话层(lib/ab.mjs)
4
3
  * =====================================================================
@@ -3,7 +3,7 @@
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import process from 'node:process';
6
- import { Ab, sleep } from './vendor/ab.mjs';
6
+ import { Ab, sleep } from './ab.mjs';
7
7
  import { resolveUrl } from './config.mjs';
8
8
  import { ConfigError, StepError, ensureDir, slug, timeStamp, truncate } from './util.mjs';
9
9
  import { stopAgentBrowserSessions } from './agent-browser-cleanup.mjs';
package/lib/xlsx.mjs CHANGED
@@ -595,14 +595,14 @@ export const HEADER_ALIASES = {
595
595
  module: ['模块', '所属模块', '业务模块'],
596
596
  l1: ['一级功能', '场景', '一级模块', '功能模块'],
597
597
  l2: ['二级功能', '子功能', '功能点分组'],
598
- functionPoint: ['测试功能点', '用例名称', '测试点', '用例标题', '标题', '测试功能'],
598
+ functionPoint: ['测试功能点', '用例名称', '测试点', '用例标题', '标题', '测试功能', '测试内容', '用例描述', '测试描述'],
599
599
  precondition: ['前提条件', '前置条件', '预置条件'],
600
- steps: ['操作步骤', '执行步骤', '步骤'],
600
+ steps: ['操作步骤', '执行步骤', '步骤', '测试步骤'],
601
601
  expected: ['预期结果', '期望结果', '预期'],
602
- testResult: ['测试结果', '执行结果', '结果'],
602
+ testResult: ['测试结果', '执行结果', '结果', '实际结果'],
603
603
  remark: ['备注', '说明', '备注说明'],
604
604
  automationClass: ['可自动化', '是否可自动化', '自动化分类', '自动化等级', '自动化'],
605
- type: ['用例类型', '类型'],
605
+ type: ['用例类型', '类型', '测试类型'],
606
606
  page: ['页面', '关联页面', '所在页面'],
607
607
  };
608
608
 
@@ -710,13 +710,15 @@ export function buildCases({
710
710
  { sheet, file },
711
711
  );
712
712
  }
713
- if (header.mapping.functionPoint === undefined) {
713
+ if (header.mapping.functionPoint === undefined
714
+ && header.mapping.l1 === undefined
715
+ && header.mapping.l2 === undefined) {
714
716
  const actual = [...(rows.get(header.rowNumber)?.keys() || [])]
715
717
  .sort((a, b) => a - b)
716
718
  .map((col) => `${indexToCol(col)}=${cellPlainText(rows.get(header.rowNumber)?.get(col))}`)
717
719
  .join(' | ');
718
720
  throw new XlsxError(
719
- `表头缺失:工作表「${sheet}」第 ${header.rowNumber} 行未找到「测试功能点」列;实际表头:${actual || '(空行)'}`,
721
+ `表头缺失:工作表「${sheet}」第 ${header.rowNumber} 行未找到「测试功能点」列(也没有一级/二级功能列);实际表头:${actual || '(空行)'}`,
720
722
  { sheet, headerRow: header.rowNumber },
721
723
  );
722
724
  }
@@ -736,12 +738,14 @@ export function buildCases({
736
738
  const l1Order = new Map();
737
739
  const cases = [];
738
740
  for (const rowNumber of dataRowNumbers) {
739
- const functionPoint = readCell(rowNumber, 'functionPoint');
740
741
  const caseIdRaw = readCell(rowNumber, 'caseId');
741
742
  const tcIdRaw = readCell(rowNumber, 'tcId');
743
+ const l1 = readCell(rowNumber, 'l1');
744
+ const l2 = readCell(rowNumber, 'l2');
745
+ // 「测试内容」等描述列已并入 functionPoint;都没有时退回一级/二级功能
746
+ const functionPoint = readCell(rowNumber, 'functionPoint') || [l1, l2].filter(Boolean).join('/');
742
747
  if (!functionPoint && !caseIdRaw && !tcIdRaw) continue;
743
748
 
744
- const l1 = readCell(rowNumber, 'l1');
745
749
  if (l1 && !l1Order.has(l1)) l1Order.set(l1, l1Order.size);
746
750
  const seq = /^\d+$/.test(caseIdRaw) ? Number(caseIdRaw) : cases.length + 1;
747
751
  const remark = readCell(rowNumber, 'remark');
@@ -757,8 +761,9 @@ export function buildCases({
757
761
  priority: readCell(rowNumber, 'priority'),
758
762
  module: readCell(rowNumber, 'module'),
759
763
  l1,
760
- l2: readCell(rowNumber, 'l2'),
764
+ l2,
761
765
  functionPoint,
766
+ type: readCell(rowNumber, 'type'),
762
767
  precondition: readCell(rowNumber, 'precondition'),
763
768
  steps: readCell(rowNumber, 'steps'),
764
769
  expected: readCell(rowNumber, 'expected'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-uitest",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "type": "module",
5
5
  "description": "Test Studio for DSH: import cases into natural-language tests, seed preconditions, run flow and Agent cases concurrently with agent-browser, archive evidence, write back by batch, and accumulate reusable flows and page knowledge.",
6
6
  "icon": "./icon.svg",
@@ -34,13 +34,18 @@
34
34
  "node": ">=20"
35
35
  },
36
36
  "scripts": {
37
- "prepack": "node scripts/sync-ab.mjs"
37
+ "test": "node --test test/ studio/test/",
38
+ "preview": "node studio/preview/server.mjs"
38
39
  },
39
40
  "dependencies": {
40
41
  "exceljs": "^4.4.0",
41
42
  "jszip": "^3.10.1",
42
43
  "playwright-core": "^1.56.0"
43
44
  },
45
+ "devDependencies": {
46
+ "react": "^18.3.1",
47
+ "react-dom": "^18.3.1"
48
+ },
44
49
  "dsh": {
45
50
  "bundle": {
46
51
  "patch": "./cordis.patch.yml"
@@ -40,17 +40,17 @@ flow 不是执行的前提。自然语言用例才是事实来源;flow 是执
40
40
 
41
41
  在测试工程目录下运行:
42
42
 
43
- node uitest/bin/studio.mjs import cases/新用例.md --project .
44
- node uitest/bin/studio.mjs cases --project . --mode agent
45
- node uitest/bin/studio.mjs plan --project . --case TC-FP001-01
46
- node uitest/bin/studio.mjs batch create --project . --case TC-FP001-01 --workers 3
47
- node uitest/bin/studio.mjs batch run --project . --id <batchId>
48
- node uitest/bin/studio.mjs batch status --project . --id <batchId>
49
- node uitest/bin/studio.mjs batch backfill --project . --id <batchId> --apply
50
- node uitest/bin/studio.mjs flows --project .
51
- node uitest/bin/studio.mjs knowledge --project .
52
- node uitest/bin/studio.mjs doctor --project .
53
- node uitest/bin/uitest.mjs agent-session knowledge --id <sessionId> --query "列表未加载" --project . --json
43
+ node bin/studio.mjs import cases/新用例.md --project .
44
+ node bin/studio.mjs cases --project . --mode agent
45
+ node bin/studio.mjs plan --project . --case TC-FP001-01
46
+ node bin/studio.mjs batch create --project . --case TC-FP001-01 --workers 3
47
+ node bin/studio.mjs batch run --project . --id <batchId>
48
+ node bin/studio.mjs batch status --project . --id <batchId>
49
+ node bin/studio.mjs batch backfill --project . --id <batchId> --apply
50
+ node bin/studio.mjs flows --project .
51
+ node bin/studio.mjs knowledge --project .
52
+ node bin/studio.mjs doctor --project .
53
+ node bin/uitest.mjs agent-session knowledge --id <sessionId> --query "列表未加载" --project . --json
54
54
 
55
55
  纯 CLI 只能跑 flow 泳道;Agent 泳道需要 DSH Host 的 subagents/agents 服务。没有活跃父 Agent 时,Host 会通过 sessionController 创建并复用「测试工作室 Agent 执行」会话。CLI 会把 Agent 用例标为阻塞,不会卡住其它用例。
56
56
 
@@ -1,6 +1,6 @@
1
1
  # 测试用例 xlsx 与结果库参考
2
2
 
3
- 本工具把 xlsx 测试用例工作簿当作**用例来源**,不要求工作簿由本工具生成;解析规则与字段别名集中定义在 `plugins/uitest/lib/xlsx.mjs`。
3
+ 本工具把 xlsx 测试用例工作簿当作**用例来源**,不要求工作簿由本工具生成;解析规则与字段别名集中定义在 `lib/xlsx.mjs`。
4
4
 
5
5
  ## 1. 工作簿结构假设
6
6
 
@@ -21,7 +21,32 @@
21
21
 
22
22
  `cases` 的 JSON 输出里有 `sheets` 数组,可用于确认实际表名。
23
23
 
24
- ### 1.2 主表列(M006 实测,11 列)
24
+ ### 1.2 主表列:两种实际列结构
25
+
26
+ 解析器按**表头名**映射列,不依赖列位置;下面两种是实际遇到的形态,列顺序可以不同。
27
+
28
+ #### 1.2.1 OMS 二期风格(12 列,**导出模板以此为准**)
29
+
30
+ `OMS二期订单管理模块测试用例.xlsx` 的「测试用例」表:表头 1 行 + 用例 311 行,列 A–L。
31
+
32
+ | 列 | 表头 | 映射字段 |
33
+ | --- | --- | --- |
34
+ | A | 编号 | `seq` |
35
+ | B | 优先级 | `priority` |
36
+ | C | 模块 | `module` |
37
+ | D | 一级功能 | `l1` |
38
+ | E | 二级功能 | `l2` |
39
+ | F | 测试类型 | `type` |
40
+ | G | 测试内容 | `functionPoint`(用例名称) |
41
+ | H | 前提条件 | `precondition` |
42
+ | I | 测试步骤 | `steps` |
43
+ | J | 预期结果 | `expected` |
44
+ | K | 实际结果 | `testResult` |
45
+ | L | 备注 | `remark` |
46
+
47
+ 导出(`studio` 的用例/结果 xlsx)沿用这套列,并在末尾追加 `是否可自动化`、`用例编号`,结果表再追加 `执行批次`、`耗时`、`执行说明`。因此**导出的用例表可以直接再导入**,内容摘要不变。
48
+
49
+ #### 1.2.2 M006 风格(11 列)
25
50
 
26
51
  `PRD/履约管理/M006履约管理模块-测试用例.xlsx` 的「履约管理」表:表头 1 行 + 用例 249 行,列 A–K。
27
52
 
@@ -44,6 +69,7 @@
44
69
  1. **E 列是合并单元格**:`E2:E29`、`E30:E47`… 共 15 个合并区,只有左上角有值。解析时引擎会先把合并区向下填充(`fillMergedCells`),所以 `cases[].l2` 能取到分组名;如果直接读原始 XML 会得到大量空值。
45
70
  2. **主表没有独立 TC 编号列**:TC 编号在 K 列备注第一段(如 `TC-FP001-01;功能-正向`)。配套的「上下游影响」表虽有 `用例编号` 列且与主表逐行对应,但它不是主表列,不参与主表解析。
46
71
  3. **表头行不写死在第 1 行**:引擎在前 10 行内找「命中列最多且包含测试功能点/序号/用例编号」的行作为表头,因此带标题行、说明行的其他模块工作簿也能解析。
72
+ 4. **「测试功能点」不是必须列**:没有该列(或 `测试内容`/`用例名称` 等别名)时,用「一级功能/二级功能」拼出功能点(如 `选择报价单/列表展示`);两者都没有才报「表头缺失」。OMS 二期表里的 `测试内容` 是长句用例描述,导入后就是 `functionPoint`。
47
73
 
48
74
  补充:工作簿无 `sharedStrings.xml`,字符串以 `inlineStr` 存储;J/K 两列部分单元格为 `t="str"`(生成后二次写入),两种读法一致。无公式、无批注。
49
75
 
@@ -51,16 +77,16 @@
51
77
 
52
78
  ```bash
53
79
  # 摘要 + 前 N 条
54
- node plugins/uitest/bin/uitest.mjs cases --project <测试工程目录>
80
+ node bin/uitest.mjs cases --project <测试工程目录>
55
81
 
56
82
  # 按场景/关键字过滤,只看可自动化 A 类,限 20 条
57
- node plugins/uitest/bin/uitest.mjs cases --sheet 履约管理 --filter 偏差 --class A --limit 20 --detail
83
+ node bin/uitest.mjs cases --sheet 履约管理 --filter 偏差 --class A --limit 20 --detail
58
84
 
59
85
  # 精确看某条用例(序号或 TC 编号)
60
- node plugins/uitest/bin/uitest.mjs cases --id TC-FP012A-01 --detail
86
+ node bin/uitest.mjs cases --id TC-FP012A-01 --detail
61
87
 
62
88
  # 机器可读
63
- node plugins/uitest/bin/uitest.mjs cases --json --detail --limit 50
89
+ node bin/uitest.mjs cases --json --detail --limit 50
64
90
  ```
65
91
 
66
92
  `cases` 首次解析后缓存到 `.uitest/cases.json`,xlsx 文件修改时间/大小变化时自动失效重读。参数含义:
@@ -135,11 +161,11 @@ node plugins/uitest/bin/uitest.mjs cases --json --detail --limit 50
135
161
  在 `config.cases.xlsx` 之外,可把额外 xlsx(或目录)导入项目用例库;**不修改用户配置的 xlsx**。导入用例存 `<project>/.uitest/cases/imported.json`。
136
162
 
137
163
  ```bash
138
- node plugins/uitest/bin/uitest.mjs cases import extra.xlsx --project <工程目录>
139
- node plugins/uitest/bin/uitest.mjs cases import extra.xlsx --sheet 履约管理 --name "M006 回归用例" --project <工程目录>
140
- node plugins/uitest/bin/uitest.mjs cases import cases-dir --project <工程目录>
141
- node plugins/uitest/bin/uitest.mjs cases sources --project <工程目录>
142
- node plugins/uitest/bin/uitest.mjs cases remove --id <importId> --project <工程目录>
164
+ node bin/uitest.mjs cases import extra.xlsx --project <工程目录>
165
+ node bin/uitest.mjs cases import extra.xlsx --sheet 履约管理 --name "M006 回归用例" --project <工程目录>
166
+ node bin/uitest.mjs cases import cases-dir --project <工程目录>
167
+ node bin/uitest.mjs cases sources --project <工程目录>
168
+ node bin/uitest.mjs cases remove --id <importId> --project <工程目录>
143
169
  ```
144
170
 
145
171
  存储:
@@ -229,7 +255,7 @@ node plugins/uitest/bin/uitest.mjs cases remove --id <importId> --project <工
229
255
  写入命令:
230
256
 
231
257
  ```bash
232
- node plugins/uitest/bin/uitest.mjs result add \
258
+ node bin/uitest.mjs result add \
233
259
  --case TC-FP012A-01 \
234
260
  --status 失败 \
235
261
  --note "默认加载 169 条,最早 2026-07-03;默认 100 条/页" \
@@ -251,16 +277,16 @@ node plugins/uitest/bin/uitest.mjs result add \
251
277
  - 模块:模块 / 所属模块 / 业务模块
252
278
  - 一级功能:一级功能 / 场景 / 一级模块 / 功能模块
253
279
  - 二级功能:二级功能 / 子功能 / 功能点分组
254
- - 测试功能点:测试功能点 / 用例名称 / 测试点 / 用例标题 / 标题 / 测试功能
280
+ - 测试功能点(用例名称):测试功能点 / 用例名称 / 测试点 / 用例标题 / 标题 / 测试功能 / 测试内容 / 用例描述 / 测试描述
255
281
  - 前提条件:前提条件 / 前置条件 / 预置条件
256
- - 操作步骤:操作步骤 / 执行步骤 / 步骤
282
+ - 操作步骤:操作步骤 / 执行步骤 / 步骤 / 测试步骤
257
283
  - 预期结果:预期结果 / 期望结果 / 预期
258
- - 测试结果:测试结果 / 执行结果 / 结果
284
+ - 测试结果:测试结果 / 执行结果 / 结果 / 实际结果
259
285
  - 备注:备注 / 说明 / 备注说明
260
- - 可自动化:可自动化 / 自动化分类 / 自动化等级 / 自动化
261
- - 用例类型:用例类型 / 类型
286
+ - 可自动化:可自动化 / 是否可自动化 / 自动化分类 / 自动化等级 / 自动化
287
+ - 用例类型:用例类型 / 类型 / 测试类型
262
288
  - 页面:页面 / 关联页面 / 所在页面
263
- 2. **必须有「测试功能点」列**(或别名);否则报「表头缺失」并列出实际表头。序号列可缺省。
289
+ 2. **功能点列不是必需的**:「测试功能点/测试内容/用例名称」任一别名存在即可;都没有时退回「一级功能/二级功能」。两者都缺失才报「表头缺失」并列出实际表头。序号列可缺省。
264
290
  3. **合并单元格按左上角值向下填充**;前提是合并区信息存在(xlsx 内建),无需人工拆表。
265
291
  4. **多工作表**:一次只解析一张;工作簿里其他表当作说明材料,不影响用例数。
266
292
  5. **历史报告/CSV 兼容**:`report` 生成的 `用例执行结果明细.csv` 表头为
@@ -252,23 +252,23 @@ v1 的 `steps` 是字符串步骤(文档原文),不是 flow DSL。
252
252
 
253
253
  ```bash
254
254
  # 库
255
- node plugins/uitest/bin/uitest.mjs knowledge lib list --project <工程目录>
256
- node plugins/uitest/bin/uitest.mjs knowledge lib create "M006 订单管理系统" \
255
+ node ./bin/uitest.mjs knowledge lib list --project <工程目录>
256
+ node ./bin/uitest.mjs knowledge lib create "M006 订单管理系统" \
257
257
  [--id m006] [--description "..."] [--system "中谷海运 OMS"] --project <工程目录>
258
- node plugins/uitest/bin/uitest.mjs knowledge lib use m006-订单管理系统 --project <工程目录>
259
- node plugins/uitest/bin/uitest.mjs knowledge lib use --dir /data/knowledge/m006 --project <工程目录>
260
- node plugins/uitest/bin/uitest.mjs knowledge lib use --local --project <工程目录>
261
- node plugins/uitest/bin/uitest.mjs knowledge lib show m006-订单管理系统 --json --project <工程目录>
258
+ node ./bin/uitest.mjs knowledge lib use m006-订单管理系统 --project <工程目录>
259
+ node ./bin/uitest.mjs knowledge lib use --dir /data/knowledge/m006 --project <工程目录>
260
+ node ./bin/uitest.mjs knowledge lib use --local --project <工程目录>
261
+ node ./bin/uitest.mjs knowledge lib show m006-订单管理系统 --json --project <工程目录>
262
262
 
263
263
  # bundle 导出/导入
264
- node plugins/uitest/bin/uitest.mjs knowledge lib export [<idOrName>] \
264
+ node ./bin/uitest.mjs knowledge lib export [<idOrName>] \
265
265
  [--out /tmp/m006.json] --project <工程目录>
266
- node plugins/uitest/bin/uitest.mjs knowledge lib import /tmp/m006.json \
266
+ node ./bin/uitest.mjs knowledge lib import /tmp/m006.json \
267
267
  --name "M006 迁移副本" --project <工程目录>
268
- node plugins/uitest/bin/uitest.mjs knowledge lib import /tmp/m006.json \
268
+ node ./bin/uitest.mjs knowledge lib import /tmp/m006.json \
269
269
  --into m006-订单管理系统 --project <工程目录>
270
- node plugins/uitest/bin/uitest.mjs knowledge lib import /data/knowledge/m006 --project <工程目录>
271
- node plugins/uitest/bin/uitest.mjs knowledge lib import bundles-folder --project <工程目录>
270
+ node ./bin/uitest.mjs knowledge lib import /data/knowledge/m006 --project <工程目录>
271
+ node ./bin/uitest.mjs knowledge lib import bundles-folder --project <工程目录>
272
272
  ```
273
273
 
274
274
  CLI JSON 输出:
@@ -317,7 +317,7 @@ bundle 是 JSON(不是压缩包):
317
317
  ### 3.4 文档导入(Markdown/TXT)
318
318
 
319
319
  ```bash
320
- node plugins/uitest/bin/uitest.mjs knowledge import-doc docs/m006.md \
320
+ node ./bin/uitest.mjs knowledge import-doc docs/m006.md \
321
321
  [--name "M006 履约管理"] [--system "中谷海运 OMS"] [--into <idOrName>] --project <工程目录>
322
322
  ```
323
323
 
@@ -398,15 +398,15 @@ node plugins/uitest/bin/uitest.mjs knowledge import-doc docs/m006.md \
398
398
 
399
399
  ```bash
400
400
  # 选择文件夹(不存在会自动创建含父目录;--name 覆盖显示名)
401
- node plugins/uitest/bin/uitest.mjs knowledge lib use --dir /data/knowledge/m006 \
401
+ node ./bin/uitest.mjs knowledge lib use --dir /data/knowledge/m006 \
402
402
  --name "M006 订单管理系统" --project <工程目录>
403
403
 
404
404
  # 切回项目本地 / 共享库
405
- node plugins/uitest/bin/uitest.mjs knowledge lib use --local --project <工程目录>
406
- node plugins/uitest/bin/uitest.mjs knowledge lib use m006-订单管理系统 --project <工程目录>
405
+ node ./bin/uitest.mjs knowledge lib use --local --project <工程目录>
406
+ node ./bin/uitest.mjs knowledge lib use m006-订单管理系统 --project <工程目录>
407
407
 
408
408
  # bundle 导入到文件夹(自动建配置)
409
- node plugins/uitest/bin/uitest.mjs knowledge lib import /tmp/m006.json \
409
+ node ./bin/uitest.mjs knowledge lib import /tmp/m006.json \
410
410
  --into-dir /data/knowledge/m006 --project <工程目录>
411
411
  ```
412
412
 
@@ -556,10 +556,10 @@ CLI `knowledge lib use --dir` JSON:
556
556
 
557
557
  ```bash
558
558
  # 用 config.urls 名称(推荐)
559
- node plugins/uitest/bin/uitest.mjs learn page fulfillList --project <工程目录> --json
559
+ node ./bin/uitest.mjs learn page fulfillList --project <工程目录> --json
560
560
 
561
561
  # 用完整 URL;可指定 pageId/title 合并到既有页面
562
- node plugins/uitest/bin/uitest.mjs learn page "http://172.17.10.70:20600/ebdapp/..." \
562
+ node ./bin/uitest.mjs learn page "http://172.17.10.70:20600/ebdapp/..." \
563
563
  --id fulfill-list --title 履约单列表 --project <工程目录>
564
564
  ```
565
565
 
@@ -584,8 +584,8 @@ node plugins/uitest/bin/uitest.mjs learn page "http://172.17.10.70:20600/ebdapp/
584
584
  ### 4.2 从运行学习
585
585
 
586
586
  ```bash
587
- node plugins/uitest/bin/uitest.mjs learn from-run latest --project <工程目录> --json
588
- node plugins/uitest/bin/uitest.mjs learn from-run <run目录或label> --project <工程目录>
587
+ node ./bin/uitest.mjs learn from-run latest --project <工程目录> --json
588
+ node ./bin/uitest.mjs learn from-run <run目录或label> --project <工程目录>
589
589
  ```
590
590
 
591
591
  `latest` 取最近 `startedAt` 的 run;也接受绝对路径、相对 project 的路径、run 目录名、run label(模糊包含匹配)。
@@ -627,25 +627,25 @@ node plugins/uitest/bin/uitest.mjs learn from-run <run目录或label> --project
627
627
 
628
628
  ```bash
629
629
  # 预览:指定用例(--case 可重复;--ids 用逗号/空格分隔)
630
- node plugins/uitest/bin/uitest.mjs convert \
630
+ node ./bin/uitest.mjs convert \
631
631
  --case TC-FP012A-10 --case TC-FP012C-01 --project <工程目录> --json
632
632
 
633
633
  # 批量:默认选「未映射、class A」的前 N 条
634
- node plugins/uitest/bin/uitest.mjs convert --limit 10 --project <工程目录>
634
+ node ./bin/uitest.mjs convert --limit 10 --project <工程目录>
635
635
 
636
636
  # 换一份 xlsx / 工作表
637
- node plugins/uitest/bin/uitest.mjs convert --xlsx /path/to/other.xlsx --sheet 主表 \
637
+ node ./bin/uitest.mjs convert --xlsx /path/to/other.xlsx --sheet 主表 \
638
638
  --case <序号或TC> --project <工程目录>
639
639
 
640
640
  # 保存;同名 flow 已存在且需要覆盖时加 --force
641
- node plugins/uitest/bin/uitest.mjs convert --case TC-FP012A-10 --save --project <工程目录>
641
+ node ./bin/uitest.mjs convert --case TC-FP012A-10 --save --project <工程目录>
642
642
 
643
643
  # 已映射用例:综合最近 3 次 run + 提示重新生成(预览)
644
- node plugins/uitest/bin/uitest.mjs convert --case TC-FP012A-13 --regen \
644
+ node ./bin/uitest.mjs convert --case TC-FP012A-13 --regen \
645
645
  --hint "点击「更多」" --project <工程目录>
646
646
 
647
647
  # 覆盖原 flow(必须 --force)
648
- node plugins/uitest/bin/uitest.mjs convert --case TC-FP012A-13 --regen \
648
+ node ./bin/uitest.mjs convert --case TC-FP012A-13 --regen \
649
649
  --hint "上次空态断言失败,先等待 5 秒再人工确认" --save --force --project <工程目录>
650
650
  ```
651
651
 
@@ -799,7 +799,7 @@ node plugins/uitest/bin/uitest.mjs convert --case TC-FP012A-13 --regen \
799
799
  对已映射的 `auto-tc-fp012a-13`(TC-FP012A-13)执行:
800
800
 
801
801
  ```bash
802
- node plugins/uitest/bin/uitest.mjs convert --case TC-FP012A-13 --regen \
802
+ node ./bin/uitest.mjs convert --case TC-FP012A-13 --regen \
803
803
  --hint "上次空态断言失败,先等待 5 秒再人工确认空状态" --save --force --project <工程目录>
804
804
  ```
805
805
 
@@ -999,17 +999,17 @@ POST /api/uitest/feedback-review
999
999
 
1000
1000
  ```bash
1001
1001
  # 记录反馈(--run 相对 output.dir;--step 为 run.json 的步骤 id)
1002
- node plugins/uitest/bin/uitest.mjs feedback add --run runs/<name> --step s5 \
1002
+ node ./bin/uitest.mjs feedback add --run runs/<name> --step s5 \
1003
1003
  --verdict incorrect --case TC-FP012A-13 \
1004
1004
  --element-position "列表下方空状态区域" --note "先等待5秒再判断" \
1005
1005
  --screenshot screenshots/step-05-s5-failed.png --project <工程目录>
1006
1006
 
1007
1007
  # 关闭截图引用
1008
- node plugins/uitest/bin/uitest.mjs feedback add --run runs/<name> --step s5 \
1008
+ node ./bin/uitest.mjs feedback add --run runs/<name> --step s5 \
1009
1009
  --verdict unclear --no-use-screenshot --project <工程目录>
1010
1010
 
1011
1011
  # 查询
1012
- node plugins/uitest/bin/uitest.mjs feedback list --case TC-FP012A-13 --flow auto-tc-fp012a-13 \
1012
+ node ./bin/uitest.mjs feedback list --case TC-FP012A-13 --flow auto-tc-fp012a-13 \
1013
1013
  --run runs/<name> --limit 20 --project <工程目录>
1014
1014
  ```
1015
1015
 
@@ -1286,8 +1286,8 @@ knowledge-patch.json apply 时由 Host 从 result.knowledge 生成
1286
1286
  ### 13.6 CLI
1287
1287
 
1288
1288
  ```bash
1289
- node plugins/uitest/bin/uitest.mjs knowledge apply .uitest/agent-jobs/<jobId>/knowledge-patch.json --project <工程目录> --json
1290
- node plugins/uitest/bin/uitest.mjs flow validate flows/auto-tc-xxx.json --json
1289
+ node ./bin/uitest.mjs knowledge apply .uitest/agent-jobs/<jobId>/knowledge-patch.json --project <工程目录> --json
1290
+ node ./bin/uitest.mjs flow validate flows/auto-tc-xxx.json --json
1291
1291
  ```
1292
1292
 
1293
1293
  - `knowledge apply` 输出 `{ok,pages:{added,merged},recipes:{...},processes:{...},business:{...},target:{source,dir,name}}`;补丁非法 `KNOWLEDGE_PATCH_INVALID` 退出 1。
@@ -1,6 +1,6 @@
1
1
  # flow DSL 参考
2
2
 
3
- flow 是 JSON 文件(**不支持 YAML**,不支持注释),描述「打开页面 → 操作 → 断言」的步骤序列。执行器是 `plugins/uitest/lib/flow.mjs`,动作实现在 `plugins/uitest/lib/browser.mjs` 的 `performAction()`。
3
+ flow 是 JSON 文件(**不支持 YAML**,不支持注释),描述「打开页面 → 操作 → 断言」的步骤序列。执行器是 `./lib/flow.mjs`,动作实现在 `./lib/browser.mjs` 的 `performAction()`。
4
4
 
5
5
  ## 1. 文件结构
6
6
 
@@ -48,8 +48,8 @@
48
48
  `open`、`do ... shot` 把图写到 `<output.dir>/<shotsDir>/`(默认 `截图/`),文件名带时间戳,适合探索阶段留证:
49
49
 
50
50
  ```bash
51
- node plugins/uitest/bin/uitest.mjs open fulfillList --shot list-default --project <工程目录>
52
- node plugins/uitest/bin/uitest.mjs do shot --name detail-probe --project <工程目录>
51
+ node ./bin/uitest.mjs open fulfillList --shot list-default --project <工程目录>
52
+ node ./bin/uitest.mjs do shot --name detail-probe --project <工程目录>
53
53
  ```
54
54
 
55
55
  ### 2.3 结果证据登记
@@ -80,7 +80,7 @@ node plugins/uitest/bin/uitest.mjs do shot --name detail-probe --project <工程
80
80
  命令:
81
81
 
82
82
  ```bash
83
- node plugins/uitest/bin/uitest.mjs report --project <工程目录> --date 2026-11-09 --process
83
+ node ./bin/uitest.mjs report --project <工程目录> --date 2026-11-09 --process
84
84
  ```
85
85
 
86
86
  CSV 默认写 UTF-8 BOM(Excel 直接打开不乱码);需要无 BOM 时加 `--no-bom`,显式要求 BOM 时加 `--bom`。`result list` 可查看结果库最新记录(去重后)。
@@ -3,7 +3,7 @@
3
3
  先跑 `doctor`,再按症状定位。所有命令的公共参数是 `--project <测试工程目录>`(缺省当前目录),`--json` 输出机器可读结果。
4
4
 
5
5
  ```bash
6
- node plugins/uitest/bin/uitest.mjs doctor --project <工程目录>
6
+ node ./bin/uitest.mjs doctor --project <工程目录>
7
7
  ```
8
8
 
9
9
  `doctor` 检查项:Node ≥ 20、配置文件、playwright-core、chromium、baseUrl 可达性、登录账号/成功判据/登录态缓存、用例 xlsx、输出目录、守护进程状态。FAIL 项必须先修复。
@@ -23,7 +23,7 @@ node plugins/uitest/bin/uitest.mjs doctor --project <工程目录>
23
23
 
24
24
  ```bash
25
25
  export UITEST_PASSWORD='<密码>'
26
- node plugins/uitest/bin/uitest.mjs login --project <工程目录>
26
+ node ./bin/uitest.mjs login --project <工程目录>
27
27
  ```
28
28
 
29
29
  报错「缺少登录密码」即环境变量未设置。CLI 当前不提供 `--password`,不要把密码写进 `uitest.config.json` 或 flow。
@@ -51,12 +51,12 @@ node plugins/uitest/bin/uitest.mjs doctor --project <工程目录>
51
51
  2. **用一次性动作探页面**(自动拉起守护浏览器,无需先 `serve`):
52
52
 
53
53
  ```bash
54
- node plugins/uitest/bin/uitest.mjs do goto fulfillList --project <工程目录>
55
- node plugins/uitest/bin/uitest.mjs do text --project <工程目录>
56
- node plugins/uitest/bin/uitest.mjs do inputs --project <工程目录>
57
- node plugins/uitest/bin/uitest.mjs do links --project <工程目录>
58
- node plugins/uitest/bin/uitest.mjs do table --project <工程目录>
59
- node plugins/uitest/bin/uitest.mjs do shot --name probe --project <工程目录>
54
+ node ./bin/uitest.mjs do goto fulfillList --project <工程目录>
55
+ node ./bin/uitest.mjs do text --project <工程目录>
56
+ node ./bin/uitest.mjs do inputs --project <工程目录>
57
+ node ./bin/uitest.mjs do links --project <工程目录>
58
+ node ./bin/uitest.mjs do table --project <工程目录>
59
+ node ./bin/uitest.mjs do shot --name probe --project <工程目录>
60
60
  ```
61
61
 
62
62
  3. **回到 flow 改定位方式**:优先换文本/placeholder;必须用选择器时选带业务语义的属性,避免 `nth-child` 位置选择器。
@@ -173,7 +173,7 @@ daemon 信息写在 `.uitest/daemon.json`:`{pid, port, startedAt, projectDir,
173
173
  - shell 里传中文路径要加引号:
174
174
 
175
175
  ```bash
176
- node plugins/uitest/bin/uitest.mjs run flows/smoke-fulfill-list.json \
176
+ node ./bin/uitest.mjs run flows/smoke-fulfill-list.json \
177
177
  --project "<工程根>"
178
178
  ```
179
179
 
@@ -25,6 +25,7 @@ const HEADER_ALIASES = new Map([
25
25
  ['department', 'department'],
26
26
  ['业务片区', 'area'],
27
27
  ['片区', 'area'],
28
+ ['分部', 'area'],
28
29
  ['area', 'area'],
29
30
  ['兼职部门', 'partTime'],
30
31
  ['兼职', 'partTime'],