kindergarten_java/reading-platform-frontend/tests/e2e/teacher/04-courses.spec.ts
Claude Opus 4.6 c90873bea9 Merge remote-tracking branch 'origin/master' and complete two-tier structure refactoring
合并同事的远程更新:
- 多地点登录支持功能
- 资源库管理优化
- 数据看板修复
- 视频预览功能
- KidsMode增强

两层结构重构完成:
- 数据库迁移 V28(course_collection、course_collection_package)
- 后端实体、Service、Controller实现
- 前端API类型和组件重构
- 修复冲突文件:CHANGELOG.md、components.d.ts、TeacherLessonController.java

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

105 lines
3.3 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.

/**
* 教师端 E2E 测试 - 课程列表
*/
import { test, expect } from '@playwright/test';
import { loginAsTeacher, clickSubMenu, waitForTable } from './helpers';
test.describe('教师端课程列表功能', () => {
test.beforeEach(async ({ page }) => {
await loginAsTeacher(page);
});
test('验证课程列表页面加载', async ({ page }) => {
// 导航到课程列表页面
await clickSubMenu(page, '', '课程中心');
// 等待页面加载
await page.waitForTimeout(2000);
// 验证页面标题
const hasTitle = await page.getByText(/课程 | 教学课程/).count() > 0;
test.info().annotations.push({
type: hasTitle ? 'success' : 'warning',
description: `课程标题:${hasTitle ? '存在' : '不存在'}`,
});
});
test('验证课程数据加载', async ({ page }) => {
// 导航到课程列表页面
await clickSubMenu(page, '', '课程中心');
// 等待页面加载
await page.waitForTimeout(3000);
// 检查是否有课程数据
const hasCourseList = await page.locator('[class*="course"], [class*="card"], table').count() > 0;
const hasEmpty = await page.getByText(/暂无数据 | 暂无课程/).count() > 0;
test.info().annotations.push({
type: 'info',
description: `课程数据:${hasCourseList ? '存在' : hasEmpty ? '空状态' : '未知'}`,
});
});
test('验证课程详情查看', async ({ page }) => {
// 导航到课程列表页面
await clickSubMenu(page, '', '课程中心');
// 等待页面加载
await page.waitForTimeout(2000);
// 查找第一个课程并点击查看
const firstCourse = page.locator('[class*="course-card"], [class*="course-item"], table tbody tr').first();
const hasCourse = await firstCourse.count() > 0;
if (hasCourse) {
// 尝试点击查看课程详情
await firstCourse.click();
await page.waitForTimeout(2000);
// 验证是否进入课程详情页
const hasDetailPage = await page.locator('[class*="course-detail"], [class*="detail"]').count() > 0;
test.info().annotations.push({
type: 'info',
description: `课程详情页:${hasDetailPage ? '存在' : '不存在'}`,
});
} else {
test.info().annotations.push({
type: 'warning',
description: '没有找到课程数据',
});
}
});
test('验证课程筛选功能', async ({ page }) => {
// 导航到课程列表页面
await clickSubMenu(page, '', '课程中心');
// 等待页面加载
await page.waitForTimeout(2000);
// 查找筛选器
const hasFilter = await page.locator('[class*="filter"], [class*="search"], .ant-input, .ant-select').count() > 0;
test.info().annotations.push({
type: 'info',
description: `筛选功能:${hasFilter ? '存在' : '不存在'}`,
});
});
test('截图保存课程列表状态', async ({ page }) => {
// 导航到课程列表页面(教师端菜单为"课程中心"
await clickSubMenu(page, '', '课程中心');
// 等待页面完全加载
await page.waitForTimeout(3000);
// 截图
await page.screenshot({ path: 'test-results/teacher-courses.png' });
test.info().annotations.push({
type: 'success',
description: '课程列表截图已保存',
});
});
});