feat: T10 回归测试 Bug 修复与功能完善

修复 BUG-001 至 BUG-009 及 T10-1 至 T10-6 相关问题:
- 打卡积分显示与累加逻辑优化
- 食谱计算器 Tab 选中样式修复
- 食物百科列表图片与简介展示修复
- 食物详情页数据加载修复
- AI营养师差异化回复优化
- 健康知识/营养知识名称统一
- 饮食指南/科普文章详情页内容展示修复
- 帖子营养统计数据展示修复
- 社区帖子类型中文命名统一
- 帖子详情标签中文显示修复
- 食谱营养AI填充功能完善
- 食谱收藏/点赞功能修复

新增:
- ToolNutritionFillService 营养填充服务
- T10 回归测试用例 (Playwright)
- 知识文章数据 SQL 脚本

涉及模块:
- crmeb-common: VO/Request/Response 优化
- crmeb-service: 业务逻辑完善
- crmeb-front: API 接口扩展
- msh_single_uniapp: 前端页面修复
- tests/e2e: 回归测试用例
This commit is contained in:
2026-03-05 09:35:00 +08:00
parent 6f2dc27fbc
commit d8d2025543
44 changed files with 1536 additions and 165 deletions

View File

@@ -0,0 +1,73 @@
# T10 Full Regression Test Report
**Plan:** smooth-moseying-tiger · **Task:** T10 Full regression testing
**Date:** 2026-03-04
**Scope:** Verify all 6 fixes: post detail tag, post/recipe AI fill, recipe favorite, recipe like visual, knowledge navigation.
---
## Summary
| # | Issue | Test ID | Pass/Fail | Notes |
|---|--------|---------|-----------|--------|
| 1 | Post detail tag shows Chinese | T10-1 | *(run tests)* | Asserts `.meal-tag`/`.type-tag` has Chinese on post detail |
| 2 | Post nutrition AI fill works | T10-2 | *(run tests)* | Clicks "AI 补充营养", expects stats and no error |
| 3 | Recipe nutrition AI fill works | T10-3 | *(run tests)* | Recipe detail shows nutrition (API or AI fill) |
| 4 | Recipe favorite no error | T10-4 | *(run tests)* | Favorite button shows 已收藏/已取消收藏, no 操作失败 |
| 5 | Recipe like emoji changes visual | T10-5 | *(run tests)* | Like button emoji 🤍 ↔ ❤️ on click |
| 6 | Knowledge articles can navigate to detail | T10-6 | *(run tests)* | 科普文章 → first item → detail has content |
**To get pass/fail:** Run `./scripts/run-t10-regression.sh` or `npx playwright test tests/e2e/bug-regression.spec.ts --grep "T10"`, then set each row to PASS or FAIL from the test output.
---
## How to Run
**Prerequisites:** Frontend at `http://localhost:8080`, backend API at `http://127.0.0.1:20822`, logged-in test account (phone/password in spec).
```bash
cd /Users/apple/scott2026/msh-system
npx playwright test tests/e2e/bug-regression.spec.ts --grep "T10" --reporter=list
```
To run with HTML report:
```bash
npx playwright test tests/e2e/bug-regression.spec.ts --grep "T10" --reporter=html
npx playwright show-report tests/e2e/reports
```
---
## Test Descriptions
| # | Issue | What the test does |
|---|--------|---------------------|
| **1** | **Post detail tag shows Chinese** | Opens community → first post → checks `.meal-tag` / `.type-tag` contains Chinese (e.g. 早餐/午餐/晚餐/分享). |
| **2** | **Post nutrition AI fill works** | Opens a post detail; if "🤖 AI 补充营养" is visible, clicks it, waits ~8s; asserts no error and nutrition stats appear. |
| **3** | **Recipe nutrition AI fill works** | Opens recipe detail (from tool main or `recipe-detail?id=1`), waits for nutrition card; asserts nutrition values are present (from API or AI fill). |
| **4** | **Recipe favorite no error** | Opens recipe detail, clicks favorite (⭐) button; expects toast "已收藏" or "已取消收藏" and no "操作失败". |
| **5** | **Recipe like emoji changes visual** | Opens recipe detail, reads like button emoji (🤍/❤️), clicks like; asserts emoji or state changes. |
| **6** | **Knowledge articles can navigate to detail** | Goes to nutrition-knowledge → 科普文章 tab → clicks first article; asserts detail page has visible content. |
---
## After Running: Fill Pass/Fail
Replace **Run tests to fill** in the Summary table with **PASS** or **FAIL** per test, and add any Notes (e.g. timeout, missing data, API error).
Example:
| # | Issue | Test ID | Pass/Fail | Notes |
|---|--------|---------|-----------|--------|
| 1 | Post detail tag shows Chinese | T10-1 | PASS | |
| 2 | Post nutrition AI fill works | T10-2 | PASS | |
| ... | ... | ... | ... | ... |
---
## Related Existing Tests
- **TC-B07** Diet guide & science article detail content (same scope as item 6).
- **TC-B08** Post detail nutrition stats visible.
- **TC-B09** Community tabs and post type tags in Chinese (list page; T10-1 checks post *detail* page).