测试A04注册页自适应结构
This commit is contained in:
@@ -28,8 +28,8 @@ $sliderPendingCopy = ConvertFrom-Utf8Base64 '5ruR5Yqo6aqM6K+B5b6F5o6l5Y+j5o6l5YW
|
||||
if (-not ($pages.pages.path -contains 'pages/auth/a04-register')) { throw 'A-04 route must remain declared in pages.json' }
|
||||
Assert-NotContains -Content $register -Unexpected 'ModulePage' -Message 'A-04 must not remain a ModulePage shell'
|
||||
foreach ($required in @(
|
||||
'a01-red-hall-ink-backdrop-v1.png',
|
||||
'brand-seal.png',
|
||||
'<AuthPageShell',
|
||||
'import AuthPageShell from "@/components/AuthPageShell.vue";',
|
||||
'a01-vnext-divider-v1.png',
|
||||
'a01-scroll-primary-v3.png',
|
||||
'a01-scroll-toast-v3.png',
|
||||
@@ -58,7 +58,9 @@ Assert-Contains -Content $register -Expected $registerCopy -Message 'A-04 must v
|
||||
Assert-Contains -Content $register -Expected $loginCopy -Message 'A-04 must provide a login return path'
|
||||
Assert-NotContains -Content $catalog -Unexpected 'a04:' -Message 'A-04 must not remain in the temporary page catalog'
|
||||
Assert-NotContains -Content $register -Unexpected 'register-intro' -Message 'A-04 must not retain the redundant registration intro copy'
|
||||
Assert-NotContains -Content $register -Unexpected 'auth-design-scenery-v1.png' -Message 'A-04 must use the shared red-hall ink backdrop instead of the rejected scenery layer'
|
||||
foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx', 'a01-red-hall-ink-backdrop-v1.png')) {
|
||||
Assert-NotContains -Content $register -Unexpected $forbidden -Message "A04 retains rejected page coordinates: $forbidden"
|
||||
}
|
||||
Assert-Contains -Content $globalStyles -Expected 'font-family: "STKaiti", "KaiTi", serif' -Message 'Global styles must own the A04 font contract.'
|
||||
Assert-NotContains -Content $register -Unexpected 'font-family:' -Message 'A04 must inherit the global font contract instead of overriding it locally.'
|
||||
foreach ($obsoleteVisual in @(
|
||||
@@ -77,13 +79,18 @@ foreach ($nativeUi in @('uni.showToast', 'uni.showModal', 'uni.showLoading', 'un
|
||||
foreach ($required in @(
|
||||
'register-divider',
|
||||
'mode="aspectFit"',
|
||||
'width: 184rpx;',
|
||||
'height: 221rpx;',
|
||||
'border-image-slice: 58 280 fill;'
|
||||
'border-image-slice: 58 280 fill;',
|
||||
'top: calc(var(--status-bar-height, 0px) + 24rpx);'
|
||||
)) {
|
||||
Assert-Contains -Content $register -Expected $required -Message "Missing A-04 visual balance contract: $required"
|
||||
}
|
||||
|
||||
$contentRule = [regex]::Match($register, '(?ms)^\.register-content\s*\{(?<Body>.*?)^\}')
|
||||
if (-not $contentRule.Success) { throw 'A04 register content rule is missing.' }
|
||||
foreach ($required in @('display: flex;', 'flex: 1;', 'flex-direction: column;', 'max-width: 480px;', 'margin: 0 auto;')) {
|
||||
Assert-Contains -Content $contentRule.Groups['Body'].Value -Expected $required -Message "A04 register content must use document flow: $required"
|
||||
}
|
||||
|
||||
foreach ($forbidden in @(
|
||||
'(?s)\.register-panel\s*\{[^}]*\bborder\s*:',
|
||||
'(?s)\.register-panel\s*\{[^}]*\bbackground\s*:',
|
||||
|
||||
@@ -68,16 +68,39 @@ const run = async () => {
|
||||
await valueOf(send, "document.querySelector('.register-link').click()")
|
||||
await waitFor(send, "location.href.includes('/pages/auth/a04-register')", 'A01 registration entry did not open A04')
|
||||
|
||||
for (const size of [{ width: 320, height: 568 }, { width: 360, height: 640 }, { width: 360, height: 800 }, { width: 412, height: 915 }]) {
|
||||
for (const size of [
|
||||
{ width: 320, height: 568 },
|
||||
{ width: 360, height: 616 },
|
||||
{ width: 360, height: 640 },
|
||||
{ width: 360, height: 800 },
|
||||
{ width: 412, height: 915 },
|
||||
{ width: 480, height: 1040 }
|
||||
]) {
|
||||
await send('Emulation.setDeviceMetricsOverride', { ...size, deviceScaleFactor: 1, mobile: true })
|
||||
await navigate(send, a04Url, '.register-submit')
|
||||
const metrics = await valueOf(send, `({
|
||||
width: document.documentElement.scrollWidth,
|
||||
pageClientHeight: document.querySelector('.auth-page').clientHeight,
|
||||
pageScrollHeight: document.querySelector('.auth-page').scrollHeight
|
||||
})`)
|
||||
await waitFor(send, "document.querySelector('.auth-shell__header-image img')?.naturalWidth === 824", `A04 header did not load at ${size.width}x${size.height}`)
|
||||
const metrics = await valueOf(send, `(() => {
|
||||
const header = document.querySelector('.auth-shell__header')
|
||||
const headerImage = document.querySelector('.auth-shell__header-image img')
|
||||
const paper = document.querySelector('.auth-shell__paper')
|
||||
const loginEntry = document.querySelector('.login-entry')
|
||||
return {
|
||||
width: document.documentElement.scrollWidth,
|
||||
documentScrollHeight: Math.max(document.documentElement.scrollHeight, document.body.scrollHeight),
|
||||
headerBottom: header?.getBoundingClientRect().bottom,
|
||||
headerImageWidth: headerImage?.getBoundingClientRect().width,
|
||||
headerImageHeight: headerImage?.getBoundingClientRect().height,
|
||||
headerNaturalWidth: headerImage?.naturalWidth,
|
||||
headerNaturalHeight: headerImage?.naturalHeight,
|
||||
paperTop: paper?.getBoundingClientRect().top,
|
||||
loginEntryBottom: loginEntry?.getBoundingClientRect().bottom + window.scrollY
|
||||
}
|
||||
})()`)
|
||||
assert(metrics.width <= size.width + 1, `A04 has horizontal overflow at ${size.width}x${size.height}`)
|
||||
if (size.width === 320) assert(metrics.pageScrollHeight > metrics.pageClientHeight, 'A04 must scroll naturally at 320x568')
|
||||
assert.deepStrictEqual([metrics.headerNaturalWidth, metrics.headerNaturalHeight], [824, 340], `A04 header asset changed at ${size.width}x${size.height}`)
|
||||
assert(Math.abs(metrics.headerImageHeight / metrics.headerImageWidth - 340 / 824) < 0.01, `A04 header is distorted at ${size.width}x${size.height}`)
|
||||
assert(metrics.paperTop >= metrics.headerBottom - 1, `A04 paper overlaps its header at ${size.width}x${size.height}`)
|
||||
assert(metrics.loginEntryBottom <= metrics.documentScrollHeight + 1, `A04 last action is unreachable at ${size.width}x${size.height}`)
|
||||
}
|
||||
|
||||
await valueOf(send, "document.querySelector('.register-submit').click()")
|
||||
|
||||
Reference in New Issue
Block a user