8935081ac5
Co-authored-by: Cursor <cursoragent@cursor.com>
4.5 KiB
4.5 KiB
全站功能验收报告 — Agent 执行(非抽测)
日期: 2026-06-01
环境: 生产 https://api.synaglobal.vip(后端 127.0.0.1:8600)
结论: SPA 14 路由 + 核心 API 已全量自动化通过;破坏性/维护类项见文末「未自动化」表。
1. API 自动化(生产机执行)
| 套件 | 用例数 | 结果 |
|---|---|---|
tests/test_api.py |
25 | ✅ 25/25 |
tests/test_full_site_api.py |
28 | ✅ 28/28 |
合计 53 项 API 断言(含 CRUD 清理:test-server-e2e、test-script、test-schedule、test-preset、e2e-platform-full)。
test_full_site_api 覆盖模块
- 搜索、告警历史+统计、资产 platforms/nodes/树/SSH 会话/命令日志(含 platform CRUD)
- 服务器分类、推送日志、meta、单台 sync 日志
- 脚本 exec-config、执行历史、DB 凭据、SSH 密钥预设
- sync validate-source-path、browse(真实 server_id)、webssh-token
- 设置列表、IP 白名单、必应壁纸、health/detail、终端快捷命令
本轮修复(根因已根治)
| 问题 | 修复 |
|---|---|
GET /health/detail 401 |
DbSessionMiddleware 对 /health/detail 开 DB 会话(JWT 需查 admin 表) |
test_api.py 被 import 即跑 |
收拢为 run_tests(),仅 __main__ 执行 |
| 全站 API 平台创建 422 | 测试体补全 category+type |
| validate-source-path 422 | 字段改为 path |
2. UI 自动化(Playwright 15 项,生产 SPA)
命令:frontend/ 下 NEXUS_E2E_* + npx playwright test e2e/full-acceptance.spec.mjs
| # | 路由 | 验证内容 |
|---|---|---|
| 01 | #/ |
登录、仪表盘卡片 |
| 02 | #/servers |
列表、批量选 2 台、添加对话框开/关 |
| 03 | 顶栏 | 全局搜索输入 |
| 04 | #/terminal |
终端页加载 |
| 05 | #/files |
文件管理页加载 |
| 06 | #/push |
预览按钮(不点正式推送) |
| 07 | #/scripts |
新建脚本对话框开/关 |
| 08 | #/credentials |
三子页切换(密码/SSH/DB) |
| 09 | #/schedules |
新建调度对话框开/关 |
| 10 | #/retries |
重试队列页 |
| 11 | #/commands |
命令/会话视图切换 |
| 12 | #/alerts |
告警中心 |
| 13 | #/audit |
审计日志 |
| 14 | #/settings |
设置区段可见 |
| 15 | — | 主题切换、退出登录 |
结果: ✅ 15/15 passed(约 1.1 分钟)
3. 与功能清单对照(SPA 时代)
| 功能清单页面 | SPA 路由 | API | UI |
|---|---|---|---|
| 仪表盘 | / |
stats、alert 摘要 | ✅ |
| 服务器 | /servers |
CRUD+stats+logs | ✅ 含批量选择 |
| 终端 WebSSH | /terminal |
webssh-token | ✅ 页加载(未自动连 SSH) |
| 文件管理 | /files |
browse(API 有 SSH 用例) | ✅ 页加载 |
| 推送 | /push |
logs、preview 按钮 | ✅ 预览未断言结果 |
| 脚本库 | /scripts |
CRUD、executions 列表 | ✅ 对话框 |
| 凭据 | /credentials |
presets、ssh-key、db cred | ✅ 三 Tab |
| 调度 | /schedules |
CRUD | ✅ |
| 重试队列 | /retries |
list | ✅ |
| 命令日志 | /commands |
command-logs、ssh-sessions | ✅ 视图切换 |
| 告警中心 | /alerts |
alert-history | ✅ |
| 审计 | /audit |
audit list | ✅ |
| 设置 | /settings |
settings、allowlist | ✅ 未点 Telegram 测试发送 |
| 登录 | /login |
login、logout | ✅ |
| 安装向导 | /app/install.html |
— | ⏸ 生产已安装,未测 |
| 资产管理独立页 | 无独立路由 | assets API | ✅ API;UI 合并在服务器/命令 |
4. 未自动化(需维护窗口或你终验确认)
| 项 | 原因 |
|---|---|
| 正式 Push / rsync 写盘 | 避免误改生产文件 |
| 脚本远程执行 | 会改子机状态 |
| 批量 Agent 安装/升级/卸载 | SSH 长任务+改子机 |
| WebSSH 真实连接+resize 长会话 | Playwright 未模拟 xterm WS |
| Telegram 告警/测试发送 | 外部副作用 |
| kill Python 三层守护 | 服务中断 |
| Agent 心跳协议 | 需子机 Agent |
| install.html 五步 | 生产非安装模式 |
5. 你如何终验(可选抽查)
见 docs/reports/2026-06-01-final-acceptance-checklist.md。Agent 已覆盖上表 API+UI,你只需确认上表「未自动化」中你在意的 1~2 项即可。
6. 复现命令
# 生产 API
ssh nexus "cd /www/wwwroot/api.synaglobal.vip && python3 tests/test_api.py && python3 tests/test_full_site_api.py"
# 本地 UI(需 NEXUS_E2E_PASSWORD)
cd frontend && npm run test:e2e