Files
Neo-ZQYY/apps/admin-web/e2e/trigger-manager.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

86 lines
3.2 KiB
TypeScript
Raw 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.
/**
* 触发器管理页面 E2E 测试。
*
* 验证点:
* - 4 个 Tab全部、业务、AI、ETL
* - 统一视图数据展示
* - 业务 Tab 编辑功能存在
*/
import { test, expect } from '@playwright/test';
import { injectAuth, mockAllApis } from './helpers';
test.describe('触发器管理页面', () => {
test.beforeEach(async ({ page }) => {
await injectAuth(page);
await mockAllApis(page);
await page.goto('/triggers');
// 等待页面标题渲染
await expect(page.locator('text=触发器管理').first()).toBeVisible();
});
test('4 个 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: 'AI' })).toBeVisible();
await expect(page.locator('[role="tab"]', { hasText: 'ETL' })).toBeVisible();
});
test('默认显示"全部"Tab', async ({ page }) => {
const allTab = page.locator('[role="tab"]', { hasText: '全部' });
await expect(allTab).toHaveAttribute('aria-selected', 'true');
});
test('统一视图表格展示数据', async ({ page }) => {
// "全部"Tab 的统一视图表格应展示 mock 数据
// 等待表格渲染
await expect(page.locator('table').first()).toBeVisible();
// 验证 mock 数据中的触发器名称
await expect(page.locator('text=测试触发器')).toBeVisible();
// 验证类型标签
await expect(page.locator('text=业务')).toBeVisible();
});
test('切换到业务 Tab 并验证编辑按钮', async ({ page }) => {
const bizTab = page.locator('[role="tab"]', { hasText: '业务' });
await bizTab.click();
await expect(bizTab).toHaveAttribute('aria-selected', 'true');
await expect(page).toHaveURL(/\?tab=biz/);
// 等待业务触发器表格加载
await expect(page.locator('table').first()).toBeVisible();
// 验证编辑按钮存在mock 数据中 status=enabled编辑按钮应可用
const editBtn = page.locator('button', { hasText: '编辑' }).first();
await expect(editBtn).toBeVisible();
});
test('切换到 AI Tab', async ({ page }) => {
const aiTab = page.locator('[role="tab"]', { hasText: 'AI' });
await aiTab.click();
await expect(aiTab).toHaveAttribute('aria-selected', 'true');
await expect(page).toHaveURL(/\?tab=ai/);
});
test('切换到 ETL Tab', async ({ page }) => {
const etlTab = page.locator('[role="tab"]', { hasText: 'ETL' });
await etlTab.click();
await expect(etlTab).toHaveAttribute('aria-selected', 'true');
await expect(page).toHaveURL(/\?tab=etl/);
// 等待 ETL 调度表格加载
await expect(page.locator('table').first()).toBeVisible();
});
test('通过 URL 直接访问 biz Tab', async ({ page }) => {
await page.goto('/triggers?tab=biz');
const bizTab = page.locator('[role="tab"]', { hasText: '业务' });
await expect(bizTab).toHaveAttribute('aria-selected', 'true');
});
test('通过 URL 直接访问 ai Tab', async ({ page }) => {
await page.goto('/triggers?tab=ai');
const aiTab = page.locator('[role="tab"]', { hasText: 'AI' });
await expect(aiTab).toHaveAttribute('aria-selected', 'true');
});
});