前后端目录重命名: - reading-platform-java/ → lesingle-edu-reading-platform-backend/ - reading-platform-frontend/ → lesingle-edu-reading-platform-frontend/ 更新相关文件: - 所有 shell 脚本中的目录引用 - pom.xml 和 application.yml 中的项目名称 - package.json 中的项目名称 - .claude/CLAUDE.md 中的路径引用 - README 文档中的路径引用
107 lines
3.3 KiB
TypeScript
107 lines
3.3 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 hasSchedule = await page.locator('[class*="schedule"], [class*="timetable"], table').count() > 0;
|
|
const hasEmpty = await page.getByText(/暂无数据 | 暂无排课 | 空/).count() > 0;
|
|
|
|
test.info().annotations.push({
|
|
type: 'info',
|
|
description: `课表数据:${hasSchedule ? '存在' : 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"], [class*="dialog"]').count() > 0;
|
|
test.info().annotations.push({
|
|
type: 'info',
|
|
description: `创建弹窗:${hasModal ? '打开' : '未打开'}`,
|
|
});
|
|
}
|
|
});
|
|
|
|
test('验证课表视图切换', async ({ page }) => {
|
|
// 导航到课表页面
|
|
await clickSubMenu(page, '教学管理', '我的课表');
|
|
|
|
// 等待页面加载
|
|
await page.waitForTimeout(2000);
|
|
|
|
// 查找视图切换按钮(周/月)
|
|
const viewSwitcher = page.locator('[class*="switch"], [class*="view"], .ant-radio-group');
|
|
const hasViewSwitcher = await viewSwitcher.count() > 0;
|
|
|
|
test.info().annotations.push({
|
|
type: 'info',
|
|
description: `视图切换:${hasViewSwitcher ? '存在' : '不存在'}`,
|
|
});
|
|
});
|
|
|
|
test('截图保存课表状态', async ({ page }) => {
|
|
// 导航到课表页面
|
|
await clickSubMenu(page, '教学管理', '我的课表');
|
|
|
|
// 等待页面完全加载
|
|
await page.waitForTimeout(3000);
|
|
|
|
// 截图
|
|
await page.screenshot({ path: 'test-results/teacher-schedule.png' });
|
|
test.info().annotations.push({
|
|
type: 'success',
|
|
description: '课表页面截图已保存',
|
|
});
|
|
});
|
|
});
|