完成50%

This commit is contained in:
2026-07-23 08:23:59 +08:00
parent 9b0ad62df4
commit f1edc6b533
218 changed files with 24318 additions and 5514 deletions
+39 -16
View File
@@ -79,6 +79,33 @@ const openDefaultG03 = async (send) => {
await waitFor(send, "Boolean(document.querySelector('.create-flow-panel .flow-rule'))", 'Default G03 creation step did not render')
}
const advanceToAncestor = async (send, name = '自动验证汤氏家谱') => {
await setInput(send, 0, '汤')
await setInput(send, 1, name)
await setInput(send, 2, '敦本堂')
await setInput(send, 3, '河南·洛阳')
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await waitFor(send, "Boolean(document.querySelector('.duplicate-reminder-layer'))", 'G03 did not show the duplicate reminder')
await valueOf(send, `(() => {
window.__g03SubmitTimerCount = 0
window.__g03OriginalSetTimeout = window.setTimeout
window.setTimeout = (callback, delay, ...args) => {
if (delay === 320) window.__g03SubmitTimerCount += 1
return window.__g03OriginalSetTimeout(callback, delay, ...args)
}
return true
})()`)
await valueOf(send, "(() => { const action = document.querySelector('.duplicate-reminder__confirm'); action.click(); action.click(); return true })()")
await setInput(send, 1, '失败')
await waitFor(send, "Boolean(document.querySelector('.intro-field'))", 'G03 did not advance to the same-page ancestor step')
const timerCount = await valueOf(send, 'window.__g03SubmitTimerCount')
await valueOf(send, 'window.setTimeout = window.__g03OriginalSetTimeout; delete window.__g03OriginalSetTimeout')
if (timerCount !== 1) throw new Error(`G03 duplicate confirmation created ${timerCount} submit timers`)
if (await valueOf(send, "location.hash.includes('step=ancestor')")) {
throw new Error('G03 leaked its internal ancestor step into the route')
}
}
const run = async () => {
const { socket, send, exceptions } = await connect()
@@ -99,36 +126,32 @@ const run = async () => {
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 openDefaultG03(send)
await advanceToAncestor(send, '首代失败验证家谱')
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 setInput(send, 0, '提交后改名')
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, '自动验证汤氏家谱')
await setInput(send, 3, '河南·洛阳')
await sleep(100)
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await waitFor(send, "Boolean(document.querySelector('.duplicate-reminder-layer'))", 'G03 did not show the existing-genealogy reminder before creation')
await valueOf(send, "document.querySelector('.duplicate-reminder__confirm').click()")
await waitFor(send, "location.href.includes('g03-create-genealogy?step=ancestor&genealogyId=')", 'Creating a genealogy did not open G03 ancestor step')
await waitFor(send, "Boolean(document.querySelector('.intro-field'))", 'G03 ancestor step did not render')
await send('Page.reload')
await waitFor(send, "Boolean(document.querySelector('.intro-field'))", 'G03 ancestor step did not survive reload')
await advanceToAncestor(send)
await setInput(send, 0, '汤始祖')
await sleep(100)
await valueOf(send, "document.querySelector('.flow-primary-action')?.click()")
await setInput(send, 0, '失败')
await waitFor(send, "Boolean(document.querySelector('.flow-success-layer'))", 'Saving the first ancestor did not show the custom success result')
await valueOf(send, "document.querySelector('.flow-success-dialog__action').click()")
await waitFor(send, "location.href.includes('/pages/genealogy/g05-genealogy-overview?genealogyId=')", 'Saving the first ancestor did not open G05')
await waitFor(send, "location.href.includes('/pages/genealogy/g05-genealogy-overview?genealogyId=local-created-')", 'Saving the first ancestor did not open a unique local G05 preview')
await waitFor(send, "Boolean(document.querySelector('.overview-public'))", 'G03 local preview did not render in G05')
const previewText = await valueOf(send, "document.querySelector('.overview-public')?.textContent")
for (const expected of ['自动验证汤氏家谱', '汤氏', '敦本堂', '河南·洛阳', '汤始祖', '仅成员可见']) {
if (!previewText.includes(expected)) throw new Error(`G03 local preview lost submitted field: ${expected}`)
}
await openDefaultG03(send)
if (await valueOf(send, "Boolean(document.querySelector('.intro-field'))")) {