Files
Neo-ZQYY/apps/admin-web/e2e/dashboard.spec.ts
Neo 6f8f12314f feat: 累积功能变更 — 聊天集成、租户管理、小程序更新、ETL 增强、迁移脚本
包含多个会话的累积代码变更:
- backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔
- admin-web: ETL 状态页、任务管理、调度配置、登录优化
- miniprogram: 看板页面、聊天集成、UI 组件、导航更新
- etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强
- tenant-admin: 项目初始化
- db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8)
- packages/shared: 枚举和工具函数更新
- tools: 数据库工具、报表生成、健康检查
- docs: PRD/架构/部署/合约文档更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 00:03:48 +08:00

69 lines
2.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Dashboard 页面 E2E 测试。
*
* 验证点:
* - 4 个区块渲染OpsPanel、DbHealthCard、AI 运行总览、AI 调度摘要)
* - 跳转链接正确ETL 状态详情、触发器详情、AI 调度详情)
*/
import { test, expect } from '@playwright/test';
import { injectAuth, mockAllApis } from './helpers';
test.describe('Dashboard 页面', () => {
test.beforeEach(async ({ page }) => {
await injectAuth(page);
await mockAllApis(page);
await page.goto('/dashboard');
// 等待页面标题渲染,确认 Dashboard 已加载
await expect(page.locator('text=运行状态').first()).toBeVisible();
});
test('4 个区块均渲染', async ({ page }) => {
// 区块 1OpsPanel 子组件(系统资源信息)
// SystemResourceSection 会展示 CPU / 内存 / 磁盘等信息
await expect(page.locator('text=CPU').first()).toBeVisible();
// 区块 2数据库健康监控DbHealthCard
await expect(page.locator('text=数据库').first()).toBeVisible();
// 区块 3AI 运行总览
await expect(page.locator('text=AI 运行总览').first()).toBeVisible();
// 区块 4AI 调度摘要
await expect(page.locator('text=AI 调度摘要').first()).toBeVisible();
// 验证统计卡片存在
await expect(page.locator('text=今日触发数')).toBeVisible();
await expect(page.locator('text=今日成功率')).toBeVisible();
await expect(page.locator('text=总记录数')).toBeVisible();
});
test('ETL 状态详情跳转到 /etl-tasks?tab=status', async ({ page }) => {
const btn = page.locator('button', { hasText: 'ETL 状态详情' });
await expect(btn).toBeVisible();
await btn.click();
await expect(page).toHaveURL(/\/etl-tasks\?tab=status/);
});
test('触发器详情跳转到 /triggers?tab=all', async ({ page }) => {
const btn = page.locator('button', { hasText: '触发器详情' });
await expect(btn).toBeVisible();
await btn.click();
await expect(page).toHaveURL(/\/triggers\?tab=all/);
});
test('AI 调度详情跳转到 /triggers?tab=ai', async ({ page }) => {
const btn = page.locator('button', { hasText: 'AI 调度详情' });
await expect(btn).toBeVisible();
await btn.click();
await expect(page).toHaveURL(/\/triggers\?tab=ai/);
});
test('AI 调度摘要底部链接跳转到 /triggers?tab=ai', async ({ page }) => {
// 卡片底部的 "查看 AI 调度详情" 链接
const link = page.locator('text=查看 AI 调度详情');
await expect(link).toBeVisible();
await link.click();
await expect(page).toHaveURL(/\/triggers\?tab=ai/);
});
});