Files
jiapuapp/tests/g10-all-states-visual-contract.ps1
T
2026-07-21 20:59:10 +08:00

49 lines
2.2 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$page = Get-Content -LiteralPath (Join-Path $root 'pages/genealogy/g10-application-review.vue') -Raw -Encoding utf8
foreach ($required in @(
'class="review-result"',
'review-result--approved',
'review-result--rejected',
'<AppButton',
'compact',
'type="secondary"',
'<AppDialog',
'compact-actions',
'class="review-page__retry"',
'a01-scroll-secondary-v3.png',
'a01-scroll-primary-v3.png'
)) {
if ($page -notmatch [regex]::Escape($required)) { throw "G10 result visual missing: $required" }
}
$rules = @(
'(?s)\.review-intro text:nth-child\(2\)\s*\{[^}]*font-size:\s*24rpx;',
'(?s)\.application-card__phone\s*\{[^}]*font-size:\s*23rpx;',
'(?s)\.application-card__time\s*\{[^}]*font-size:\s*23rpx;',
'(?s)\.application-card__relation\s*\{[^}]*font-size:\s*24rpx;',
'(?s)\.application-card\s*\{[^}]*@include\s+adaptive\.adaptive-genealogy-list-card;[^}]*min-height:\s*218rpx;[^}]*margin-bottom:\s*12rpx;',
'(?s)\.application-card__body\s*\{[^}]*min-height:\s*182rpx;[^}]*gap:\s*8rpx 0;[^}]*padding:\s*28rpx 28rpx 22rpx 40rpx;',
'(?s)\.review-actions \.app-button\s*\{[^}]*width:\s*148rpx;[^}]*min-height:\s*68rpx;',
'(?s)\.review-result\s*\{[^}]*@include\s+adaptive\.adaptive-scroll-button\(primary\);[^}]*width:\s*308rpx;[^}]*min-height:\s*68rpx;',
'(?s)\.review-state-card\s*\{[^}]*@include\s+adaptive\.adaptive-genealogy-list-card;',
'(?s)\.review-state-card__copy text:last-child\s*\{[^}]*font-size:\s*24rpx;'
)
if ($page -match 'a01-(?:primary|secondary)-button-v2\.png') {
throw 'G10 must not render the ultra-wide v2 assets through aspectFit inside narrow action buttons'
}
if ($page -match '(?s)class="review-page__retry"[^>]*>\s*<image') {
throw 'G10 retry action must use AppButton instead of detached image and text nodes'
}
foreach ($selector in @('application-card', 'review-state-card')) {
if ($page -match "(?s)\.$selector\s*\{[^}]*background:[^}]*list-slip-frame\.png[^}]*100%\s+100%") {
throw "G10 .$selector must not stretch the complete frame asset to 100% 100%"
}
}
foreach ($rule in $rules) {
if ($page -notmatch $rule) { throw "G10 readable visual rule missing: $rule" }
}
Write-Output 'G10-ALL-STATES-VISUAL-CONTRACT PASS'