验收完成40%
This commit is contained in:
@@ -98,7 +98,7 @@ const run = async () => {
|
||||
|
||||
await valueOf(send, "document.querySelector('.create-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.add-dialog-layer'))", 'G01 add action did not open the custom add dialog')
|
||||
if ((await valueOf(send, "document.querySelectorAll('.add-dialog .dialog-primary, .add-dialog .dialog-secondary, .add-dialog .dialog-create').length")) !== 3) {
|
||||
if ((await valueOf(send, "document.querySelectorAll('.add-dialog .app-button').length")) !== 3) {
|
||||
throw new Error('G01 add dialog must keep search, invite, and create visible together')
|
||||
}
|
||||
await valueOf(send, "document.querySelector('.dialog-close').click()")
|
||||
@@ -115,15 +115,96 @@ const run = async () => {
|
||||
await waitFor(send, `Boolean(document.querySelector('.state-panel--${state}'))`, `G01 did not render ${state}`)
|
||||
}
|
||||
|
||||
for (const size of [{ width: 320, height: 568 }, { width: 360, height: 800 }, { width: 412, height: 915 }]) {
|
||||
for (const size of [{ width: 320, height: 568 }, { width: 360, height: 640 }, { width: 360, height: 800 }, { width: 412, height: 915 }, { width: 412, height: 1000 }]) {
|
||||
await send('Emulation.setDeviceMetricsOverride', { ...size, deviceScaleFactor: 1, mobile: true })
|
||||
const responsiveUrl = nextUrl()
|
||||
await send('Page.navigate', { url: responsiveUrl })
|
||||
await waitFor(send, "Boolean(document.querySelector('.current-slip'))", `G01 did not render at ${size.width}x${size.height}`)
|
||||
const width = await valueOf(send, 'document.documentElement.scrollWidth')
|
||||
if (width > size.width + 1) throw new Error(`G01 has horizontal overflow at ${size.width}x${size.height}`)
|
||||
|
||||
const before = await valueOf(send, `(() => {
|
||||
const host = document.querySelector('.genealogy-list-scroll')
|
||||
if (!host) return null
|
||||
const scrollNodes = host.querySelectorAll('.uni-scroll-view')
|
||||
const scroller = scrollNodes[scrollNodes.length - 1] || host.shadowRoot?.querySelector('.uni-scroll-view') || host
|
||||
const fixedSelectors = ['.page-header', '.current-slip', '.shortcut-grid', '.section-divider', '.app-tabbar']
|
||||
return {
|
||||
fixed: Object.fromEntries(fixedSelectors.map((selector) => [selector, document.querySelector(selector)?.getBoundingClientRect().top])),
|
||||
lowerTop: document.querySelector('.section-heading')?.getBoundingClientRect().top,
|
||||
clientHeight: scroller.clientHeight,
|
||||
scrollHeight: scroller.scrollHeight
|
||||
}
|
||||
})()`)
|
||||
if (!before) throw new Error(`G01 has no independent list scroller at ${size.width}x${size.height}`)
|
||||
if (before.clientHeight <= 0 || before.scrollHeight <= before.clientHeight) {
|
||||
throw new Error(`G01 independent list scroller has no usable range at ${size.width}x${size.height}: ${JSON.stringify(before)}`)
|
||||
}
|
||||
|
||||
await valueOf(send, `(() => {
|
||||
const host = document.querySelector('.genealogy-list-scroll')
|
||||
const scrollNodes = host.querySelectorAll('.uni-scroll-view')
|
||||
const scroller = scrollNodes[scrollNodes.length - 1] || host.shadowRoot?.querySelector('.uni-scroll-view') || host
|
||||
scroller.scrollTop = Math.min(180, scroller.scrollHeight - scroller.clientHeight)
|
||||
scroller.dispatchEvent(new Event('scroll', { bubbles: true }))
|
||||
})()`)
|
||||
await sleep(100)
|
||||
|
||||
const after = await valueOf(send, `(() => {
|
||||
const fixedSelectors = ['.page-header', '.current-slip', '.shortcut-grid', '.section-divider', '.app-tabbar']
|
||||
return {
|
||||
fixed: Object.fromEntries(fixedSelectors.map((selector) => [selector, document.querySelector(selector)?.getBoundingClientRect().top])),
|
||||
lowerTop: document.querySelector('.section-heading')?.getBoundingClientRect().top
|
||||
}
|
||||
})()`)
|
||||
for (const selector of Object.keys(before.fixed)) {
|
||||
if (Math.abs(after.fixed[selector] - before.fixed[selector]) > 1) {
|
||||
throw new Error(`G01 fixed selector moved while list scrolled at ${size.width}x${size.height}: ${selector}`)
|
||||
}
|
||||
}
|
||||
if (!(after.lowerTop < before.lowerTop - 2)) {
|
||||
throw new Error(`G01 lower list did not move independently at ${size.width}x${size.height}`)
|
||||
}
|
||||
}
|
||||
|
||||
const readListScrollTop = `(() => {
|
||||
const host = document.querySelector('.genealogy-list-scroll')
|
||||
const scrollNodes = host.querySelectorAll('.uni-scroll-view')
|
||||
const scroller = scrollNodes[scrollNodes.length - 1] || host.shadowRoot?.querySelector('.uni-scroll-view') || host
|
||||
return scroller.scrollTop
|
||||
})()`
|
||||
await valueOf(send, `(() => {
|
||||
const host = document.querySelector('.genealogy-list-scroll')
|
||||
const scrollNodes = host.querySelectorAll('.uni-scroll-view')
|
||||
const scroller = scrollNodes[scrollNodes.length - 1] || host.shadowRoot?.querySelector('.uni-scroll-view') || host
|
||||
scroller.scrollTop = scroller.scrollHeight
|
||||
})()`)
|
||||
await sleep(100)
|
||||
const endGeometry = await valueOf(send, `(() => {
|
||||
const action = document.querySelector('.create-action').getBoundingClientRect()
|
||||
const tabbar = document.querySelector('.app-tabbar').getBoundingClientRect()
|
||||
return { actionTop: action.top, actionBottom: action.bottom, tabbarTop: tabbar.top }
|
||||
})()`)
|
||||
if (endGeometry.actionTop >= endGeometry.tabbarTop || endGeometry.actionBottom > endGeometry.tabbarTop + 1) {
|
||||
throw new Error(`G01 add action is not fully reachable above the fixed tabbar: ${JSON.stringify(endGeometry)}`)
|
||||
}
|
||||
const scrollTopBeforeDialog = await valueOf(send, readListScrollTop)
|
||||
if (scrollTopBeforeDialog <= 0) throw new Error('G01 list must be scrolled before testing position preservation')
|
||||
await valueOf(send, "document.querySelector('.create-action').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.add-dialog-layer'))", 'G01 add dialog did not open over the independent list')
|
||||
await valueOf(send, "document.querySelector('.dialog-close').click()")
|
||||
await waitFor(send, "!document.querySelector('.add-dialog-layer')", 'G01 add dialog did not close over the independent list')
|
||||
const scrollTopAfterDialog = await valueOf(send, readListScrollTop)
|
||||
if (Math.abs(scrollTopAfterDialog - scrollTopBeforeDialog) > 1) {
|
||||
throw new Error('G01 add dialog changed the independent list position')
|
||||
}
|
||||
|
||||
await valueOf(send, "document.querySelector('.current-slip').click()")
|
||||
await waitFor(send, "Boolean(document.querySelector('.genealogy-switcher-layer'))", 'G01 switcher did not open over the independent list')
|
||||
await valueOf(send, "document.querySelectorAll('.switcher-item')[1].click()")
|
||||
await waitFor(send, "document.querySelector('.current-name')?.textContent.includes('汤氏宗谱')", 'G01 switcher did not change the current genealogy after scrolling')
|
||||
await waitFor(send, `${readListScrollTop} <= 1`, 'G01 independent list did not return to the top after switching genealogy')
|
||||
|
||||
if (exceptions.length) throw new Error(`G01 raised browser exceptions: ${exceptions.join('; ')}`)
|
||||
|
||||
process.stdout.write('G01-EMPTY-STATE-RUNTIME-SMOKE PASS\n')
|
||||
|
||||
Reference in New Issue
Block a user