完成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
+51 -3
View File
@@ -49,15 +49,63 @@ const run = async () => {
try {
await send('Page.enable')
await send('Runtime.enable')
await open(send, '/pages/tree/t03-member-profile', '?genealogyId=1001&personId=missing', '.member-state--error')
await waitFor(
send,
'Boolean(document.querySelector(\'[data-trail-length="0"][data-trail-index="-1"]\'))',
'T03 failed initial read must leave an empty trail',
)
await open(send, '/pages/tree/t03-member-profile', '?genealogyId=1001&personId=101', '.member-state--detail')
await open(send, '/pages/tree/t04-add-relative', '?genealogyId=1001&personId=101', '.add-state--form')
await open(send, '/pages/tree/t05-edit-member', '?state=success&genealogyId=1001&personId=101', '.edit-state--success')
await open(send, '/pages/tree/t06-edit-relationship', '?state=conflict&genealogyId=1001&personId=101', '.relationship-state--conflict')
const t03Address = await valueOf(send, 'location.href')
await valueOf(send, 'document.querySelector(\'[data-person-id="102"]\').click()')
await waitFor(send, 'Boolean(document.querySelector(\'.member-state--restricted[data-current-person-id="102"][data-trail-length="2"][data-trail-index="1"]\'))', 'T03 did not advance A to restricted B in-page')
if (await valueOf(send, `location.href !== ${JSON.stringify(t03Address)}`)) throw new Error('T03 A to B created a native route')
if (await valueOf(send, 'Boolean(document.querySelector(".member-info-row,.member-relatives,.member-record-actions,.member-profile-action"))')) throw new Error('T03 restricted member leaked details or actions')
await valueOf(send, 'document.querySelector(".header-back").click()')
await waitFor(send, 'Boolean(document.querySelector(\'[data-current-person-id="101"][data-trail-index="0"]\'))', 'T03 back did not restore A')
if (await valueOf(send, `location.href !== ${JSON.stringify(t03Address)}`)) throw new Error('T03 B to A left the native page')
await valueOf(send, 'document.querySelector(".header-back").click()')
await waitFor(send, 'location.hash.includes("/pages/tree/t01-tree-overview?genealogyId=1001&selectedId=101")', 'T03 final back did not leave for its canonical parent')
for (const [personId, name] of [['101', '汤文远'], ['102', '汤正国'], ['103', '汤正华'], ['104', '汤凯'], ['105', '汤悦'], ['106', '汤晨']]) {
const expectedState = personId === '101' ? '.member-state--detail' : '.member-state--restricted'
await open(send, '/pages/tree/t03-member-profile', `?genealogyId=1001&personId=${personId}`, expectedState)
if (!(await valueOf(send, `document.body.innerText.includes(${JSON.stringify(name)})`))) throw new Error(`T03 member ${personId} did not use the shared fixture`)
}
await open(send, '/pages/tree/t03-member-profile', '?genealogyId=1002&personId=101', '.member-state--error')
await open(send, '/pages/tree/t04-add-relative', '?genealogyId=1001&personId=106', '.add-state--form')
await open(send, '/pages/tree/t04-add-relative', '?genealogyId=1001', '.add-state--error')
await valueOf(send, 'document.querySelector(".add-result .form-action").click()')
await waitFor(send, 'location.hash.includes("/pages/tree/t01-tree-overview?genealogyId=1001")', 'T04 invalid context did not recover to T01')
await open(send, '/pages/tree/t04-add-relative', '?genealogyId=1001&personId=101&mode=first', '.add-state--error')
await open(send, '/pages/tree/t05-edit-member', '?state=preview&genealogyId=1001&personId=101', '.edit-state--preview')
await open(send, '/pages/tree/t05-edit-member', '?genealogyId=1001&personId=missing', '.edit-state--error')
await open(send, '/pages/tree/t05-edit-member', '?genealogyId=1001', '.edit-state--error')
await valueOf(send, 'document.querySelector(".edit-result .form-action").click()')
await waitFor(send, 'location.hash.includes("/pages/tree/t01-tree-overview?genealogyId=1001")', 'T05 missing person did not recover to T01')
await open(send, '/pages/tree/t06-edit-relationship', '?genealogyId=1001&personId=106', '.relationship-state--form')
if (!(await valueOf(send, 'document.body.innerText.includes("汤晨")'))) throw new Error('T06 did not retain routed member 106')
await open(send, '/pages/tree/t06-edit-relationship', '?genealogyId=1001', '.relationship-state--error')
await valueOf(send, 'document.querySelector(".relationship-result > .form-action").click()')
await waitFor(send, 'location.hash.includes("/pages/tree/t01-tree-overview?genealogyId=1001")', 'T06 missing person did not recover to T01')
await open(send, '/pages/tree/t06-edit-relationship', '?genealogyId=1002&personId=101', '.relationship-state--error')
await open(send, '/pages/tree/t07-member-directory', '?genealogyId=1001', '.directory-state--list')
if ((await valueOf(send, 'document.querySelectorAll(".directory-card").length')) !== 6) throw new Error('T07 did not consume all shared members')
await open(send, '/pages/tree/t07-member-directory', '?state=empty&genealogyId=1001', '.directory-state--empty')
await open(send, '/pages/tree/t07-member-directory', '', '.directory-state--error')
await valueOf(send, 'document.querySelector(".directory-content .app-button").click()')
await waitFor(send, 'location.hash.includes("/pages/genealogy/g01-my-genealogies")', 'T07 missing genealogy did not recover to G01')
await open(send, '/pages/tree/t08-member-states', '?state=privacy&genealogyId=1001&personId=102', '.member-status--privacy')
await open(send, '/pages/tree/t08-member-states', '?genealogyId=1001&personId=104', '.member-status--privacy')
await open(send, '/pages/tree/t08-member-states', '?state=deceased&genealogyId=1001&personId=101', '.member-status--deceased')
await open(send, '/pages/tree/t08-member-states', '?state=forbidden&genealogyId=1001&personId=103', '.member-status--forbidden')
await open(send, '/pages/tree/t08-member-states', '?genealogyId=1001', '.member-status--error')
await valueOf(send, 'document.querySelector(".status-action").click()')
await waitFor(send, 'location.hash.includes("/pages/tree/t01-tree-overview?genealogyId=1001")', 'T08 missing person did not recover to T01')
process.stdout.write('T03-T08-MEMBER-FLOW-RUNTIME-SMOKE PASS\n')
} finally { socket.close() }
}