chore: sync local latest state and repository cleanup
This commit is contained in:
118
docs/reports/e2e/E2E_TEST_REPORT_2026-03-23.md
Normal file
118
docs/reports/e2e/E2E_TEST_REPORT_2026-03-23.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# 端到端测试优化闭环报告
|
||||
|
||||
**日期**: 2026-03-23
|
||||
**是否全部通过**: **是**
|
||||
|
||||
---
|
||||
|
||||
## 执行命令清单
|
||||
|
||||
### 1. 前端 E2E 测试 (frontend/e2e)
|
||||
```bash
|
||||
cd /home/long/project/蚊子/frontend/e2e && npx playwright test --config=playwright.config.ts
|
||||
```
|
||||
|
||||
### 2. Admin E2E 测试 (frontend/e2e-admin)
|
||||
```bash
|
||||
cd /home/long/project/蚊子/frontend/e2e-admin && npx playwright test --config=playwright.config.ts
|
||||
```
|
||||
|
||||
### 3. 后端单元/集成测试
|
||||
```bash
|
||||
mvn test -B
|
||||
```
|
||||
|
||||
### 4. 验证修复后的 test:e2e 命令
|
||||
```bash
|
||||
cd /home/long/project/蚊子/frontend && npm run test:e2e
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 修改文件清单
|
||||
|
||||
| 文件 | 修改内容 |
|
||||
|------|---------|
|
||||
| `frontend/package.json` | 修复 `test:e2e` 命令,从 `playwright test` 改为 `cd e2e && npx playwright test --config=playwright.config.ts`,解决模块路径冲突问题 |
|
||||
|
||||
---
|
||||
|
||||
## 测试结果摘要
|
||||
|
||||
### 前端 E2E 测试 (frontend/e2e)
|
||||
| 测试套件 | 通过 | 跳过 | 失败 | 耗时 |
|
||||
|---------|------|------|------|------|
|
||||
| api-smoke.spec.ts | 3 | 0 | 0 | - |
|
||||
| h5-user-operations.spec.ts | 6 | 0 | 0 | - |
|
||||
| simple-health.spec.ts | 2 | 0 | 0 | - |
|
||||
| user-frontend-operation.spec.ts | 5 | 0 | 0 | - |
|
||||
| user-journey-fixed.spec.ts | 1 | 1 | 0 | - |
|
||||
| user-journey.spec.ts | 8 | 1 | 0 | - |
|
||||
| **总计** | **25** | **2** | **0** | **22.6s** |
|
||||
|
||||
### Admin E2E 测试 (frontend/e2e-admin)
|
||||
| 测试套件 | 通过 | 跳过 | 失败 | 耗时 |
|
||||
|---------|------|------|------|------|
|
||||
| admin.spec.ts | 3 | 0 | 0 | 1.8s |
|
||||
| **总计** | **3** | **0** | **0** | **1.8s** |
|
||||
|
||||
### 后端测试
|
||||
| 测试类型 | 运行数 | 通过 | 跳过 | 失败 | 错误 |
|
||||
|---------|-------|------|------|------|------|
|
||||
| 单元测试 | 1594 | 1574 | 20 | 0 | 0 |
|
||||
| **总计** | **1594** | **1574** | **20** | **0** | **0** |
|
||||
|
||||
---
|
||||
|
||||
## 总体结果
|
||||
|
||||
| 测试类别 | 通过 | 跳过 | 失败 | 错误 |
|
||||
|---------|------|------|------|------|
|
||||
| 前端 E2E | 25 | 2 | 0 | 0 |
|
||||
| Admin E2E | 3 | 0 | 0 | 0 |
|
||||
| 后端测试 | 1574 | 20 | 0 | 0 |
|
||||
| **总计** | **1602** | **22** | **0** | **0** |
|
||||
|
||||
---
|
||||
|
||||
## 问题诊断与修复
|
||||
|
||||
### 问题:Playwright 模块路径冲突
|
||||
|
||||
**症状**:
|
||||
```
|
||||
Error: Requiring @playwright/test second time
|
||||
```
|
||||
|
||||
**原因**:
|
||||
- 根目录 `/home/long/project/蚊子/node_modules/playwright` 有独立的 playwright 安装
|
||||
- `frontend/e2e/node_modules` 也有自己的 @playwright/test
|
||||
- `frontend/package.json` 的 `test:e2e` 命令使用 `playwright test`,加载配置时导致模块冲突
|
||||
|
||||
**修复**:
|
||||
修改 `frontend/package.json` 的 `test:e2e` 命令,直接在 `e2e` 子目录运行测试:
|
||||
```json
|
||||
"test:e2e": "cd e2e && npx playwright test --config=playwright.config.ts"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 跳过测试说明
|
||||
|
||||
以下测试因需要真实后端凭证而跳过(非失败):
|
||||
- `user-journey-fixed.spec.ts:86` - 活动列表API(需要真实凭证)
|
||||
- `user-journey.spec.ts:88` - 活动列表API(需要真实凭证)
|
||||
|
||||
这些是设计上的"跳过",用于在无认证情况下保持测试稳定性。
|
||||
|
||||
---
|
||||
|
||||
## 结论
|
||||
|
||||
**全部测试通过** ✅
|
||||
|
||||
- 前端 E2E: 25/27 通过 (2 跳过)
|
||||
- Admin E2E: 3/3 通过
|
||||
- 后端测试: 1594/1594 运行 (20 跳过,0 失败)
|
||||
|
||||
所有测试命令均已验证可用,测试套件处于健康状态。
|
||||
Reference in New Issue
Block a user