Add workspace landing page

This commit is contained in:
2026-07-20 11:40:45 +08:00
parent 9c4ad986c0
commit da76abf2d0
10 changed files with 260 additions and 28 deletions

View File

@@ -34,10 +34,13 @@ const metrics = await page.evaluate(() => {
const statusbar = document.querySelector('.statusbar')
const search = document.querySelector('.global-search')
const main = document.querySelector('.workbench-main')
const workspacePage = document.querySelector('.workspace-page')
const rail = document.querySelector('.project-rail')
const railChildren = rail?.querySelector('.arco-layout-sider-children')
const sidebar = document.querySelector('.channel-sidebar')
const sidebarTitle = document.querySelector('.project-title h5')
const stage = document.querySelector('.stage')
const inspectorTitle = document.querySelector('.inspector-title h5')
const inspector = document.querySelector('.inspector')
const dashboard = document.querySelector('.dashboard-button')
const project = document.querySelector('.project-button')
@@ -72,13 +75,18 @@ const metrics = await page.evaluate(() => {
statusbarHeight: statusbar?.getBoundingClientRect().height,
searchHeight: search?.getBoundingClientRect().height,
workbenchMain: rect(main),
hasWorkspacePage: Boolean(workspacePage),
projectRailWidth: rail?.getBoundingClientRect().width,
projectRail: rect(rail),
channelSidebar: rect(sidebar),
sidebarTitleText: sidebarTitle?.textContent ?? '',
stage: rect(stage),
inspector: rect(inspector),
inspectorTitleText: inspectorTitle?.textContent ?? '',
dashboardButton: rect(dashboard),
dashboardButtonActive: dashboard?.classList.contains('active') ?? false,
projectButton: rect(project),
projectButtonActive: project?.classList.contains('active') ?? false,
createProjectButton: rect(create),
firstProjectBadge: rect(firstBadge),
horizontalInsets,
@@ -101,6 +109,15 @@ if (metrics.statusbarHeight !== 32) failures.push(`expected statusbar height 32,
if (metrics.searchHeight !== 42) failures.push(`expected search height 42, got ${metrics.searchHeight}`)
if (metrics.overflowX) failures.push('expected no horizontal overflow')
if (!metrics.workbenchMain) failures.push('missing workbench main')
if (!metrics.hasWorkspacePage) failures.push('expected login to land on workspace page')
if (!metrics.dashboardButtonActive) failures.push('expected dashboard button to be active after login')
if (metrics.projectButtonActive) failures.push('expected first project button not to be active on workspace landing page')
if (!metrics.sidebarTitleText.includes('工作台')) {
failures.push(`expected sidebar title to describe workspace landing page, got ${JSON.stringify(metrics.sidebarTitleText)}`)
}
if (!metrics.inspectorTitleText.includes('工作台')) {
failures.push(`expected inspector title to describe workspace landing page, got ${JSON.stringify(metrics.inspectorTitleText)}`)
}
if (!metrics.projectRail || !metrics.channelSidebar || !metrics.stage || !metrics.inspector) {
failures.push(
`missing main layout regions: rail=${JSON.stringify(metrics.projectRail)}, sidebar=${JSON.stringify(metrics.channelSidebar)}, stage=${JSON.stringify(metrics.stage)}, inspector=${JSON.stringify(metrics.inspector)}`,