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

137 lines
4.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, 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 hasRecordList = await page.locator('[class*="growth"], [class*="record"], table').count() > 0;
const hasEmpty = await page.getByText(/暂无数据 | 暂无记录/).count() > 0;
test.info().annotations.push({
type: 'info',
description: `成长记录数据:${hasRecordList ? '存在' : 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 ? '打开' : '未打开'}`,
});
if (hasModal) {
// 验证表单字段
const hasStudentSelect = await page.locator('[class*="student"] .ant-select, [placeholder*="学生"]').count() > 0;
const hasTypeSelect = await page.locator('[class*="type"] .ant-select, [placeholder*="类型"]').count() > 0;
test.info().annotations.push({
type: 'info',
description: `学生选择:${hasStudentSelect ? '存在' : '不存在'}`,
});
test.info().annotations.push({
type: 'info',
description: `类型选择:${hasTypeSelect ? '存在' : '不存在'}`,
});
}
}
});
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);
// 查找操作按钮(编辑、删除等)
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(3000);
// 截图
await page.screenshot({ path: 'test-results/teacher-growth-records.png' });
test.info().annotations.push({
type: 'success',
description: '成长记录截图已保存',
});
});
});