考勤模块 Web 功能测试报告
模块:考勤 (Attendance)
版本:0.1.0
测试日期:2026-06-22 19:22:17
测试工具:Playwright + Chromium (headless)
Base URL:http://localhost:3000
测试范围:admin / teacher / student / parent 四角色考勤页面 + 跨角色访问保护 + 关键交互
一、测试概览
| 指标 |
数值 |
| 总测试项 |
28 |
| 通过 |
28 |
| 失败 |
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 |
最终 URL |
错误 |
警告 |
| ✅ |
考勤总览 |
/admin/attendance |
200 |
http://localhost:3000/admin/attendance |
- |
- |
检查项明细 - 考勤总览
| 状态 |
检查项 |
详情 |
| ✅ |
标题关键词匹配 (考勤总览) |
实际匹配: True |
交互测试
| 状态 |
交互项 |
详情 |
| ✅ |
管理员考勤总览 - 统计卡片显示 |
|
| ✅ |
管理员考勤总览 - 筛选器存在 |
|
| ✅ |
管理员考勤总览 - 统计分析快捷链接 |
|
TEACHER 考勤模块
页面测试
| 状态 |
类别 |
路由 |
HTTP |
最终 URL |
错误 |
警告 |
| ✅ |
考勤记录 |
/teacher/attendance |
200 |
http://localhost:3000/teacher/attendance |
- |
- |
| ✅ |
录入考勤 |
/teacher/attendance/sheet |
200 |
http://localhost:3000/teacher/attendance/sheet |
- |
- |
| ✅ |
考勤统计 |
/teacher/attendance/stats |
200 |
http://localhost:3000/teacher/attendance/stats |
- |
- |
检查项明细 - 考勤记录
| 状态 |
检查项 |
详情 |
| ✅ |
标题关键词匹配 (考勤记录) |
实际匹配: True |
检查项明细 - 录入考勤
| 状态 |
检查项 |
详情 |
| ✅ |
标题关键词匹配 (录入考勤) |
实际匹配: True |
检查项明细 - 考勤统计
| 状态 |
检查项 |
详情 |
| ✅ |
标题关键词匹配 (考勤统计) |
实际匹配: True |
交互测试
| 状态 |
交互项 |
详情 |
| ✅ |
录入考勤 - 班级选择器存在 |
|
| ✅ |
录入考勤 - 日期选择器存在 |
|
| ✅ |
录入考勤 - 全部标记到场按钮 |
|
| ✅ |
考勤统计 - 统计卡片显示 |
|
| ✅ |
考勤统计 - 班级切换器存在 |
找到 1 个班级切换链接 |
STUDENT 考勤模块
页面测试
| 状态 |
类别 |
路由 |
HTTP |
最终 URL |
错误 |
警告 |
| ✅ |
我的考勤 |
/student/attendance |
200 |
http://localhost:3000/student/attendance |
- |
- |
检查项明细 - 我的考勤
| 状态 |
检查项 |
详情 |
| ✅ |
标题关键词匹配 (我的考勤) |
实际匹配: True |
交互测试
| 状态 |
交互项 |
详情 |
| ✅ |
学生考勤 - 统计信息显示 |
|
| ✅ |
学生考勤 - 最近记录显示 |
|
PARENT 考勤模块
页面测试
| 状态 |
类别 |
路由 |
HTTP |
最终 URL |
错误 |
警告 |
| ✅ |
子女考勤 |
/parent/attendance |
200 |
http://localhost:3000/parent/attendance |
- |
- |
检查项明细 - 子女考勤
| 状态 |
检查项 |
详情 |
| ✅ |
标题关键词匹配 (子女考勤) |
实际匹配: True |
交互测试
| 状态 |
交互项 |
详情 |
| ✅ |
家长考勤 - 子女信息显示 |
|
| ✅ |
家长考勤 - 出勤率卡片 |
|
| ✅ |
家长考勤 - 月历视图 |
|
四、跨角色访问保护测试
| 角色 |
禁止路由 |
实际 URL |
结果 |
说明 |
| teacher |
/admin/attendance |
/teacher/dashboard |
✅ 拒绝 |
重定向回 /teacher/dashboard(拒绝访问) |
| teacher |
/student/attendance |
/teacher/dashboard |
✅ 拒绝 |
重定向回 /teacher/dashboard(拒绝访问) |
| teacher |
/parent/attendance |
/teacher/dashboard |
✅ 拒绝 |
重定向回 /teacher/dashboard(拒绝访问) |
| student |
/admin/attendance |
/student/dashboard |
✅ 拒绝 |
重定向回 /student/dashboard(拒绝访问) |
| student |
/teacher/attendance |
/student/dashboard |
✅ 拒绝 |
重定向回 /student/dashboard(拒绝访问) |
| student |
/parent/attendance |
/student/dashboard |
✅ 拒绝 |
重定向回 /student/dashboard(拒绝访问) |
| parent |
/admin/attendance |
/parent/dashboard |
✅ 拒绝 |
重定向回 /parent/dashboard(拒绝访问) |
| parent |
/teacher/attendance |
/parent/dashboard |
✅ 拒绝 |
重定向回 /parent/dashboard(拒绝访问) |
| parent |
/student/attendance |
/parent/dashboard |
✅ 拒绝 |
重定向回 /parent/dashboard(拒绝访问) |
六、测试结论与改进建议
✅ 考勤模块所有测试通过,各角色考勤页面功能正常,权限保护有效。
改进建议
- 认证与权限:失败页面中若出现重定向至 /login,需检查会话过期策略与权限校验逻辑。
- HTTP 5xx 错误:服务端错误需检查 Server Action 数据访问层与数据库连接。
- 页面内容为空:检查数据查询条件与渲染逻辑,确认数据源是否返回预期结果。
- 控制台错误:浏览器控制台报错需检查前端组件渲染与 API 调用。
- 跨角色访问:若出现权限漏洞,需检查
requirePermission() 调用与角色-权限映射。
- i18n 缺失:若页面出现英文硬编码,需补充对应 i18n key。
报告自动生成于 2026-06-22 19:22:17