- 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
159 lines
5.2 KiB
Markdown
159 lines
5.2 KiB
Markdown
# 选修课模块 Web 功能测试报告
|
||
|
||
> 模块:选修课 (Elective)
|
||
> 版本:0.1.0
|
||
> 测试日期:2026-06-22 19:24:47
|
||
> 测试工具:Playwright + Chromium (headless)
|
||
> Base URL:http://localhost:3000
|
||
> 测试范围:admin / teacher / student / parent 四角色选修课页面 + 跨角色访问保护 + 关键交互
|
||
|
||
---
|
||
|
||
## 一、测试概览
|
||
|
||
| 指标 | 数值 |
|
||
|------|------|
|
||
| 总测试项 | 22 |
|
||
| 通过 | 21 |
|
||
| 失败 | 0 |
|
||
| 警告 | 1 |
|
||
| 通过率 | 95.5% |
|
||
|
||
---
|
||
|
||
## 二、测试账号
|
||
|
||
| 角色 | 邮箱 | 预期仪表盘路径 |
|
||
|------|------|----------------|
|
||
| admin | `admin@xiaoxue.edu.cn` | `/admin/dashboard` |
|
||
| teacher | `t_chinese_1@xiaoxue.edu.cn` | `/teacher/dashboard` |
|
||
| student | `student_g1c1_1@xiaoxue.edu.cn` | `/student/dashboard` |
|
||
| parent | `parent_g1c1_1@xiaoxue.edu.cn` | `/parent/dashboard` |
|
||
|
||
---
|
||
|
||
## 三、各角色测试详情
|
||
|
||
### ADMIN 选修课模块
|
||
|
||
- **登录**: ✅ 成功
|
||
|
||
#### 页面测试
|
||
|
||
| 状态 | 类别 | 路由 | HTTP | 最终 URL | 错误 | 警告 |
|
||
|------|------|------|------|----------|------|------|
|
||
| ✅ | 选修课程列表 | `/admin/elective` | 200 | `http://localhost:3000/admin/elective` | - | - |
|
||
| ✅ | 创建选修课程 | `/admin/elective/create` | 200 | `http://localhost:3000/admin/elective/create` | - | - |
|
||
|
||
##### 检查项明细 - 选修课程列表
|
||
|
||
| 状态 | 检查项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 标题关键词匹配 (选修课程) | 实际匹配: True |
|
||
|
||
##### 检查项明细 - 创建选修课程
|
||
|
||
| 状态 | 检查项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 标题关键词匹配 (创建课程) | 实际匹配: True |
|
||
|
||
#### 交互测试
|
||
|
||
| 状态 | 交互项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 管理员选修课 - 创建课程按钮存在 | |
|
||
| ✅ | 管理员选修课 - 内容显示(卡片或空状态) | |
|
||
| ✅ | 创建选修课 - 课程名称输入框 | |
|
||
| ✅ | 创建选修课 - 选课模式选择器 | |
|
||
| ✅ | 创建选修课 - 容量输入框 | |
|
||
| ✅ | 创建选修课 - 提交按钮 | |
|
||
|
||
---
|
||
|
||
### TEACHER 选修课模块
|
||
|
||
- **登录**: ✅ 成功
|
||
|
||
#### 页面测试
|
||
|
||
| 状态 | 类别 | 路由 | HTTP | 最终 URL | 错误 | 警告 |
|
||
|------|------|------|------|----------|------|------|
|
||
| ⚠️ | 我的选修课 | `/teacher/elective` | 200 | `http://localhost:3000/teacher/elective` | - | 控制台错误 1 条 |
|
||
|
||
##### 检查项明细 - 我的选修课
|
||
|
||
| 状态 | 检查项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 标题关键词匹配 (我的选修课) | 实际匹配: True |
|
||
|
||
#### 交互测试
|
||
|
||
| 状态 | 交互项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 教师选修课 - 创建课程按钮存在 | |
|
||
| ✅ | 教师选修课 - 内容显示(卡片或空状态) | |
|
||
|
||
---
|
||
|
||
### STUDENT 选修课模块
|
||
|
||
- **登录**: ✅ 成功
|
||
|
||
#### 页面测试
|
||
|
||
| 状态 | 类别 | 路由 | HTTP | 最终 URL | 错误 | 警告 |
|
||
|------|------|------|------|----------|------|------|
|
||
| ✅ | 选课中心 | `/student/elective` | 200 | `http://localhost:3000/student/elective` | - | - |
|
||
|
||
##### 检查项明细 - 选课中心
|
||
|
||
| 状态 | 检查项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 标题关键词匹配 (选课中心) | 实际匹配: True |
|
||
|
||
#### 交互测试
|
||
|
||
| 状态 | 交互项 | 详情 |
|
||
|------|--------|------|
|
||
| ✅ | 学生选课 - 我的选课区域 | |
|
||
| ✅ | 学生选课 - 可选课程区域 | |
|
||
| ✅ | 学生选课 - 搜索筛选器 | |
|
||
|
||
---
|
||
|
||
### PARENT 选修课模块
|
||
|
||
- **登录**: ✅ 成功
|
||
|
||
---
|
||
|
||
## 四、跨角色访问保护测试
|
||
|
||
| 角色 | 禁止路由 | 实际 URL | 结果 | 说明 |
|
||
|------|----------|----------|------|------|
|
||
| teacher | `/admin/elective` | `/teacher/dashboard` | ✅ 拒绝 | 重定向回 /teacher/dashboard(拒绝访问) |
|
||
| teacher | `/student/elective` | `/teacher/dashboard` | ✅ 拒绝 | 重定向回 /teacher/dashboard(拒绝访问) |
|
||
| student | `/admin/elective` | `/student/dashboard` | ✅ 拒绝 | 重定向回 /student/dashboard(拒绝访问) |
|
||
| student | `/teacher/elective` | `/student/dashboard` | ✅ 拒绝 | 重定向回 /student/dashboard(拒绝访问) |
|
||
| parent | `/admin/elective` | `/parent/dashboard` | ✅ 拒绝 | 重定向回 /parent/dashboard(拒绝访问) |
|
||
| parent | `/teacher/elective` | `/parent/dashboard` | ✅ 拒绝 | 重定向回 /parent/dashboard(拒绝访问) |
|
||
| parent | `/student/elective` | `/parent/dashboard` | ✅ 拒绝 | 重定向回 /parent/dashboard(拒绝访问) |
|
||
|
||
---
|
||
|
||
## 六、测试结论与改进建议
|
||
|
||
✅ **选修课模块所有测试通过**,各角色选修课页面功能正常,权限保护有效。
|
||
|
||
### 改进建议
|
||
|
||
1. **认证与权限**:失败页面中若出现重定向至 /login,需检查会话过期策略与权限校验逻辑。
|
||
2. **HTTP 5xx 错误**:服务端错误需检查 Server Action 数据访问层与数据库连接。
|
||
3. **页面内容为空**:检查数据查询条件与渲染逻辑,确认数据源是否返回预期结果。
|
||
4. **控制台错误**:浏览器控制台报错需检查前端组件渲染与 API 调用。
|
||
5. **跨角色访问**:若出现权限漏洞,需检查 `requirePermission()` 调用与角色-权限映射。
|
||
6. **资源归属校验**:update/delete/select/drop/lottery Action 必须校验资源归属,防止越权操作。
|
||
|
||
---
|
||
|
||
*报告自动生成于 2026-06-22 19:24:47* |