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('.t-card'); const count = await cards.count(); expect(count).toBeGreaterThan(0); }); test('应显示筛选栏', async ({ page }) => { await expect(page.locator('.t-select').first()).toBeVisible(); await expect(page.getByPlaceholder('模型名称')).toBeVisible(); }); });