TC-B workflow 改测运行时 (flowTodo 完整闭环), 替代设计页 (flowEngine)

user feedback: TC-B workflow 应该是测运行内容, 不是开发内容.
- 改 URL: onlineDev/flowEngine (BPMN 设计页) → workFlow/flowTodo (我的待办, 用户实际使用的页面)
- 重写 7 检查覆盖运行时:
  1. 页面加载
  2. 任务列表 8/8 列 (流程标题/所属流程/发起时间/发起人员/审批节点/紧急程度/流程状态/接收时间)
  3. 搜索 form + 4 tabs (全部/协办/退回/超时)
  4. 批量办理 + 任务行 办理 button
  5. FlowParser modal 打开 (点 办理)
  6. modal toolbar 流程图 button + 标题
  7. modal 审批操作 button (开始办理/退签)
- 删 check 8 (design modal) 和 form modal 系列 (跟 form 重复)
- 删 fetchWorkflowSchema (运行时不需要 workflow schema 校验, 走 TC-C render 覆盖)
- help 文本改: Prerequisites 段说明 workSystem/developSystem/testspace 默认含 workFlow.flowTodo 前端菜单, 不需额外 setup

实测 (testspace 3 个真实待办):
  workflow (flowTodo) 7/7 PASS, 11.2s — 8/8 列, 4/4 tabs, 3 任务, modal 流程图 button + 标题 + 开始办理 button 全部 DOM 渲染
  form (workSystem)  7/7 PASS,  7.9s — 回归无影响
  workflow (workSystem baseline) 3/7 PASS — 0 待办, UI 1-3 PASS, 审批 4-7 正确识别为无任务 (符合期望)
This commit is contained in:
ssw committed 2026-07-14 15:57:27 +08:00
1 parent 3372bc0ef7
commit 2a6d7ab221
1 file changed
+86 -116
+86 -116
View File
@@ -26,14 +26,14 @@
* 6. dict select 字段可达 (select 渲染)
* 7. formItem label 全部非空
*
* 7 检查 (workflow module, v0.21+ 扩展, 2026-07-14):
* 7 检查 (workflow module, v0.21+ 运行时 flowTodo 完整闭环, 2026-07-14):
* 1. 页面加载 (Vue 接管, url 正确)
* 2. 列表 table 渲染 (≥1 行或空状态可见)
* 3. 新增 button + 5 流程类型 dropdown (标准/简单/任务/自由/决策)
* 4. AI 建流程 button 存在 (v0.13+ 重要入口)
* 5. form 模态框字段完整性 (fullName/enCode/decisionType/category/icon/showType/sortCode/description ≥ 6 formItem)
* 6. form 必填字段含 fullName/category/icon (Form.vue L37/66/72 required)
* 7. formItem label 全部非空 (镜像 form 同款检查)
* 2. 任务列表 table 渲染 (8 列: 流程标题/所属流程/发起时间/发起人员/审批节点/紧急程度/流程状态/接收时间)
* 3. 搜索 form + 4 tabs (全部/协办/退回/超时, 镜像 flowTodo L53-58)
* 4. 批量办理 + 任务行 "办理" 按钮 (flowTodo L206/L226)
* 5. FlowParser modal 打开 (点 办理 → 流程详情 modal, 镜像 L131-139 toDetail)
* 6. modal toolbar 流程图 button + 标题 (FlowParser L989-994 icon-ym-flow-node-condition)
* 7. modal 审批操作 button (FlowParser L364-407 todoBtnList: 退签/开始办理)
*
* @author claude (2026-07-12, BS-NCPF-400 followup; 2026-07-14 workflow module)
*/
@@ -338,7 +338,22 @@ async function runBrowserChecks(page: Page, schema: FormSchema, menuEnCode?: str
* - index.vue L32-42 columns: fullName/enCode/category/type/creatorUser/creatorTime/sortCode/enabledMark/status (9 列)
* - 路由 /onlineDev/flowEngine (静态路径, 无后缀 hash, vs form 走 menuList)
*/
async function runWorkflowBrowserChecks(page: Page, schema?: WorkflowSchema): Promise<BrowserCheck[]> {
/**
* TC-B workflow module 7 检查 (v0.21+ 运行时 flowTodo 完整闭环, 2026-07-14)
*
* 镜像 web 端 workFlow/flowTodo 运行时页面 + FlowParser modal (vs 旧的 flowEngine 开发页面):
* - flowTodo/index.vue L43-52 columns: 流程标题/所属流程/发起时间/发起人员/审批节点/紧急程度/流程状态/接收时间 (8 列)
* - flowTodo/index.vue L123-129 actions: 办理 (opType=2, 走 FlowParser modal)
* - flowTodo/index.vue L53-58 tabs: 全部/协办/退回/超时 (4)
* - flowTodo/index.vue L65-106 search form: 6 字段 (keyword/pickerVal/flowCategory/templateId/creatorUserId/flowUrgent)
* - FlowParser.vue L364-407 buttons: 同意/拒绝/退回/转审/加签/催办/暂存/提交 (opType=2 走 todoBtnList: 退签/开始办理)
* - FlowParser.vue L989-994 toolbar: 流程图 button (icon-ym icon-ym-flow-node-condition)
* - 路由 /workFlow/flowTodo (静态路径, workSystem 前端菜单默认含此页)
*
* 与 form module 区别: form 测 form 设计器 + form 模态框, workflow 测 任务列表 + 审批 modal.
* 关联命令: `dacli test render --module=workflow` 已覆盖 workflow 静态 schema, TC-B 专攻运行时 DOM.
*/
async function runWorkflowBrowserChecks(page: Page, _schema?: WorkflowSchema): Promise<BrowserCheck[]> {
const results: BrowserCheck[] = []
// 1. 页面加载 (Vue 接管, url 正确)
@@ -351,132 +366,90 @@ async function runWorkflowBrowserChecks(page: Page, schema?: WorkflowSchema): Pr
details: { url, title },
})
// 2. 列表 table 渲染 (vxe-table, 9 列: fullName/enCode/category/type/creatorUser/creatorTime/sortCode/enabledMark/status)
// vxe-table 用 .vxe-table 包裹, 内部含 .vxe-table--body
// 2. 任务列表 table 渲染 (8 列: 流程标题/所属流程/发起时间/发起人员/审批节点/紧急程度/流程状态/接收时间)
// 镜像 flowTodo/index.vue L43-52 columns
const vxeTableCount = await page.locator('.vxe-table, table').count()
// 期望 9 列文本存在 (避免空表头)
const expectedColumns = ['流程名称', '流程编码', '流程分类', '流程类型', '创建人', '创建时间', '排序', '发布状态', '上架状态']
const expectedColumns = ['流程标题', '所属流程', '发起时间', '发起人员', '审批节点', '紧急程度', '流程状态', '接收时间']
const columnTexts: string[] = []
for (const col of expectedColumns) {
const found = await page.locator(`text="${col}"`).count()
if (found > 0) columnTexts.push(col)
}
results.push({
check: `列表 table 渲染 (${columnTexts.length}/9 列)`,
status: vxeTableCount >= 1 && columnTexts.length >= 7 ? 'PASS' : 'FAIL', // ≥7 列容忍 vxe-table 列宽省略
check: `任务列表 table 渲染 (${columnTexts.length}/8 列)`,
status: vxeTableCount >= 1 && columnTexts.length >= 6 ? 'PASS' : 'FAIL',
details: { vxeTableCount, expectedColumns, foundColumns: columnTexts },
})
// 3. 新增 button + 5 流程类型 dropdown (index.vue L296-307: a-dropdown 含 5 a-menu-item)
// "新增" 主 button (vxe-table 标题栏) — 不同 locale 翻译不同: zh-CN "新建", zh-TW/en "新增", 都兼容
const addBtnCount = await page.locator('button:has-text("新增"), button:has-text("新建")').count()
// dropdown 触发后展开含 5 a-menu-item (标准/简单/任务/自由/决策)
// 默认未展开, 这里检查 button 自身存在; dropdown 展开由 click 触发
const hasAddBtn = addBtnCount > 0
// 3. 搜索 form + 4 tabs 渲染 (flowTodo L53-58 tabs: 全部/协办/退回/超时)
const tabTexts = await page.locator('.ant-tabs-tab').allTextContents()
const expectedTabs = ['全部', '协办', '退回', '超时']
const foundTabs = expectedTabs.filter(t => tabTexts.includes(t))
const searchFormItems = await page.locator('.search-form .ant-form-item, .jnpf-content-wrapper-search-box .ant-form-item').count()
results.push({
check: '新增 button 存在',
status: hasAddBtn ? 'PASS' : 'FAIL',
details: { addBtnCount },
check: `搜索 form + 4 tabs (${foundTabs.length}/4 tabs, ${searchFormItems} 搜索字段)`,
status: foundTabs.length >= 4 && searchFormItems >= 4 ? 'PASS' : 'FAIL',
details: { tabTexts, expectedTabs, foundTabs, searchFormItems },
})
// 4. AI 建流程 button 存在 (index.vue L308, v0.13+ 入口)
const aiBtnCount = await page.locator('button:has-text("AI建流程")').count()
// 4. 批量办理 + 任务行 "办理" 按钮 (flowTodo L206 批量办理 + L226 每行 办理 action)
const batchBtns = await page.locator('button:has-text("批量办理"), button:has-text("批量退签")').count()
const handleBtns = await page.locator('button.ant-btn-link:has-text("办理")').count()
results.push({
check: 'AI 建流程 button 存在',
status: aiBtnCount > 0 ? 'PASS' : 'FAIL',
details: { aiBtnCount },
check: `批量办理 + 任务行 办理 button (批量=${batchBtns}, 行内=${handleBtns})`,
status: batchBtns >= 1 && handleBtns >= 1 ? 'PASS' : 'FAIL',
details: { batchBtns, handleBtns },
})
// 5. form 模态框字段完整性 (点新增 → 模态框 → ≥6 formItem)
// 镜像 Form.vue L31-105 schemas 8 字段: fullName/enCode/decisionType/category/icon/showType/sortCode/description
// 兼容 enCode 重复声明 (Form.vue L41/48), 期望 ≥6 字段渲染
if (addBtnCount > 0) {
// 新增按钮在 dropdown 内, 先 click dropdown trigger, 再 click "标准流程"
// index.vue L296-307: <a-dropdown> → <a-button>{{ $t('common.addText') }}<DownOutlined /></a-button>
// 触发展开后 a-menu-item 含 "标准流程"
// 5. FlowParser modal 打开 (点 "办理" → 流程详情 modal)
// 镜像 flowTodo L131-139 toDetail: 调 openFlowParser(true, {id, flowId, opType, operatorId})
// FlowParser.vue 模板 class: basic-flow-parser (L953)
const handleBtn = page.locator('button.ant-btn-link:has-text("办理")').first()
let modalOpened = false
if (await handleBtn.count() > 0) {
try {
// 优先尝试点 dropdown 内的"标准流程"
await page.locator('button:has-text("新增"), button:has-text("新建")').first().click()
await page.waitForTimeout(800)
const stdItem = page.locator('.ant-dropdown-menu-item:has-text("标准流程"), li:has-text("标准流程")').first()
if (await stdItem.count() > 0) {
await stdItem.click()
} else {
// dropdown 没展开或菜单项找不到, 直接 hover/click 第一个 a-menu-item
await page.locator('.ant-dropdown-menu-item').first().click({ timeout: 1000 }).catch(() => {})
}
await page.waitForTimeout(1500)
await handleBtn.click({ force: true, timeout: 5000 })
await page.waitForTimeout(5000) // modal + 流程信息加载
const modalCount = await page.locator('.basic-flow-parser, .full-popup.basic-flow-parser').count()
modalOpened = modalCount >= 1
} catch (e) {
// dropdown 打开失败也继续 (检查 form modal 是否出现)
modalOpened = false
}
}
const formItemCount = await page.locator('.ant-form-item').count()
const inputCount = await page.locator(
'.ant-form-item input.ant-input, .ant-form-item .ant-input-number, ' +
'.ant-form-item .ant-select, .ant-form-item textarea.ant-input'
).count()
// 检查 8 个期望字段的 label 至少出现几个 (form schemas 字段名镜像)
const expectedFormLabels = ['流程名称', '流程编码', '流程分类', '流程图标', '显示位置', '流程排序', '流程说明']
const foundLabels: string[] = []
for (const lbl of expectedFormLabels) {
const found = await page.locator(`.ant-form-item-label label:has-text("${lbl}")`).count()
if (found > 0) foundLabels.push(lbl)
}
results.push({
check: `form 模态框字段完整性 (${formItemCount} formItem, ${inputCount} input, ${foundLabels.length}/7 label)`,
status: formItemCount >= 6 && foundLabels.length >= 5 ? 'PASS' : 'FAIL',
details: { formItemCount, inputCount, expectedFormLabels, foundLabels },
check: 'FlowParser modal 打开 (点 办理)',
status: modalOpened ? 'PASS' : 'FAIL',
details: { modalOpened },
})
// 6. form 必填字段含 fullName/category/icon (Form.vue L37/66/72 required)
// 必填字段在 ant-design-vue 渲染为 .ant-form-item-required 类
// Form.vue 必填: fullName (L37), category (L66), icon (L72)
const requiredItems = await page.locator('.ant-form-item-required').count()
const requiredLabels: string[] = []
// 取 .ant-form-item-required 内的 label 文本
const reqLabelTexts = await page.locator('.ant-form-item-required .ant-form-item-label label').evaluateAll(
(els: DomElement[]) => els.map(e => e.textContent?.trim() || '').filter(Boolean)
// 6. modal toolbar 流程图 button + 标题 (FlowParser.vue L989-994 icon-ym icon-ym-flow-node-condition)
const flowChartBtn = await page.locator('.basic-flow-parser i.icon-ym-flow-node-condition').count()
const modalTitle = await page.locator('.basic-flow-parser .header-title').count()
results.push({
check: `modal toolbar 流程图 button (flowChart=${flowChartBtn}, title=${modalTitle})`,
status: flowChartBtn >= 1 && modalTitle >= 1 ? 'PASS' : 'FAIL',
details: { flowChartBtn, modalTitle },
})
// 7. modal 审批操作 button (FlowParser.vue L364-407 + L1142 opType=2 todoBtnList: 退签/开始办理)
const handleActionBtns = await page.locator('.basic-flow-parser .flow-btn-container button.ant-btn').evaluateAll(
els => els.map(e => e.textContent?.trim()).filter(t => t)
)
for (const lbl of reqLabelTexts) requiredLabels.push(lbl)
// 期望必填 3 个 (fullName/category/icon); Form.vue enCode 是 formValidate 不是 required, decisionType/showType 默认值
const requiredExpected = ['流程名称', '流程分类', '流程图标']
const requiredMatched = requiredExpected.filter(r => requiredLabels.some(l => l.includes(r.replace('图标', '图标'))))
// 兜底: 至少 3 个 .ant-form-item-required 元素 (Form.vue 至少 3 个 required)
// 关闭 modal 避免污染后续测试
const closeIcon = page.locator('.basic-flow-parser .anticon-close, .basic-flow-parser .jnpf-basic-popup-header__back').first()
if (await closeIcon.count() > 0) await closeIcon.click({ force: true }).catch(() => {})
await page.keyboard.press('Escape').catch(() => {})
await page.waitForTimeout(500)
results.push({
check: `form 必填字段 (${requiredMatched.length}/3: ${requiredExpected.join('/')})`,
status: requiredMatched.length >= 3 || requiredItems >= 3 ? 'PASS' : 'FAIL',
details: { requiredItems, requiredLabels, requiredExpected, requiredMatched },
})
// 7. formItem label 全部非空 (镜像 form module 同款检查)
const labelSelectors = [
'.ant-form-item .ant-form-item-label label',
'.ant-form-item-label label',
'.ant-form-item > .ant-form-item-label',
]
let labels: string[] = []
for (const sel of labelSelectors) {
const found = await page.locator(sel).evaluateAll(
(els: DomElement[]) => els.map(l => l.textContent?.trim() || '').filter(Boolean)
)
if (found.length > labels.length) labels = found
}
if (labels.length === 0) {
labels = await page.locator('.ant-form label').evaluateAll(
(els: DomElement[]) => els.map(l => l.textContent?.trim() || '').filter(Boolean)
)
}
const emptyLabels = labels.filter(l => !l)
results.push({
check: 'formItem label 完整性',
status: emptyLabels.length === 0 ? 'PASS' : 'FAIL',
missing: emptyLabels.length > 0 ? [`${emptyLabels.length} 个空 label`] : undefined,
details: { labelCount: labels.length, emptyCount: emptyLabels.length, sampleLabels: labels.slice(0, 5) },
check: `modal 审批操作 button (${handleActionBtns.length}: ${handleActionBtns.slice(0, 5).join('/')})`,
status: handleActionBtns.length >= 1 ? 'PASS' : 'FAIL',
details: { handleActionBtns },
})
return results
}
// ============================================================================
// Storage snapshot 获取/复用 (form + workflow 共享)
// ============================================================================
@@ -655,8 +628,9 @@ async function runWorkflowBrowserTest(opts: {
})
}
const page: Page = await context.newPage()
// 镜像 web 端 router: flowEngine 路由 = /onlineDev/flowEngine (静态路径, 无后缀 hash, vs form 的 /model/{enCode})
const realUrl = 'onlineDev/flowEngine'
// 镜像 web 端 router: flowTodo 路由 = /workFlow/flowTodo (静态路径, workSystem 前端菜单默认含)
// 注: v0.21+ 初版用 flowEngine (设计/开发页), 2026-07-14 改成 flowTodo (运行时/审批) 测真正业务内容
const realUrl = 'workFlow/flowTodo'
const fullUrl = `${baseUrl}/jnpf_app_${appCode}/${realUrl}`
await page.goto(fullUrl)
await page.waitForLoadState('networkidle', { timeout: 15000 })
@@ -719,18 +693,14 @@ export function buildTestBrowserCommand(): Command {
.option('--formId <id>', '表单 id (form module 必填, 向后兼容别名, 等同 --id)')
.addHelpText('after', `
Examples:
$ dacli test browser --module=form --formId=<id> --appCode=workSystem # 跑 form 7 检查 (~7s)
$ dacli test browser --module=workflow --appCode=testspace # 跑 workflow UI 检查 (~8s, 不需 workflow 数据)
$ dacli test browser --module=workflow --id=<workflowId> --appCode=testspace # 跑 workflow 7 检查 + schema 校验
$ dacli test browser --module=form --formId=<id> --appCode=workSystem # 跑 form 7 检查 (~7s)
$ dacli test browser --module=workflow --appCode=workSystem # 跑 flowTodo 7 检查 (~7s, 需 app 有待办数据)
$ dacli test browser --module=workflow --id=<workflowId> --appCode=testspace # 跑 flowTodo + schema 校验
Prerequisites (workflow module):
workflow module 需在 app 前端菜单中暴露流程设计入口. workSystem/developSystem baseline 不含.
testspace 准备:
dacli app switch --appCode=testspace
dacli menu create --fullName="TC-B 流程设计" --enCode="tcbflowdesign" --type=2 \\
--urlAddress="onlineDev/flowEngine" --parentId="-1" --icon="icon-ym icon-ym-btn-add"
清理:
dacli menu delete --enCode=tcbflowdesign
workflow module 测的是 **运行时** (workFlow/flowTodo 我的待办) — 验证 任务列表/审批 modal 渲染.
workSystem/developSystem/testspace baseline 默认含 workFlow.flowTodo 前端菜单, 不需额外 setup.
需要 ≥1 条待办任务 (admin 自己发起一次即可); 空列表时仍能跑 UI 检查 1-4.
`)
.option('--appCode <app>', '应用 code (默认 workSystem, testspace 也可)', 'workSystem')
.option('--baseUrl <url>', '后端 base URL', 'http://nginx')