Files
YG_FT/frontend/scripts/regression-login-layout.mjs
2026-07-21 16:14:32 +08:00

27 lines
1.6 KiB
JavaScript

import { existsSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const root = resolve(fileURLToPath(new URL('..', import.meta.url)))
const loginPath = resolve(root, 'src/views/login/LoginView.vue')
const heroAssetPath = resolve(root, 'src/assets/login-hero-flow.jpg')
const login = readFileSync(loginPath, 'utf8')
function assert(condition, message) {
if (!condition) throw new Error(message)
}
assert(login.includes('class="login-visual"'), '登录页缺少左侧品牌视觉区域')
assert(login.includes('class="login-panel"'), '登录页缺少右侧登录区域')
assert(login.includes('远光软件微调平台'), '登录页缺少平台标题')
assert(login.includes('大模型微调、评测与推理的一体化工作台'), '登录页缺少平台定位文案')
assert(login.includes('login-hero-flow.jpg'), '登录页未使用压缩后的流线主视觉资源')
assert(login.includes('@media (max-width: 1440px)'), '登录页缺少笔记本宽度适配规则')
assert(login.includes('@media (max-height: 820px) and (min-width: 901px)'), '登录页缺少笔记本短屏适配规则')
assert(login.includes('@media (max-width: 900px)'), '登录页缺少窄屏响应式规则')
assert(/\.login-page\s*\{[^}]*height:\s*100dvh;[^}]*overflow:\s*hidden;/.test(login), '桌面端登录页不应产生页面滚动')
assert(/@media \(max-width: 900px\)[\s\S]*?\.login-page\s*\{[^}]*height:\s*auto;[^}]*overflow:\s*auto;/.test(login), '窄屏登录页应保留内容滚动能力')
assert(existsSync(heroAssetPath), '登录页流线主视觉资源不存在')
console.log('login-layout regression checks passed')