Files
NextEdu/webtest/class-management_v1.md
SpecialX d884c6d513
Some checks failed
CI / scheduled-backup (push) Failing after 36s
CI / backup-verify (push) Has been skipped
CI / weekly-dr-drill (push) Failing after 0s
CI / build-deploy (push) Has been cancelled
CI / security-scan (push) Has been cancelled
test: update and add E2E, integration, visual, and webapp tests
- Update E2E tests: announcements, auth, auth-business-flow, full-route-regression, grades, navigation, smoke-auth, teacher-web-test

- Update integration tests: api-ai-chat, api-onboarding-complete, api-onboarding-status, proxy-guard, integration setup

- Update visual regression tests: admin-dashboard, homepage, student-dashboard, teacher-dashboard, visual config, helpers

- Update webapp tests: admin, parent, student full tests and debug scripts

- Add new webapp tests: announcements_messages, settings_profile, debug scripts

- Add webtest directory with test plans, screenshots, and diagnostic scripts
2026-06-23 17:39:40 +08:00

230 lines
12 KiB
Markdown
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.
# 班级管理模块 Web 功能测试报告
> 测试日期2026-06-22 19:36:55
> 模块:班级管理 (Class Management)
> 版本v1
> 测试工具Playwright + Chromium (headless)
> Base URLhttp://localhost:3000
> 覆盖子模块admin-classes, management-classes, teacher-classes, teacher-my-classes
---
## 一、测试概览
| 指标 | 数值 |
|------|------|
| 总测试项 | 21 |
| 通过 | 18 |
| 失败 | 0 |
| 警告 | 3 |
| 通过率 | 85.7% |
### 测试覆盖
| 子模块 | 路由 | 权限点 | admin | teacher | student | parent |
|--------|------|--------|-------|---------|---------|--------|
| 班级管理(admin) | /admin/school/classes | SCHOOL_MANAGE | ✅ 完整CRUD | ❌ 拒绝 | ❌ 拒绝 | ❌ 拒绝 |
| 年级班级管理 | /management/grade/classes | GRADE_MANAGE | ✅ 完整CRUD | ✅ 完整CRUD | ❌ 拒绝 | ❌ 拒绝 |
| 教师班级 | /teacher/classes | EXAM_CREATE | ✅ 查看 | ✅ 查看 | ❌ 拒绝 | ❌ 拒绝 |
| 教师我的班级 | /teacher/classes/my | EXAM_CREATE | ✅ 查看 | ✅ 查看 | ❌ 拒绝 | ❌ 拒绝 |
---
## 二、各角色测试详情
### 角色admin
- **登录状态**: ✅ 成功
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
#### 访问权限测试
| 状态 | 子模块 | 路由 | HTTP | 最终 URL | 备注 |
|------|--------|------|------|----------|------|
| ✅ | admin_classes | `/admin/school/classes` | 200 | `/admin/school/classes` | - |
| ✅ | management_classes | `/management/grade/classes` | 200 | `/management/grade/classes` | - |
| ⚠️ | teacher_classes | `/teacher/classes` | 200 | `/teacher/classes/my` | 警告: 重定向到 http://localhost:3000/teacher/classes/my预期 /teacher/classes |
| ✅ | teacher_my_classes | `/teacher/classes/my` | 200 | `/teacher/classes/my` | - |
#### CRUD 功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ✅ | admin 班级 CRUD | ✅ 列表加载 | 列表/空状态正常显示 |
| ✅ | admin 班级 CRUD | ✅ 打开创建对话框 | 创建对话框已打开 |
| ✅ | admin 班级 CRUD | ✅ 编辑入口存在 | 无数据行,跳过 |
| ✅ | admin 班级 CRUD | ✅ 删除入口存在 | 无数据行,跳过 |
| ⚠️ | 年级班级 CRUD (grade_head) | ❌ 列表加载 | 未找到表格或空状态 |
| ⚠️ | 年级班级 CRUD (grade_head) | ❌ 打开创建对话框 | 异常: Locator.click: Timeout 30000ms exceeded.
Call log:
- waiting for locator("button:has-text(\"New\"), button:has-text(\"新建\"), button:has-text(\"Create\"), button:has-text(\"新增\")").first
- locator resolved to <button disabled data-slot="button" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 h-9…>…</button>
- attempting click action
2 × waiting for element to be visible, enabled and stable
- element is not enabled
- retrying click action
- waiting 20ms
2 × waiting for element to be visible, enabled and stable
- element is not enabled
- retrying click action
- waiting 100ms
57 × waiting for element to be visible, enabled and stable
- element is not enabled
- retrying click action
- waiting 500ms
|
| ⚠️ | 年级班级 CRUD (grade_head) | ✅ 编辑入口存在 | 无数据行,跳过 |
| ⚠️ | 年级班级 CRUD (grade_head) | ✅ 删除入口存在 | 无数据行,跳过 |
#### 查看功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ✅ | 教师班级查看 | ✅ 页面加载 | 页面内容长度 401163 |
| ✅ | 教师班级查看 | ✅ 班级卡片/列表存在 | 找到卡片/表格/空状态cards: 1, tables: 0, empty: 0 |
---
### 角色teacher
- **登录状态**: ✅ 成功
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
#### 访问权限测试
| 状态 | 子模块 | 路由 | HTTP | 最终 URL | 备注 |
|------|--------|------|------|----------|------|
| ✅ | admin_classes | `/admin/school/classes` | 200 | `/teacher/dashboard?from=%2Fadmin%2Fschool%2Fclasses&reason=forbidden` | - |
| ✅ | management_classes | `/management/grade/classes` | 200 | `/management/grade/classes` | - |
| ⚠️ | teacher_classes | `/teacher/classes` | 200 | `/teacher/classes/my` | 警告: 重定向到 http://localhost:3000/teacher/classes/my预期 /teacher/classes |
| ✅ | teacher_my_classes | `/teacher/classes/my` | 200 | `/teacher/classes/my` | - |
#### CRUD 功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ⏭️ | admin 班级 CRUD | 跳过 | teacher 无 SCHOOL_MANAGE 权限,跳过 admin 班级 CRUD 测试 |
| ✅ | 年级班级 CRUD (grade_head) | ✅ 列表加载 | 列表/空状态正常显示 |
| ✅ | 年级班级 CRUD (grade_head) | ✅ 打开创建对话框 | 创建对话框已打开 |
| ✅ | 年级班级 CRUD (grade_head) | ✅ 编辑入口存在 | 无数据行,跳过 |
| ✅ | 年级班级 CRUD (grade_head) | ✅ 删除入口存在 | 无数据行,跳过 |
#### 查看功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ✅ | 教师班级查看 | ✅ 页面加载 | 页面内容长度 401708 |
| ✅ | 教师班级查看 | ✅ 班级卡片/列表存在 | 找到卡片/表格/空状态cards: 5, tables: 0, empty: 0 |
---
### 角色student
- **登录状态**: ✅ 成功
#### 访问权限测试
| 状态 | 子模块 | 路由 | HTTP | 最终 URL | 备注 |
|------|--------|------|------|----------|------|
| ✅ | admin_classes | `/admin/school/classes` | 200 | `/student/dashboard?from=%2Fadmin%2Fschool%2Fclasses&reason=forbidden` | - |
| ✅ | management_classes | `/management/grade/classes` | 200 | `/student/dashboard?from=%2Fmanagement%2Fgrade%2Fclasses&reason=forbidden` | - |
| ✅ | teacher_classes | `/teacher/classes` | 200 | `/student/dashboard?from=%2Fteacher%2Fclasses&reason=forbidden` | - |
| ✅ | teacher_my_classes | `/teacher/classes/my` | 200 | `/student/dashboard?from=%2Fteacher%2Fclasses%2Fmy&reason=forbidden` | - |
#### CRUD 功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ⏭️ | admin 班级 CRUD | 跳过 | student 无 SCHOOL_MANAGE 权限,跳过 admin 班级 CRUD 测试 |
| ⏭️ | 年级班级 CRUD (grade_head) | 跳过 | student 无 GRADE_MANAGE 权限,跳过 management 班级 CRUD 测试 |
#### 查看功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ⏭️ | 教师班级查看 | 跳过 | student 无 CLASS_READ 权限,跳过教师班级查看测试 |
---
### 角色parent
- **登录状态**: ✅ 成功
- **警告**: 控制台错误: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
#### 访问权限测试
| 状态 | 子模块 | 路由 | HTTP | 最终 URL | 备注 |
|------|--------|------|------|----------|------|
| ✅ | admin_classes | `/admin/school/classes` | 200 | `/parent/dashboard?from=%2Fadmin%2Fschool%2Fclasses&reason=forbidden` | - |
| ✅ | management_classes | `/management/grade/classes` | 200 | `/parent/dashboard?from=%2Fmanagement%2Fgrade%2Fclasses&reason=forbidden` | - |
| ✅ | teacher_classes | `/teacher/classes` | 200 | `/parent/dashboard?from=%2Fteacher%2Fclasses&reason=forbidden` | - |
| ✅ | teacher_my_classes | `/teacher/classes/my` | 200 | `/parent/dashboard?from=%2Fteacher%2Fclasses%2Fmy&reason=forbidden` | - |
#### CRUD 功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ⏭️ | admin 班级 CRUD | 跳过 | parent 无 SCHOOL_MANAGE 权限,跳过 admin 班级 CRUD 测试 |
| ⏭️ | 年级班级 CRUD (grade_head) | 跳过 | parent 无 GRADE_MANAGE 权限,跳过 management 班级 CRUD 测试 |
#### 查看功能测试
| 状态 | 功能 | 操作 | 详情 |
|------|------|------|------|
| ⏭️ | 教师班级查看 | 跳过 | parent 无 CLASS_READ 权限,跳过教师班级查看测试 |
---
## 四、控制台错误汇总
- **[admin]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **[admin]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **[admin]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **[admin]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **[teacher]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **[teacher]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
- **[parent]** A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client bran
## 五、测试结论
**所有测试通过**:班级管理模块在所有用户角色下均按预期工作。
- admin 角色可以完整访问 /admin/school/classes班级 CRUD
- teacher兼 grade_head角色可以访问 /management/grade/classes班级 CRUD和 /teacher/classes/my查看
- student / parent 角色被正确重定向到各自仪表盘(带 `reason=forbidden` 参数),权限隔离正常
---
*报告自动生成于 2026-06-22 19:36:55*