test: update and add E2E, integration, visual, and webapp tests
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

- 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
This commit is contained in:
SpecialX
2026-06-23 17:39:40 +08:00
parent f40ce0f560
commit d884c6d513
183 changed files with 19006 additions and 0 deletions

166
webtest/dashboard_0.1.0.md Normal file
View File

@@ -0,0 +1,166 @@
# 仪表盘模块 Web 功能测试报告
> 模块:仪表盘 (Dashboard)
> 版本0.1.0
> 测试日期2026-06-22 19:25:57
> 测试工具Playwright + Chromium (headless)
> Base URLhttp://localhost:3000
> 测试范围admin / teacher / student / parent 四角色仪表盘 + /dashboard 重定向 + 跨角色访问保护
---
## 一、测试概览
| 指标 | 数值 |
|------|------|
| 总测试项 | 20 |
| 通过 | 20 |
| 失败 | 0 |
| 警告 | 0 |
| 通过率 | 100.0% |
---
## 二、测试账号
| 角色 | 邮箱 | 预期仪表盘路径 |
|------|------|----------------|
| 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://localhost:3000/admin/dashboard`)
- **登录**: ✅ 成功
- **HTTP 状态**: 200
- **最终 URL**: `http://localhost:3000/admin/dashboard`
- **页面状态**: passed
- **截图**: dashboard_admin.png
#### 检查项明细
| 状态 | 检查项 | 详情 |
|------|--------|------|
| ✅ | 页面内容非空 | 内容长度 678338 |
| ✅ | 标题关键词匹配 | 预期关键词: ['管理员', 'Admin', '仪表盘', 'Dashboard'] |
| ✅ | 统计卡片数量 (预期 4) | 实际: 16 |
| ✅ | 快捷操作链接 (预期 >= 7) | 实际: 14 |
| ✅ | 最近用户表格存在 | 表格存在: True |
| ✅ | 图表或空状态 (预期图表 2) | 图表: 0, 空状态: True |
---
### ✅ TEACHER 仪表盘 (`http://localhost:3000/teacher/dashboard`)
- **登录**: ✅ 成功
- **HTTP 状态**: 200
- **最终 URL**: `http://localhost:3000/teacher/dashboard`
- **页面状态**: passed
- **截图**: dashboard_teacher.png
#### 检查项明细
| 状态 | 检查项 | 详情 |
|------|--------|------|
| ✅ | 页面内容非空 | 内容长度 662101 |
| ✅ | 标题关键词匹配 | 预期关键词: ['教师', 'Teacher', '仪表盘', 'Dashboard'] |
| ✅ | 统计卡片数量 (预期 4) | 实际: 5 |
| ✅ | 待办卡片存在 | 待办区域: 8 |
| ✅ | 快捷链接存在: /teacher/homework/submissions | |
| ✅ | 快捷链接存在: /teacher/attendance/sheet | |
| ✅ | 快捷链接存在: /teacher/homework/assignments | |
---
### ✅ STUDENT 仪表盘 (`http://localhost:3000/student/dashboard`)
- **登录**: ✅ 成功
- **HTTP 状态**: 200
- **最终 URL**: `http://localhost:3000/student/dashboard`
- **页面状态**: passed
- **截图**: dashboard_student.png
#### 检查项明细
| 状态 | 检查项 | 详情 |
|------|--------|------|
| ✅ | 页面内容非空 | 内容长度 520955 |
| ✅ | 标题关键词匹配 | 预期关键词: ['学生', 'Student', '仪表盘', 'Dashboard'] |
| ✅ | 统计卡片数量 (预期 5) | 实际: 6 |
| ✅ | 今日课表卡片 | |
| ✅ | 作业卡片 | |
---
### ✅ PARENT 仪表盘 (`http://localhost:3000/parent/dashboard`)
- **登录**: ✅ 成功
- **HTTP 状态**: 200
- **最终 URL**: `http://localhost:3000/parent/dashboard`
- **页面状态**: passed
- **截图**: dashboard_parent.png
#### 检查项明细
| 状态 | 检查项 | 详情 |
|------|--------|------|
| ✅ | 页面内容非空 | 内容长度 492448 |
| ✅ | 标题关键词匹配 | 预期关键词: ['家长', 'Parent', '仪表盘', 'Dashboard'] |
| ✅ | 快捷入口链接: /parent/grades | |
| ✅ | 快捷入口链接: /parent/attendance | |
| ✅ | 快捷入口链接: /announcements | |
| ✅ | 快捷入口链接: /parent/leave | |
| ✅ | 孩子卡片区域 | 检测到孩子相关内容: True |
---
## 四、/dashboard 通用路由重定向测试
| 角色 | 预期重定向 | 实际 URL | 结果 | 错误 |
|------|-----------|----------|------|------|
| admin | `/admin/dashboard` | `/admin/dashboard` | ✅ 通过 | - |
| teacher | `/teacher/dashboard` | `/teacher/dashboard` | ✅ 通过 | - |
| student | `/student/dashboard` | `/student/dashboard` | ✅ 通过 | - |
| parent | `/parent/dashboard` | `/parent/dashboard` | ✅ 通过 | - |
---
## 五、跨角色访问保护测试
| 角色 | 禁止路由 | 实际 URL | 结果 | 说明 |
|------|----------|----------|------|------|
| admin | `/teacher/dashboard` | `/admin/dashboard` | ✅ 拒绝 | 重定向回 /admin/dashboard拒绝访问 |
| admin | `/student/dashboard` | `/admin/dashboard` | ✅ 拒绝 | 重定向回 /admin/dashboard拒绝访问 |
| admin | `/parent/dashboard` | `/admin/dashboard` | ✅ 拒绝 | 重定向回 /admin/dashboard拒绝访问 |
| teacher | `/admin/dashboard` | `/teacher/dashboard` | ✅ 拒绝 | 重定向回 /teacher/dashboard拒绝访问 |
| teacher | `/student/dashboard` | `/teacher/dashboard` | ✅ 拒绝 | 重定向回 /teacher/dashboard拒绝访问 |
| teacher | `/parent/dashboard` | `/teacher/dashboard` | ✅ 拒绝 | 重定向回 /teacher/dashboard拒绝访问 |
| student | `/admin/dashboard` | `/student/dashboard` | ✅ 拒绝 | 重定向回 /student/dashboard拒绝访问 |
| student | `/teacher/dashboard` | `/student/dashboard` | ✅ 拒绝 | 重定向回 /student/dashboard拒绝访问 |
| student | `/parent/dashboard` | `/student/dashboard` | ✅ 拒绝 | 重定向回 /student/dashboard拒绝访问 |
| parent | `/admin/dashboard` | `/parent/dashboard` | ✅ 拒绝 | 重定向回 /parent/dashboard拒绝访问 |
| parent | `/teacher/dashboard` | `/parent/dashboard` | ✅ 拒绝 | 重定向回 /parent/dashboard拒绝访问 |
| parent | `/student/dashboard` | `/parent/dashboard` | ✅ 拒绝 | 重定向回 /parent/dashboard拒绝访问 |
---
## 七、测试结论与改进建议
**仪表盘模块所有测试通过**,各角色仪表盘功能正常,权限保护有效。
### 改进建议
1. **认证与权限**:失败页面中若出现重定向至 /login需检查会话过期策略与权限校验逻辑。
2. **HTTP 5xx 错误**:服务端错误需检查 Server Action 数据访问层与数据库连接。
3. **页面内容为空**:检查数据查询条件与渲染逻辑,确认数据源是否返回预期结果。
4. **控制台错误**:浏览器控制台报错需检查前端组件渲染与 API 调用。
5. **跨角色访问**:若出现权限漏洞,需检查 `requirePermission()` 调用与角色-权限映射。
---
*报告自动生成于 2026-06-22 19:25:57*