af49d22ca7
Add Telegram, WhatsApp and email account management, realtime messaging, contextual multilingual AI, customer intelligence, knowledge workflows, enterprise controls, a unified design system and complete repository documentation.
76 lines
3.4 KiB
TypeScript
76 lines
3.4 KiB
TypeScript
import { expect, test, type Page } from '@playwright/test'
|
|
|
|
const password = 'Lingxi-Design-2026!'
|
|
|
|
async function login(page: Page, suffix: string) {
|
|
const account = `design-${suffix}-${Date.now()}@local.test`
|
|
const registration = await page.request.post('/api/auth/register', {
|
|
data: {
|
|
name: 'Design Audit',
|
|
account,
|
|
password,
|
|
company: 'Design Audit',
|
|
industry: '跨境电商',
|
|
teamSize: '1-10人',
|
|
},
|
|
})
|
|
expect(registration.ok()).toBeTruthy()
|
|
await page.goto('/login')
|
|
await expect(page.locator('img[src="/brand-mark.svg"]')).toHaveCount(2)
|
|
await page.locator('input[autocomplete="username"]').fill(account)
|
|
await page.locator('input[autocomplete="current-password"]').fill(password)
|
|
await page.getByRole('button', { name: '登录' }).click()
|
|
await expect(page).toHaveURL(/\/dashboard/)
|
|
await expect(page.getByText('今日工作概览')).toBeVisible()
|
|
}
|
|
|
|
test('统一设计系统桌面端页面验收', async ({ page }, testInfo) => {
|
|
test.skip(testInfo.project.name !== 'desktop-chromium', '仅在桌面视口执行')
|
|
await login(page, 'desktop')
|
|
|
|
const pages = [
|
|
['/dashboard', '今日工作概览', 'dashboard'],
|
|
['/inbox', '消息', 'inbox'],
|
|
['/channels', '渠道与账号', 'channels'],
|
|
['/customers', '客户管理', 'customers'],
|
|
['/opportunities', '商机与跟进', 'opportunities'],
|
|
['/knowledge', '企业知识库', 'knowledge'],
|
|
['/analytics', '业务分析', 'analytics'],
|
|
['/settings', '管理企业资料、通知、智能能力与账号安全', 'settings'],
|
|
] as const
|
|
|
|
for (const [url, marker, name] of pages) {
|
|
await page.goto(url)
|
|
await expect(page.getByText(marker, { exact: false }).first()).toBeVisible()
|
|
await expect(page.getByText('Unexpected Application Error!', { exact: true })).toHaveCount(0)
|
|
await expect.poll(() => page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1)).toBe(true)
|
|
await page.screenshot({ path: testInfo.outputPath(`${name}.png`), fullPage: name !== 'inbox' })
|
|
}
|
|
|
|
await page.goto('/analytics')
|
|
await page.getByRole('button', { name: '近 7 天', exact: true }).click()
|
|
await expect(page.getByRole('button', { name: '近 7 天', exact: true })).toHaveAttribute('aria-pressed', 'true')
|
|
|
|
await page.goto('/opportunities?tab=tasks')
|
|
await expect(page).toHaveURL(/tab=tasks/)
|
|
await expect(page.getByText('任务', { exact: false }).first()).toBeVisible()
|
|
})
|
|
|
|
test('统一设计系统移动端页面验收', async ({ page }, testInfo) => {
|
|
test.skip(testInfo.project.name !== 'mobile-chromium', '仅在移动视口执行')
|
|
await login(page, 'mobile')
|
|
|
|
await page.screenshot({ path: testInfo.outputPath('dashboard-mobile.png'), fullPage: true })
|
|
await page.goto('/settings')
|
|
await expect(page.getByLabel('设置分类')).toBeVisible()
|
|
await page.getByLabel('设置分类').selectOption('ai')
|
|
await expect(page.getByLabel('设置分类')).toHaveValue('ai')
|
|
await expect(page.getByText('控制回复建议、分析和发送前确认规则')).toBeVisible()
|
|
await page.screenshot({ path: testInfo.outputPath('settings-mobile.png'), fullPage: true })
|
|
|
|
await page.goto('/inbox')
|
|
await expect(page.getByText('消息', { exact: true }).first()).toBeVisible()
|
|
await expect(page.getByText('Unexpected Application Error!', { exact: true })).toHaveCount(0)
|
|
await page.screenshot({ path: testInfo.outputPath('inbox-mobile.png'), fullPage: false })
|
|
})
|