修改完成55%

This commit is contained in:
2026-07-15 08:31:21 +08:00
parent 8c98936da5
commit 241a7af54c
98 changed files with 3269 additions and 782 deletions
+10 -7
View File
@@ -2,7 +2,7 @@ const sleep = (milliseconds) => new Promise((resolve) => setTimeout(resolve, mil
const connect = async () => {
const pages = await (await fetch('http://127.0.0.1:9222/json/list')).json()
const page = pages.find((item) => item.type === 'page' && item.url.includes('localhost:5173'))
const page = pages.find((item) => item.type === 'page' && item.url.startsWith(origin))
if (!page) throw new Error('Chrome debugging has no localhost:5173 page')
const socket = new WebSocket(page.webSocketDebuggerUrl)
@@ -50,14 +50,17 @@ const waitFor = async (send, expression, message) => {
const origin = process.argv[2] || 'http://localhost:5173'
const g01Path = '/pages/genealogy/g01-my-genealogies'
const emptyUrl = `${origin}/#${g01Path}?state=empty`
const defaultUrl = `${origin}/#${g01Path}`
let auditId = 0
const nextUrl = (query = '') => {
auditId += 1
return `${origin}/?g01Audit=${auditId}#${g01Path}${query}`
}
const openEmptyG01 = async (send) => {
const emptyUrl = nextUrl('?state=empty')
await send('Page.navigate', { url: emptyUrl })
await waitFor(send, "location.href.includes('g01-my-genealogies?state=empty')", 'Did not navigate to G01 empty state')
await send('Page.reload')
await waitFor(send, "Boolean(document.querySelector('.genealogy-empty-state .empty-create-action'))", 'G01 empty state did not render after reload')
await waitFor(send, "Boolean(document.querySelector('.genealogy-empty-state .empty-create-action'))", 'G01 empty state did not render')
}
const run = async () => {
@@ -75,10 +78,10 @@ const run = async () => {
await valueOf(send, "document.querySelector('.empty-search-action')?.click()")
await waitFor(send, "location.href.includes('/pages/genealogy/g06-search-genealogies')", 'G01 empty search action did not open G06')
const defaultUrl = nextUrl()
await send('Page.navigate', { url: defaultUrl })
await waitFor(send, "location.href.endsWith('/pages/genealogy/g01-my-genealogies')", 'Did not navigate to default G01')
await send('Page.reload')
await waitFor(send, "Boolean(document.querySelector('.current-slip'))", 'Default G01 list did not render after reload')
await waitFor(send, "Boolean(document.querySelector('.current-slip'))", 'Default G01 list did not render')
if (await valueOf(send, "Boolean(document.querySelector('.genealogy-empty-state'))")) {
throw new Error('Default G01 must not render the empty state')
}