chore: sync local latest state and repository cleanup

This commit is contained in:
Your Name
2026-03-23 13:02:36 +08:00
parent f1ff3d629f
commit 2ef0f17961
493 changed files with 46912 additions and 7977 deletions

View File

@@ -15,6 +15,38 @@
## 🚀 快速开始
### 0⃣ 双模式执行说明
E2E 测试支持两种执行模式:
**模式一:无真实凭证(默认/demo模式**
- 测试会检测到使用了默认测试凭证
- API 测试会显式跳过(`test.skip`),只运行页面相关测试
- 不会因为后端服务未启动而失败
**模式二:有真实凭证(严格模式)**
- 需要提供真实的 API Key 和 User Token
- 所有 API 测试会严格断言 2xx/3xx 响应码
- 401/403/404 会直接导致测试失败
凭证配置方式:
```bash
# 方式1设置环境变量
export E2E_USER_TOKEN="your-real-user-token"
export API_BASE_URL="http://your-backend:8080"
export PLAYWRIGHT_BASE_URL="http://your-frontend:5173"
# 方式2创建 .e2e-test-data.json 文件
# 位置frontend/e2e/.e2e-test-data.json
# 内容:
# {
# "apiKey": "your-real-api-key",
# "userToken": "your-real-user-token",
# "activityId": 1,
# "userId": 10001
# }
```
### 1⃣ 一键运行(推荐)
```bash
@@ -211,9 +243,9 @@ await setApiKey(page, apiKey);
测试完成后,会生成以下报告:
- **HTML报告**: `frontend/e2e-report/index.html`
- **JUnit报告**: `frontend/e2e-results.xml`
- **截图**: `frontend/e2e-results/*.png`
- **HTML报告**: `frontend/e2e/e2e-report/index.html`
- **JUnit报告**: `frontend/e2e/e2e-results.xml`
- **截图**: `frontend/e2e/e2e-results/*.png`
- **录屏**: 失败测试自动录制视频
查看报告: