合并同事的远程更新: - 多地点登录支持功能 - 资源库管理优化 - 数据看板修复 - 视频预览功能 - 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>
130 lines
4.1 KiB
TypeScript
130 lines
4.1 KiB
TypeScript
/**
|
||
* 教师端 E2E 测试 - 授课记录
|
||
*/
|
||
|
||
import { test, expect } from '@playwright/test';
|
||
import { loginAsTeacher, clickSubMenu, waitForTable, waitForSuccess } 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 hasLessonList = await page.locator('[class*="lesson"], table').count() > 0;
|
||
const hasEmpty = await page.getByText(/暂无数据 | 暂无授课/).count() > 0;
|
||
|
||
test.info().annotations.push({
|
||
type: 'info',
|
||
description: `授课记录数据:${hasLessonList ? '存在' : hasEmpty ? '空状态' : '未知'}`,
|
||
});
|
||
});
|
||
|
||
test('验证创建授课记录功能', async ({ page }) => {
|
||
// 导航到授课记录页面
|
||
await clickSubMenu(page, '', '上课记录');
|
||
|
||
// 等待页面加载
|
||
await page.waitForTimeout(2000);
|
||
|
||
// 查找创建按钮
|
||
const createBtn = page.getByRole('button', { name: /创建 | 新建 | 添加 | 备课/ });
|
||
const hasCreateBtn = await createBtn.count() > 0;
|
||
|
||
test.info().annotations.push({
|
||
type: 'info',
|
||
description: `创建按钮:${hasCreateBtn ? '存在' : '不存在'}`,
|
||
});
|
||
|
||
if (hasCreateBtn) {
|
||
// 点击创建按钮
|
||
await createBtn.click();
|
||
await page.waitForTimeout(1000);
|
||
|
||
// 验证弹窗是否打开
|
||
const hasModal = await page.locator('.ant-modal, [class*="modal"]').count() > 0;
|
||
test.info().annotations.push({
|
||
type: 'info',
|
||
description: `创建弹窗:${hasModal ? '打开' : '未打开'}`,
|
||
});
|
||
}
|
||
});
|
||
|
||
test('验证授课记录操作按钮', async ({ page }) => {
|
||
// 导航到授课记录页面
|
||
await clickSubMenu(page, '', '上课记录');
|
||
|
||
// 等待页面加载
|
||
await page.waitForTimeout(3000);
|
||
|
||
// 查找操作按钮(开始、结束、取消等)
|
||
const actionBtns = page.locator('button:has-text("开始"), button:has-text("结束"), button:has-text("取消")');
|
||
const hasActionBtns = await actionBtns.count() > 0;
|
||
|
||
test.info().annotations.push({
|
||
type: 'info',
|
||
description: `操作按钮:${hasActionBtns ? '存在' : '不存在'}`,
|
||
});
|
||
});
|
||
|
||
test('验证学生评价记录功能', async ({ page }) => {
|
||
// 导航到授课记录页面
|
||
await clickSubMenu(page, '', '上课记录');
|
||
|
||
// 等待页面加载
|
||
await page.waitForTimeout(2000);
|
||
|
||
// 查找第一个授课记录并点击查看学生评价
|
||
const firstLesson = page.locator('table tbody tr').first();
|
||
const hasLesson = await firstLesson.count() > 0;
|
||
|
||
if (hasLesson) {
|
||
// 查找学生评价按钮
|
||
const studentRecordBtn = page.getByRole('button', { name: /学生 | 评价 | 记录/ }).first();
|
||
const hasBtn = await studentRecordBtn.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-lessons.png' });
|
||
test.info().annotations.push({
|
||
type: 'success',
|
||
description: '授课记录截图已保存',
|
||
});
|
||
});
|
||
});
|