kindergarten_java/reading-platform-frontend/tests/e2e/admin/02-dashboard.spec.ts
En 6f64723428 feat: 教师端数据看板与学校端课程统计功能
教师端数据看板:
- 新增 TeacherDashboardResponse/TeacherLessonVO/TeacherLessonTrendVO
- 新增 TeacherWeeklyStatsResponse 周统计响应
- 新增 TeacherActivityLevel 枚举和 TeacherActivityRankResponse 活跃度排行
- 实现教师端课程统计、任务完成详情、任务反馈接口

学校端课程统计:
- 新增 CourseUsageVO/CourseUsageStatsVO/CoursePackageVO
- 新增 SchoolCourseResponse 和学校端课程使用查询接口
- 实现学校端统计数据和课程趋势接口

用户资料功能:
- 新增 UpdateProfileRequest/UpdateProfileResponse
- 实现用户资料更新接口

前后端对齐:
- 更新 OpenAPI 规范和前端 API 类型生成
- 优化 DashboardView 组件和 API 调用

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:45:56 +08:00

91 lines
3.3 KiB
TypeScript

/**
* 超管端 E2E 测试 - 数据看板
*/
import { test, expect } from '@playwright/test';
import { loginAsAdmin } from './helpers';
test.describe('数据看板', () => {
test.beforeEach(async ({ page }) => {
// 登录并进入仪表盘
await loginAsAdmin(page);
});
test('验证统计卡片显示', async ({ page }) => {
// 等待统计卡片加载
await page.waitForSelector('.ant-statistic, [class*="statistic"]', { timeout: 10000 });
// 验证租户数卡片
const tenantCard = page.getByText(/租户数|租户总数|机构数/).first();
await expect(tenantCard).toBeVisible();
// 验证课程包数卡片
const courseCard = page.getByText(/课程包数|课程总数/).first();
await expect(courseCard).toBeVisible();
// 验证月授课次数卡片
const lessonCard = page.getByText(/月授课|授课次数/).first();
await expect(lessonCard).toBeVisible();
// 验证学生总数卡片
const studentCard = page.getByText(/学生总数|学生数/).first();
await expect(studentCard).toBeVisible();
});
test('验证趋势图加载', async ({ page }) => {
// 等待图表容器加载
const chartContainer = page.locator('[class*="trend"], [class*="chart"], canvas').first();
await expect(chartContainer).toBeVisible({ timeout: 10000 });
});
test('验证活跃租户 TOP5 列表', async ({ page }) => {
// 查找活跃租户列表区域
const activeTenantsSection = page.getByText(/活跃租户|活跃机构|TOP5/);
await expect(activeTenantsSection).toBeVisible({ timeout: 10000 });
// 验证列表中有数据行
const listItems = page.locator('[class*="list-item"], [class*="table-row"]').first();
await expect(listItems).toBeVisible();
});
test('验证热门课程包 TOP5 列表', async ({ page }) => {
// 查找热门课程包列表区域
const popularCoursesSection = page.getByText(/热门课程|热门课程包|TOP5/);
await expect(popularCoursesSection).toBeVisible({ timeout: 10000 });
// 验证列表中有数据行
const listItems = page.locator('[class*="list-item"], [class*="table-row"]').first();
await expect(listItems).toBeVisible();
});
test('验证快捷入口点击跳转 - 创建课程包', async ({ page }) => {
// 查找创建课程包快捷入口
const createCourseLink = page.getByText(/创建课程包|新建课程/).first();
await expect(createCourseLink).toBeVisible();
// 点击并验证跳转
await createCourseLink.click();
await page.waitForURL(/\/admin\/courses\/create|\/admin\/courses\/new/);
});
test('验证快捷入口点击跳转 - 管理租户', async ({ page }) => {
// 查找管理租户快捷入口
const tenantLink = page.getByText(/管理租户|租户管理/).first();
await expect(tenantLink).toBeVisible();
// 点击并验证跳转
await tenantLink.click();
await page.waitForURL(/\/admin\/tenants/);
});
test('验证快捷入口点击跳转 - 资源库', async ({ page }) => {
// 查找资源库快捷入口
const resourceLink = page.getByText(/资源库|资源管理/).first();
await expect(resourceLink).toBeVisible();
// 点击并验证跳转
await resourceLink.click();
await page.waitForURL(/\/admin\/resources/);
});
});