包含多个会话的累积代码变更: - 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>
98 lines
3.8 KiB
TypeScript
98 lines
3.8 KiB
TypeScript
/**
|
||
* ETL 任务管理页面 E2E 测试。
|
||
*
|
||
* 验证点:
|
||
* - 5 个 Tab 切换(config、queue、schedule、history、status)
|
||
* - 各 Tab 内容渲染
|
||
* - Tab 与 URL 查询参数同步
|
||
*/
|
||
|
||
import { test, expect } from '@playwright/test';
|
||
import { injectAuth, mockAllApis } from './helpers';
|
||
|
||
test.describe('ETL 任务管理页面', () => {
|
||
test.beforeEach(async ({ page }) => {
|
||
await injectAuth(page);
|
||
await mockAllApis(page);
|
||
await page.goto('/etl-tasks');
|
||
// 等待页面标题渲染
|
||
await expect(page.locator('text=ETL 任务管理').first()).toBeVisible();
|
||
});
|
||
|
||
test('默认显示 config Tab', async ({ page }) => {
|
||
// 默认 Tab 为"发起"
|
||
const configTab = page.locator('[role="tab"]', { hasText: '发起' });
|
||
await expect(configTab).toHaveAttribute('aria-selected', 'true');
|
||
});
|
||
|
||
test('5 个 Tab 均可见', async ({ page }) => {
|
||
await expect(page.locator('[role="tab"]', { hasText: '发起' })).toBeVisible();
|
||
await expect(page.locator('[role="tab"]', { hasText: '队列' })).toBeVisible();
|
||
await expect(page.locator('[role="tab"]', { hasText: '调度' })).toBeVisible();
|
||
await expect(page.locator('[role="tab"]', { hasText: '历史' })).toBeVisible();
|
||
await expect(page.locator('[role="tab"]', { hasText: '状态' })).toBeVisible();
|
||
});
|
||
|
||
test('切换到 queue Tab', async ({ page }) => {
|
||
const queueTab = page.locator('[role="tab"]', { hasText: '队列' });
|
||
await queueTab.click();
|
||
await expect(queueTab).toHaveAttribute('aria-selected', 'true');
|
||
// URL 同步
|
||
await expect(page).toHaveURL(/\?tab=queue/);
|
||
});
|
||
|
||
test('切换到 schedule Tab', async ({ page }) => {
|
||
const scheduleTab = page.locator('[role="tab"]', { hasText: '调度' });
|
||
await scheduleTab.click();
|
||
await expect(scheduleTab).toHaveAttribute('aria-selected', 'true');
|
||
// URL 同步
|
||
await expect(page).toHaveURL(/\?tab=schedule/);
|
||
});
|
||
|
||
test('切换到 history Tab', async ({ page }) => {
|
||
const historyTab = page.locator('[role="tab"]', { hasText: '历史' });
|
||
await historyTab.click();
|
||
await expect(historyTab).toHaveAttribute('aria-selected', 'true');
|
||
// URL 同步
|
||
await expect(page).toHaveURL(/\?tab=history/);
|
||
});
|
||
|
||
test('切换到 status Tab', async ({ page }) => {
|
||
const statusTab = page.locator('[role="tab"]', { hasText: '状态' });
|
||
await statusTab.click();
|
||
await expect(statusTab).toHaveAttribute('aria-selected', 'true');
|
||
// URL 同步
|
||
await expect(page).toHaveURL(/\?tab=status/);
|
||
});
|
||
|
||
test('通过 URL 直接访问 queue Tab', async ({ page }) => {
|
||
await page.goto('/etl-tasks?tab=queue');
|
||
const queueTab = page.locator('[role="tab"]', { hasText: '队列' });
|
||
await expect(queueTab).toHaveAttribute('aria-selected', 'true');
|
||
});
|
||
|
||
test('通过 URL 直接访问 schedule Tab', async ({ page }) => {
|
||
await page.goto('/etl-tasks?tab=schedule');
|
||
const scheduleTab = page.locator('[role="tab"]', { hasText: '调度' });
|
||
await expect(scheduleTab).toHaveAttribute('aria-selected', 'true');
|
||
});
|
||
|
||
test('通过 URL 直接访问 history Tab', async ({ page }) => {
|
||
await page.goto('/etl-tasks?tab=history');
|
||
const historyTab = page.locator('[role="tab"]', { hasText: '历史' });
|
||
await expect(historyTab).toHaveAttribute('aria-selected', 'true');
|
||
});
|
||
|
||
test('通过 URL 直接访问 status Tab', async ({ page }) => {
|
||
await page.goto('/etl-tasks?tab=status');
|
||
const statusTab = page.locator('[role="tab"]', { hasText: '状态' });
|
||
await expect(statusTab).toHaveAttribute('aria-selected', 'true');
|
||
});
|
||
|
||
test('无效 tab 参数回退到默认 config', async ({ page }) => {
|
||
await page.goto('/etl-tasks?tab=invalid');
|
||
const configTab = page.locator('[role="tab"]', { hasText: '发起' });
|
||
await expect(configTab).toHaveAttribute('aria-selected', 'true');
|
||
});
|
||
});
|