Add project channel pages

This commit is contained in:
2026-07-20 12:26:21 +08:00
parent a65012c1b3
commit a299da63e7
10 changed files with 563 additions and 2 deletions

View File

@@ -133,6 +133,29 @@ const propertyMetrics = await collectMetrics()
await page.locator('.property-list').hover()
const propertyListHoverMetrics = await collectMetrics()
const channelPageChecks = []
for (const channel of [
{ label: 'Inbox 消息流', pageClass: 'project-inbox-page', expectedHeading: 'Inbox 消息流' },
{ label: '工作计划', pageClass: 'project-tasks-page', expectedHeading: '工作计划' },
{ label: 'AI 会话', pageClass: 'project-ai-page', expectedHeading: 'AI 会话' },
{ label: '笔记资料', pageClass: 'project-notes-page', expectedHeading: '笔记资料' },
{ label: 'Cron 计划任务', pageClass: 'project-cron-page', expectedHeading: 'Cron 计划任务' },
]) {
await page.locator('.channel-button', { hasText: channel.label }).click()
await page.waitForTimeout(250)
channelPageChecks.push(await page.evaluate((expected) => {
const pageNode = document.querySelector(`.${expected.pageClass}`)
const heading = pageNode?.querySelector('h4, h5')?.textContent ?? ''
const activeChannel = document.querySelector('.channel-button.active')?.textContent ?? ''
return {
...expected,
foundPage: Boolean(pageNode),
heading,
activeChannel,
}
}, channel))
}
await page.locator('.topbar-actions .arco-btn').first().click()
await page.screenshot({ path: 'test-results/project-react-acro-dark.png', fullPage: true })
@@ -149,6 +172,7 @@ console.log(JSON.stringify({
inspectorTabsContentHoverMetrics,
propertyMetrics,
propertyListHoverMetrics,
channelPageChecks,
errors,
}, null, 2))
@@ -279,6 +303,17 @@ for (const [name, overflow] of [
if (propertyMetrics.propertyListOverflow?.scrollbarWidth !== 'none') {
failures.push(`expected property list scrollbar to be hidden until hover, got ${JSON.stringify(propertyMetrics.propertyListOverflow)}`)
}
for (const check of channelPageChecks) {
if (!check.foundPage) {
failures.push(`expected ${check.label} to render .${check.pageClass}`)
}
if (!check.heading.includes(check.expectedHeading)) {
failures.push(`expected ${check.label} heading to include ${check.expectedHeading}, got ${JSON.stringify(check.heading)}`)
}
if (!check.activeChannel.includes(check.label)) {
failures.push(`expected ${check.label} sidebar button to stay active, got ${JSON.stringify(check.activeChannel)}`)
}
}
if (failures.length) {
throw new Error(failures.join('\n'))