接口开始5%

This commit is contained in:
rain
2026-07-22 17:31:33 +08:00
parent eced3d1e6e
commit 9b0ad62df4
426 changed files with 20111 additions and 28472 deletions
+33 -2
View File
@@ -65,10 +65,17 @@ const setInput = async (send, index, value) => {
const origin = process.argv[2] || 'http://localhost:5173'
const g03Path = '/pages/genealogy/g03-create-genealogy'
const defaultUrl = `${origin}/#${g03Path}`
let navigationId = 0
const openG03 = async (send, query = '') => {
navigationId += 1
const url = `${origin}/?g03Audit=${navigationId}#${g03Path}${query}`
await send('Page.navigate', { url })
await waitFor(send, `location.href === ${JSON.stringify(url)}`, `G03 navigation failed: ${query || 'default'}`)
}
const openDefaultG03 = async (send) => {
await send('Page.navigate', { url: defaultUrl })
await openG03(send)
await waitFor(send, "Boolean(document.querySelector('.create-flow-panel .flow-rule'))", 'Default G03 creation step did not render')
}
@@ -79,6 +86,30 @@ const run = async () => {
await send('Page.enable')
await send('Runtime.enable')
// 步骤一:空表单、创建失败和短暂提交态都由真实控件触发,避免旧截图助手伪装成功能测试。
await openDefaultG03(send)
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await waitFor(send, "document.querySelectorAll('.field-error').length === 3", 'G03 create step did not report all required fields')
await setInput(send, 0, '汤')
await setInput(send, 1, '失败')
await setInput(send, 3, '河南·洛阳')
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await waitFor(send, "Boolean(document.querySelector('.duplicate-reminder-layer'))", 'G03 failure case did not show the duplicate reminder')
await valueOf(send, "document.querySelector('.duplicate-reminder__confirm').click()")
await waitFor(send, "document.querySelector('.flow-primary-action__copy')?.textContent.includes('正在创建')", 'G03 create step did not expose its submitting state')
await waitFor(send, "Boolean(document.querySelector('.flow-error'))", 'G03 simulated create failure did not render')
// 步骤二:首代人物继续覆盖必填校验、提交中与保存失败,且保留同一路由两步流程语义。
await openG03(send, '?step=ancestor&genealogyId=runtime-failure')
await waitFor(send, "Boolean(document.querySelector('.intro-field'))", 'G03 ancestor failure step did not render')
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await waitFor(send, "Boolean(document.querySelector('.field-error'))", 'G03 ancestor step did not validate the required name')
await setInput(send, 0, '失败')
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await waitFor(send, "document.querySelector('.flow-primary-action__copy')?.textContent.includes('正在保存')", 'G03 ancestor step did not expose its submitting state')
await waitFor(send, "Boolean(document.querySelector('.flow-error'))", 'G03 simulated ancestor failure did not render')
// 步骤三:完整成功路径仍需从立谱、重复提醒、首代保存一路进入家谱总览。
await openDefaultG03(send)
await setInput(send, 0, '汤')
await setInput(send, 1, '自动验证汤氏家谱')