Files
xiaoxia-saas/tests/e2e/README.md
T
xiaoxia ecc058abe4
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Deploy / Staging E2E Tests (push) Failing after 98h27m27s
Deploy / Deploy Staging (push) Failing after 98h29m57s
CI/CD Pipeline / Frontend Lint (push) Failing after 98h30m23s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 98h30m30s
test(e2e): 添加生产可用的API冒烟测试脚本和部署检查清单
- api_smoke_test.sh: 零依赖bash脚本,支持多环境、模块化运行
- PRODUCTION_CHECKLIST.md: 生产部署6步检查清单
- 支持 BASE_URL/WEB_URL/EXISTING_TOKEN/MODULES 等环境变量
- 自动清理测试数据,不污染环境
- staging 环境可用 CURL_INSECURE=1 跳过证书校验
2026-07-05 10:18:47 +08:00

63 lines
2.2 KiB
Markdown
Executable File
Raw 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.
# E2E 端到端测试
API 层端到端冒烟测试,用于部署后快速验证核心功能。
## 文件说明
| 文件 | 说明 |
|------|------|
| `api_smoke_test.sh` | API 冒烟测试主脚本(bash + curl,无依赖) |
| `PRODUCTION_CHECKLIST.md` | 生产部署检查清单 |
## 快速开始
```bash
# 完整测试(staging 示例)
BASE_URL=https://staging-api.xiaoxiajianji.com ./api_smoke_test.sh
# 生产环境(用已有 token,避免注册测试账号)
BASE_URL=https://saas-api.xiaoxiajianji.com \
EXISTING_TOKEN=eyJhbGciOi... \
./api_smoke_test.sh
# 只跑指定模块
BASE_URL=... MODULES="auth,edit-plans,templates" ./api_smoke_test.sh
# 连带测前端路由
BASE_URL=... WEB_URL=https://saas.xiaoxiajianji.com ./api_smoke_test.sh
```
## 环境变量
| 变量 | 必填 | 默认值 | 说明 |
|------|------|--------|------|
| `BASE_URL` | ✅ | - | API 地址 |
| `WEB_URL` | ❌ | - | 前端地址(用于 Nginx 路由验证) |
| `EXISTING_TOKEN` | ❌ | - | 已有 token(跳过注册/登录,生产推荐) |
| `TEST_USER` | ❌ | 自动生成 | 测试用户名 |
| `TEST_PASSWORD` | ❌ | Test123456! | 测试密码 |
| `TEST_EMAIL` | ❌ | 自动生成 | 测试邮箱 |
| `MODULES` | ❌ | all | 指定模块,逗号分隔 |
| `CLEANUP_ENABLED` | ❌ | 1 | 是否清理测试数据(1/0) |
## 模块列表
| 模块名 | 覆盖范围 |
|--------|----------|
| `health` | 健康检查、API Docs、鉴权验证 |
| `edit-plans` | 剪辑计划 CRUD、AI推荐、AI封面、时间线、生成历史 |
| `templates` | 模板 CRUD、分类、收藏、验证 |
| `assets` | 素材列表、素材库、file_url、thumbnail_url |
| `diagnosis` | 项目级素材诊断、新格式验证 |
| `generation` | 生成任务列表 |
| `subscription` | 订阅、账单、仪表盘 |
| `misc` | 音色列表、AI标题生成 |
| `nginx` | 前端 SPA 路由(需 WEB_URL |
## 设计原则
- **零依赖**:只有 bash + curl + python3,任何环境都能跑
- **幂等安全**:每次用独立账号,清理测试数据,不污染环境
- **环境友好**:503/无素材等环境限制算通过,只抓真正的功能 bug
- **快速反馈**:全量 5 分钟跑完,适合部署后立即验证