 sswandClaude
|
98dd56cedc
|
feat(test): 新增 test render 子命令 (源码渲染验证, 替代浏览器验证)
实现 (镜像 web 端渲染契约 + 调 API 字段对比):
- @vue/compiler-sfc 解析 web/.../sysData/dictionary/{index,Form,components/index,components/Form}.vue
- list mode: 提取 BasicColumn[].dataIndex (列表渲染字段)
- form mode: 提取 useForm({schemas:[{field}]}).field (表单渲染字段)
- 调对应 API 拿当前数据 (DictionaryType / DictionaryData/{typeId})
- 对比: 渲染字段 ⊆ API 字段 ? PASS : FAIL
覆盖 4 个页面 (dict module):
- 字典类型列表 (components/index.vue + GET /DictionaryType)
- 字典数据列表 (index.vue + GET /DictionaryData/{typeId})
- 字典类型编辑表单 (components/Form.vue + GET /DictionaryType/{id})
- 字典数据编辑表单 (Form.vue + GET /DictionaryData/{id}/Info)
vs 浏览器测试:
- 速度 2s vs 30s+
- 不需 playwright / 浏览器启动
- 不依赖 SPA 路由 (JNPF admin 菜单经常 404)
- 局限: 查不出 vmodel bind bug (浏览器 JS) → 仍需 ssw-e2e-test
镜像 web 端代码 (2026-06-27 读源码):
- web/.../sysData/dictionary/index.vue L27-32 BasicColumn
- web/.../sysData/dictionary/Form.vue L19-62 useForm.schemas
- web/.../sysData/dictionary/components/index.vue L20-25 BasicColumn
- web/.../sysData/dictionary/components/Form.vue L19-69 useForm.schemas
- web/.../api/systemData/dictionary.ts L9-60
镜像 JNPF 后端:
- jnpf/.../controller/DictionaryTypeController.java L57 L168-169
- jnpf/.../controller/DictionaryDataController.java L89 L257-258
验证 (在 tdd1 Batch 1 跑通):
- PASS: 字典类型列表 (4 渲染字段 ⊆ 9 API 字段)
- PASS: 字典数据列表 (4 渲染字段 ⊆ 6 API 字段)
- PASS: 字典数据编辑表单 (6 渲染字段 ⊆ 8 API 字段)
用户拍板: 把'读 vue + 调 API'方法固化, 替代浏览器验证.
Co-Authored-By: Claude <[email protected]>
|
2026-06-27 17:26:01 +08:00 |
|