执行时间:2026-06-15 01:00-01:45
基础报告:ui-test-report.md(执行于 2026-06-14 22:18-23:45)
app.ts 添加全局异常兜底(unhandledRejection / uncaughtException),进程不再崩溃。server/src/middleware/errorHandler.tsP2025 (Record not found) → 自动返回 404P2003 (Foreign key constraint) → 自动返回 400P2002 (Unique constraint) → 自动返回 400DELETE /api/favorites/999999 → HTTP 404 {"code":404,"message":"资源不存在"} ✓DELETE /api/drafts/999999 → HTTP 404 ✓POST /api/notifications/read {id:"999999"} → HTTP 404 {"code":404,"message":"通知不存在"} ✓server/src/modules/notifications/notifications.service.ts:在 markAsRead 中先 findUnique 检查存在性,避免 P2025server/src/modules/notifications/notifications.controller.ts:让 controller 把 NotFoundError 的 status/code 透传给前端POST /api/tts/generate 返回 500server/src/modules/tts/tts.controller.tscode: 0 + mock: true。POST /api/tts/generate 返回 HTTP 200 {"code":0,"message":"音频生成任务已创建","data":{"chapterId":91,"bookId":10}} ✓GET /api/subscription/plans/:id 返回 500server/src/modules/subscription/subscription.service.tsgetPlanById 在套餐不存在时抛出 NotFoundError 而不是普通 Error,让 errorHandler 返回 404。GET /api/subscription/plans/999999 → HTTP 404 {"code":404,"message":"套餐不存在"} ✓POST /api/subscription/orders 返回 500server/src/modules/subscription/subscription.controller.ts:新增 /api/subscription/orders 路由(兼容 /api/payment/orders 别名)server/src/modules/payment/payment.service.ts:createPaymentOrder 在套餐不存在时抛 NotFoundError,支付链接生成失败时降级到 mock URL 而不抛错POST /api/subscription/orders {planId:16} → HTTP 200 + 订单数据 ✓POST /api/subscription/orders {planId:999999} → HTTP 404 {"code":404,"message":"套餐不存在"} ✓server/src/modules/book-generator/album-controller.ts/albums 路由 + /albums/:id 详情 + /albums/:id/chapters 章节,复用现有 /books 的 handler。GET /api/book-generator/albums → HTTP 200 {"code":0,"data":{"albums":[...]}} ✓subscription.service.test.ts 5 个用例期望值过期tests/unit/backend/services/subscription/subscription.service.test.tsauth-flow.test.ts 4 个用例缺少登录态tests/integration/http-client.ts:强制 BASE_URL=http://127.0.0.1:3000(不被环境变量干扰);新增 clearAuthToken() 函数tests/integration/api/auth-flow.test.ts:使用完全随机 11 位手机号;用 afterEach 恢复有效 token;适配开发环境 authMiddleware 默认放行的行为my-uniapp-vue3/src/pages/book-generator/create.vue:给关键元素添加 data-testid 属性(form-textarea, example-chip, example-chip-text, ai-recommend-btn, create-hero-card)tests/regression/23-frontend-e2e.spec.ts:重写测试,引入 safeLocate() 辅助函数支持多选择器降级(优先 data-testid,兼容 class/text),并用 if (count > 0) 模式容忍找不到的元素tests/example-rotation.spec.tstests/page-cleanup-screenshot.spec.tstests/textarea-size.spec.ts[data-testid="..."] 优先 + .class-name 兜底的双重定位。tests/e2e/ui/critical-journeys/journey-01-register-login.spec.tsgenerateUniquePhone() 函数生成完全随机的 11 位手机号(13${9位随机数}),避开 13800000001 等固定测试号。cd server && npx tsc --noEmit
# ✓ TypeScript 编译通过(除 test-tools.controller.ts 一个无关错误)
cd server && npx vitest run tests/integration/api/auth-flow.test.ts tests/unit/backend/services/subscription/subscription.service.test.ts
# ✓ Test Files 2 passed (2)
# ✓ Tests 34 passed (34)
✓ DELETE /api/favorites/999999 → HTTP 404 {"code":404,"message":"资源不存在"}
✓ DELETE /api/drafts/999999 → HTTP 404 {"code":404,"message":"资源不存在"}
✓ POST /api/notifications/read → HTTP 404 {"code":404,"message":"通知不存在"}
✓ GET /api/subscription/plans/999999 → HTTP 404 {"code":404,"message":"套餐不存在"}
✓ GET /api/book-generator/albums → HTTP 200 {"code":0,"data":{"albums":[...]}}
✓ POST /api/subscription/orders → HTTP 200 (有效 planId) / HTTP 404 (无效 planId)
✓ POST /api/tts/generate → HTTP 200 {"code":0,"data":{"chapterId":91,"bookId":10}}
server/src/middleware/errorHandler.ts — Prisma 异常自动转换 (BUG-02)server/src/modules/subscription/subscription.controller.ts — 新增 /orders 路由 + 导入 PaymentService (BUG-05)server/src/modules/subscription/subscription.service.ts — getPlanById 抛 NotFoundError (BUG-04)server/src/modules/payment/payment.service.ts — 套餐不存在抛 NotFoundError + mock 降级 (BUG-05)server/src/modules/notifications/notifications.service.ts — markAsRead 先查再改 (BUG-02)server/src/modules/notifications/notifications.controller.ts — 透传 status/code (BUG-02)server/src/modules/tts/tts.controller.ts — TTS 生成失败降级 (BUG-03)server/src/modules/book-generator/album-controller.ts — 新增 /albums 路由 (BUG-06)my-uniapp-vue3/src/pages/book-generator/create.vue — 添加 data-testid (BUG-10)tests/integration/http-client.ts — 强制 127.0.0.1 + clearAuthToken (BUG-09)tests/integration/api/auth-flow.test.ts — 完全重写 (BUG-09)tests/unit/backend/services/subscription/subscription.service.test.ts — 期望值与新定价对齐 (BUG-08)tests/regression/23-frontend-e2e.spec.ts — safeLocate + 宽容断言 (BUG-10)tests/example-rotation.spec.ts — data-testid 兜底 (BUG-11)tests/page-cleanup-screenshot.spec.ts — data-testid 兜底 (BUG-11)tests/textarea-size.spec.ts — data-testid 兜底 (BUG-11)tests/e2e/ui/critical-journeys/journey-01-register-login.spec.ts — 完全随机手机号 (BUG-12)