分层测试目录,包含单元测试、集成测试和端到端测试。
| Task | Location | Notes |
|---|---|---|
| 单元测试 | unit/ |
Vue组件和游戏逻辑测试 |
| 集成测试 | integration/ |
API接口测试 |
| 端到端测试 | e2e/ |
Playwright浏览器测试 |
| Java测试 | ../zxyj-backend/src/test/ |
Spring Boot后端测试 |
tests/
├── unit/ # 单元测试
│ └── games/ # 小游戏逻辑测试
├── integration/ # 集成测试
│ └── *.spec.js # API接口测试
├── e2e/ # 端到端测试
│ └── *.spec.js # Playwright浏览器测试
└── AGENTS.md # 本文件
*.spec.js 用于JavaScript测试describe/it 语法unit/)unit/games/1a2b.spec.js - 游戏逻辑测试integration/)integration/mini-games-api.spec.js - 游戏API测试e2e/)e2e/mini-games-playwright.spec.js - 游戏流程测试zxyj-backend/src/test/java/GuideFamilyTaskControllerTest.java - 控制器测试# 后端测试
cd zxyj-backend
mvn test
# Playwright E2E测试 (需要先安装依赖)
npx playwright test tests/e2e/mini-games-playwright.spec.js
# 目前前端测试无法直接运行,需要先配置
打已部署站点的只读 UI E2E(e2e-live/*.spec.js + playwright.config.live.js,无 globalSetup、不写业务数据):
# 唯一规范跑法:cwd 必须是 tests/(保证 CLI 与 spec 用同一份 @playwright/test)
cd tests
npx playwright test -c playwright.config.live.js --project=frontend-mobile # 或 npm run test:e2e:live:frontend
npx playwright test -c playwright.config.live.js --project=admin-desktop # 或 npm run test:e2e:live:admin
npx playwright ...:根 package.json(1.63.0)与 tests/(1.61.1)各有一份
@playwright/test 物理副本,双副本下 test.describe() 无法注册 → 假红 No tests found
(历轮「test.describe 工具链信号」,如 R429 189 节点)。playwright.config.live.js 内已加
R416 工具链守卫:加载配置时自检双副本,命中即 fail-fast 并打印正确跑法,不再出加密报错。