test(web): cover desktop login columns
This commit is contained in:
@@ -33,6 +33,10 @@ const collectLoginMetrics = async () => page.evaluate(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getColumnCount = (columns) => columns === 'none'
|
||||||
|
? 0
|
||||||
|
: columns.split(' ').filter(Boolean).length
|
||||||
|
|
||||||
const collectMetrics = async () => page.evaluate(() => {
|
const collectMetrics = async () => page.evaluate(() => {
|
||||||
const statusbar = document.querySelector('.statusbar')
|
const statusbar = document.querySelector('.statusbar')
|
||||||
const statusName = document.querySelector('.status-name')
|
const statusName = document.querySelector('.status-name')
|
||||||
@@ -118,15 +122,15 @@ const collectMetrics = async () => page.evaluate(() => {
|
|||||||
await page.goto(`http://127.0.0.1:${port}/`, { waitUntil: 'networkidle' })
|
await page.goto(`http://127.0.0.1:${port}/`, { waitUntil: 'networkidle' })
|
||||||
await page.screenshot({ path: 'test-results/login-react-acro.png', fullPage: true })
|
await page.screenshot({ path: 'test-results/login-react-acro.png', fullPage: true })
|
||||||
const desktopLoginMetrics = await collectLoginMetrics()
|
const desktopLoginMetrics = await collectLoginMetrics()
|
||||||
|
const desktopColumnCount = getColumnCount(desktopLoginMetrics.columns)
|
||||||
if (desktopLoginMetrics.overflowX) failures.push('login must not overflow horizontally')
|
if (desktopLoginMetrics.overflowX) failures.push('login must not overflow horizontally')
|
||||||
if (desktopLoginMetrics.title !== '森林AI') failures.push(`unexpected title ${desktopLoginMetrics.title}`)
|
if (desktopLoginMetrics.title !== '森林AI') failures.push(`unexpected title ${desktopLoginMetrics.title}`)
|
||||||
|
if (desktopColumnCount !== 2) failures.push(`desktop login must use two columns, got ${desktopLoginMetrics.columns}`)
|
||||||
|
|
||||||
await page.setViewportSize({ width: 390, height: 844 })
|
await page.setViewportSize({ width: 390, height: 844 })
|
||||||
await page.screenshot({ path: 'test-results/login-react-acro-mobile.png', fullPage: true })
|
await page.screenshot({ path: 'test-results/login-react-acro-mobile.png', fullPage: true })
|
||||||
const mobileLoginMetrics = await collectLoginMetrics()
|
const mobileLoginMetrics = await collectLoginMetrics()
|
||||||
const mobileColumnCount = mobileLoginMetrics.columns === 'none'
|
const mobileColumnCount = getColumnCount(mobileLoginMetrics.columns)
|
||||||
? 0
|
|
||||||
: mobileLoginMetrics.columns.split(' ').filter(Boolean).length
|
|
||||||
if (mobileLoginMetrics.overflowX) failures.push('mobile login must not overflow horizontally')
|
if (mobileLoginMetrics.overflowX) failures.push('mobile login must not overflow horizontally')
|
||||||
if (mobileLoginMetrics.width > 390) failures.push(`mobile login card must fit viewport, got ${mobileLoginMetrics.width}`)
|
if (mobileLoginMetrics.width > 390) failures.push(`mobile login card must fit viewport, got ${mobileLoginMetrics.width}`)
|
||||||
if (mobileColumnCount !== 1) failures.push(`mobile login must use one column, got ${mobileLoginMetrics.columns}`)
|
if (mobileColumnCount !== 1) failures.push(`mobile login must use one column, got ${mobileLoginMetrics.columns}`)
|
||||||
|
|||||||
@@ -126,6 +126,16 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-footer-links {
|
||||||
|
align-self: end;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-footer-links .arco-typography {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.login-form-panel {
|
.login-form-panel {
|
||||||
display: grid;
|
display: grid;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ export function LoginPage({ onLogin }: { onLogin: (input: { server: string; emai
|
|||||||
</div>
|
</div>
|
||||||
<Text className="login-slogan">私有部署 · 安全可控的智能协作平台</Text>
|
<Text className="login-slogan">私有部署 · 安全可控的智能协作平台</Text>
|
||||||
<Text type="secondary">知识沉淀 · 团队协作 · AI 助手</Text>
|
<Text type="secondary">知识沉淀 · 团队协作 · AI 助手</Text>
|
||||||
|
<Space className="login-footer-links" size={24}>
|
||||||
|
<Text type="secondary">v1.0.0</Text>
|
||||||
|
<Text type="secondary">隐私政策</Text>
|
||||||
|
<Text type="secondary">服务协议</Text>
|
||||||
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="login-form-panel">
|
<div className="login-form-panel">
|
||||||
|
|||||||
Reference in New Issue
Block a user