@epoint-testtech/ep-stage-skill 0.0.8 → 0.0.10

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.
@@ -34,6 +34,31 @@ export type AssembleResult = {
34
34
  /** inference-trace 的 reasoningSummary + skeletonSlots 默认策略来源账本。 */
35
35
  inferenceTrace: Record<string, unknown>;
36
36
  };
37
+ /** glue 用例动作类型。 */
38
+ type GlueActionKind = 'create' | 'read' | 'update' | 'delete' | 'export';
39
+ /**
40
+ * 单条 CRUD 用例的阶段计划(用例装配与 spec 生成共用的单一事实来源)。
41
+ */
42
+ export type CrudCaseStage = {
43
+ actionKind: GlueActionKind;
44
+ queryKeyLabel: string;
45
+ component: 'input' | 'listbox';
46
+ };
47
+ /**
48
+ * 按查询字段推导 CRUD 用例阶段序列。
49
+ *
50
+ * 规则:在新增表单中出现的查询字段(可写)产出完整 create/read/update/delete 四条;
51
+ * 不在表单中的字段(如系统管理的状态)只产出 read 一条。
52
+ * export 不在此计划内,由装配器单独追加。
53
+ *
54
+ * @param searchFields - 列表页查询字段(有序)。
55
+ * @param formFieldLabels - 新增表单字段标签集合。
56
+ * @returns 有序阶段计划,顺序与 buildGlueCases 产出的用例顺序一一对应。
57
+ */
58
+ export declare function planCrudCaseStages(searchFields: Array<{
59
+ label: string;
60
+ component: 'input' | 'listbox';
61
+ }>, formFieldLabels: string[]): CrudCaseStage[];
37
62
  /**
38
63
  * 装配 contract + testcase + inference-trace 账本。
39
64
  *
@@ -41,4 +66,5 @@ export type AssembleResult = {
41
66
  * @returns contract / testcase / inferenceTrace。
42
67
  */
43
68
  export declare function assembleJson5ContractAndTestcase(input: AssembleInput): AssembleResult;
69
+ export {};
44
70
  //# sourceMappingURL=contract-testcase-assembler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-testcase-assembler.d.ts","sourceRoot":"","sources":["../../../src/testcase/contract-testcase-assembler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAA2E,MAAM,kCAAkC,CAAC;AACxJ,OAAO,KAAK,EAAE,sBAAsB,EAAqB,MAAM,kCAAkC,CAAC;AAElG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AASrE,oBAAoB;AACpB,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,mEAAmE;IACnE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,CAAC;AAyyBF;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAiKrF"}
1
+ {"version":3,"file":"contract-testcase-assembler.d.ts","sourceRoot":"","sources":["../../../src/testcase/contract-testcase-assembler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAA2E,MAAM,kCAAkC,CAAC;AACxJ,OAAO,KAAK,EAAE,sBAAsB,EAAqB,MAAM,kCAAkC,CAAC;AAElG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AASrE,oBAAoB;AACpB,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,mEAAmE;IACnE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,CAAC;AAkZF,mBAAmB;AACnB,KAAK,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,cAAc,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC,EACtE,eAAe,EAAE,MAAM,EAAE,GACxB,aAAa,EAAE,CAejB;AAiZD;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAiKrF"}
@@ -359,6 +359,29 @@ function normalizeQueryComponent(fieldInfo) {
359
359
  return 'input';
360
360
  return 'listbox';
361
361
  }
362
+ /**
363
+ * 按查询字段推导 CRUD 用例阶段序列。
364
+ *
365
+ * 规则:在新增表单中出现的查询字段(可写)产出完整 create/read/update/delete 四条;
366
+ * 不在表单中的字段(如系统管理的状态)只产出 read 一条。
367
+ * export 不在此计划内,由装配器单独追加。
368
+ *
369
+ * @param searchFields - 列表页查询字段(有序)。
370
+ * @param formFieldLabels - 新增表单字段标签集合。
371
+ * @returns 有序阶段计划,顺序与 buildGlueCases 产出的用例顺序一一对应。
372
+ */
373
+ export function planCrudCaseStages(searchFields, formFieldLabels) {
374
+ const stages = [];
375
+ for (const field of searchFields) {
376
+ if (formFieldLabels.includes(field.label)) {
377
+ stages.push({ actionKind: 'create', queryKeyLabel: field.label, component: field.component }, { actionKind: 'read', queryKeyLabel: field.label, component: field.component }, { actionKind: 'update', queryKeyLabel: field.label, component: field.component }, { actionKind: 'delete', queryKeyLabel: field.label, component: field.component });
378
+ }
379
+ else {
380
+ stages.push({ actionKind: 'read', queryKeyLabel: field.label, component: field.component });
381
+ }
382
+ }
383
+ return stages;
384
+ }
362
385
  /**
363
386
  * 生成正式用例编号。
364
387
  *
@@ -484,8 +507,8 @@ function buildGlueExecutionFields(actionKind, queryKeyLabel, queryComponent, que
484
507
  };
485
508
  }
486
509
  /**
487
- * 装配 10 条 glue cases(placename/placecategory CRUD + status.read + export.all),
488
- * 与交接文档 §4.3 一致。
510
+ * 装配 glue cases:由 {@link planCrudCaseStages} 驱动(可写字段 CRUD 四条、只读字段 read 一条),
511
+ * 外加 export 一条,与交接文档 §4.3 一致。
489
512
  *
490
513
  * @param moduleId - 模块标识(用作 caseId 前缀)。
491
514
  * @param searchFieldLabels - 列表页查询字段标签集合。
@@ -506,18 +529,11 @@ function buildGlueCases(moduleName, searchFields, formFieldLabels, sequence, dat
506
529
  reviewStatus: 'confirmed',
507
530
  ...buildGlueExecutionFields(actionKind, queryKeyLabel, componentForLabel(queryKeyLabel), queryKeyInForm(queryKeyLabel), searchFieldLabels, dataKeyLabel),
508
531
  });
509
- return [
510
- mk('create', '场所名称', 'covered'),
511
- mk('read', '场所名称', 'covered'),
512
- mk('update', '场所名称', 'covered'),
513
- mk('delete', '场所名称', 'covered'),
514
- mk('create', '场所分类', 'covered'),
515
- mk('read', '场所分类', 'partial'),
516
- mk('update', '场所分类', 'covered'),
517
- mk('delete', '场所分类', 'covered'),
518
- mk('read', '状态', 'partial'),
519
- mk('export', dataKeyLabel ?? searchFieldLabels[0] ?? '不适用', 'covered'),
520
- ];
532
+ // 计划驱动:保证用例条数/顺序与 spec 生成器逐条渲染的 test 一一对应。
533
+ // listbox 键的 read 已由骨架强制断言行锚点命中,不再是 partial。
534
+ const cases = planCrudCaseStages(searchFields, formFieldLabels).map((stage) => mk(stage.actionKind, stage.queryKeyLabel, 'covered'));
535
+ cases.push(mk('export', dataKeyLabel ?? searchFieldLabels[0] ?? '不适用', 'covered'));
536
+ return cases;
521
537
  }
522
538
  /**
523
539
  * 为子表(childGrids)装配 glue cases。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epoint-testtech/ep-stage-skill",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",