kindergarten_java/reading-platform-frontend/tests/e2e/teacher/03-classes.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

113 lines
3.5 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 hasClassList = await page.locator('[class*="class"], [class*="card"], table').count() > 0;
const hasEmpty = await page.getByText(/暂无数据 | 暂无班级/).count() > 0;
test.info().annotations.push({
type: 'info',
description: `班级数据:${hasClassList ? '存在' : hasEmpty ? '空状态' : '未知'}`,
});
});
test('验证班级学生列表', async ({ page }) => {
// 导航到班级管理页面
await clickSubMenu(page, '', '我的班级');
// 等待页面加载
await page.waitForTimeout(2000);
// 查找第一个班级并点击进入
const firstClass = page.locator('[class*="class-card"], [class*="class-item"], table tbody tr').first();
const hasClass = await firstClass.count() > 0;
if (hasClass) {
// 尝试点击进入班级详情
await firstClass.click();
await page.waitForTimeout(2000);
// 验证是否进入班级详情页
const hasStudentList = await page.locator('[class*="student"], table').count() > 0;
test.info().annotations.push({
type: 'info',
description: `学生列表:${hasStudentList ? '存在' : '不存在'}`,
});
} else {
test.info().annotations.push({
type: 'warning',
description: '没有找到班级数据',
});
}
});
test('验证班级教师列表', async ({ page }) => {
// 导航到班级管理页面
await clickSubMenu(page, '', '我的班级');
// 等待页面加载
await page.waitForTimeout(2000);
// 查找第一个班级并查看教师
const firstClass = page.locator('[class*="class-card"], [class*="class-item"], table tbody tr').first();
const hasClass = await firstClass.count() > 0;
if (hasClass) {
// 查找查看教师按钮
const viewTeachersBtn = page.getByRole('button', { name: /教师 | 老师/ }).first();
const hasBtn = await viewTeachersBtn.count() > 0;
test.info().annotations.push({
type: 'info',
description: `查看教师按钮:${hasBtn ? '存在' : '不存在'}`,
});
}
});
test('截图保存班级列表状态', async ({ page }) => {
// 导航到班级管理页面(教师端菜单为"我的班级"
await clickSubMenu(page, '', '我的班级');
// 等待页面完全加载
await page.waitForTimeout(3000);
// 截图
await page.screenshot({ path: 'test-results/teacher-classes.png' });
test.info().annotations.push({
type: 'success',
description: '班级列表截图已保存',
});
});
});