1
0
Files
nex/frontend/e2e/stats-cards.spec.ts
lanyuanxiaoyao 870004af23 feat: 现代化 UI 布局,实现侧边栏导航和统计仪表盘
- 重构 AppLayout 为可折叠侧边栏导航布局
- 实现统计仪表盘:统计摘要卡片 + 请求趋势图表
- Provider 页面使用 Card 包裹优化视觉层次
- 主题切换按钮移至侧边栏底部,支持折叠态
- Header 适配暗色主题,添加分隔线优化视觉过渡
- 添加全局样式重置(SCSS)
- 完善组件测试和 E2E 测试覆盖
- 同步 OpenSpec 规范到主 specs
2026-04-16 19:24:02 +08:00

37 lines
1.3 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('统计摘要卡片', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/stats');
await expect(page.getByRole('heading', { name: '用量统计' })).toBeVisible();
});
test('应显示统计摘要卡片', async ({ page }) => {
await expect(page.getByText('总请求量')).toBeVisible();
await expect(page.getByText('活跃模型数')).toBeVisible();
await expect(page.getByText('活跃供应商数')).toBeVisible();
await expect(page.getByText('今日请求量')).toBeVisible();
});
test('应显示请求趋势图表', async ({ page }) => {
await expect(page.getByText('请求趋势')).toBeVisible();
});
test('应显示统计数据表格', async ({ page }) => {
await expect(page.getByText('统计数据')).toBeVisible();
});
test('统计卡片应显示数值', async ({ page }) => {
await page.waitForTimeout(1000);
const cards = page.locator('.ant-card');
const count = await cards.count();
expect(count).toBeGreaterThan(0);
});
test('应显示筛选栏', async ({ page }) => {
await expect(page.getByPlaceholder('所有供应商')).toBeVisible();
await expect(page.getByPlaceholder('模型名称')).toBeVisible();
});
});