Files
digital-psychology/.ai/testing.md
T
jackyu66gitandCursor bd22d9dddd feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 11:37:53 +08:00

60 lines
1.8 KiB
Markdown
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.
# Testing — Golden Rules
对照完成闸门:`.ai/definition-of-done.md` §4。
## Priority
先测:计分、权益(深度版/会员)、归属、支付 mock。
## Levels
| Level | Command / artifact | When |
|---|---|---|
| L0 Build | `go test ./...` · `npm run build:h5` | 每次声称可合并 |
| L1 Unit | Go engine `_test.go`H5 Vitest | 核心逻辑必有 |
| L2 Integration | `npm run test:api:integration`(需 Postgres | P1 关键流必有 |
| L3 E2E | `npm run test:e2e`Playwright,可用系统 Chrome | P1 收口至少 1 条 |
## Go
```bash
npm run deps:up
cd apps/api && go test ./...
# 仅 L2
npm run test:api:integration
```
- Pure enginesportrait / relation)必须有 unit tests。
- L2 在 DB 不可用时 `Skip`;有 DB 时必须绿。
- `go test ./...` 失败 → 不得称 Backend Done。
### L2 覆盖的流
1. Profile → Portrait → deep_access pay-mock → detail
2. Two profiles → Relation insight → deep_access → tips
3. Membership pay-mock → `/membership/me` active → report detail
4. Profile → Ask thread → message → assistant reply + quota
H5 Vitest`PortraitPage` / `RelationPage` / `MembershipPage` / `AskPage`
## H5
```bash
npm run test:h5 # Vitest
npm run build:h5 && npm run test:e2e # Playwright(默认 channel=chrome
```
- 关键页:`PortraitPage` / `RelationPage` / `MembershipPage` 有 Vitest。
- Playwright 画像主路径使用 network mock,不依赖 Go。
- 若无系统 Chrome`npx playwright install chromium` 后设 `PW_CHANNEL=` 空或删 channel。
- **仅 build 通过 ≠ Frontend Done。**
## AI
不得在下列情况标记 Done
- 可计分逻辑零测试
- Build 红
- 无 L2 却宣称 P1 Complete
- 前端无 Loading/Empty/Error 却宣称页面 Done