接口开始5%
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const origin = 'http://localhost:5173'
|
||||
const outputDirectory = path.resolve('docs/design/screens/runtime/2026-07-19/t07-baseline')
|
||||
const sizes = [
|
||||
{ width: 320, height: 568 },
|
||||
{ width: 360, height: 640 },
|
||||
@@ -72,12 +68,6 @@ const openState = async (send, query = '') => {
|
||||
await sleep(250)
|
||||
}
|
||||
|
||||
const capture = async (send, filename) => {
|
||||
const screenshot = await send('Page.captureScreenshot', { format: 'png', fromSurface: true, captureBeyondViewport: false })
|
||||
fs.mkdirSync(outputDirectory, { recursive: true })
|
||||
fs.writeFileSync(path.join(outputDirectory, filename), Buffer.from(screenshot.data, 'base64'))
|
||||
}
|
||||
|
||||
const metrics = (send) => valueOf(send, `(() => {
|
||||
const rect = (selector) => {
|
||||
const node = document.querySelector(selector)
|
||||
@@ -128,22 +118,18 @@ const run = async () => {
|
||||
assert(lastBottom <= size.height + 1, `${size.width}x${size.height}: last member is not reachable`)
|
||||
await valueOf(send, 'scrollTo(0, 0)')
|
||||
responsive.push(current)
|
||||
await capture(send, `responsive-${size.width}x${size.height}.png`)
|
||||
}
|
||||
|
||||
await setSize(send, { width: 412, height: 915 })
|
||||
await openState(send, '?state=loading&genealogyId=1001')
|
||||
assert((await metrics(send)).state === 'loading', 'Loading state did not render')
|
||||
await capture(send, '02-loading-412x915.png')
|
||||
|
||||
await openState(send, '?state=empty&genealogyId=1001')
|
||||
assert((await metrics(send)).state === 'empty', 'Empty state did not render')
|
||||
await capture(send, '03-empty-412x915.png')
|
||||
|
||||
await openState(send, '?state=error&genealogyId=1001')
|
||||
assert((await metrics(send)).state === 'error', 'Error state did not render')
|
||||
assert(!await valueOf(send, "Boolean(document.querySelector('.directory-search'))"), 'Error state must not expose search')
|
||||
await capture(send, '04-error-412x915.png')
|
||||
await valueOf(send, "document.querySelector('.directory-content .app-button').click()")
|
||||
await waitFor(send, "document.querySelectorAll('.directory-card').length === 3 && Boolean(document.querySelector('.directory-search'))", 'Error retry did not restore the list')
|
||||
|
||||
@@ -163,7 +149,6 @@ const run = async () => {
|
||||
await waitFor(send, "document.querySelectorAll('.directory-card').length === 3", 'Cleared search did not restore all members')
|
||||
|
||||
await openState(send, '?genealogyId=1001')
|
||||
await capture(send, '01-list-412x915.png')
|
||||
const final = await metrics(send)
|
||||
assert(final.viewport.width === 412 && final.viewport.height === 915 && final.state === 'list', 'Final approval state is invalid')
|
||||
assert(runtimeErrors.length === 0, `Runtime errors: ${runtimeErrors.join(' | ')}`)
|
||||
|
||||
Reference in New Issue
Block a user