fix(ECR-001): 对齐 Playwright e2e 与 /psy/ base 及现 UI

E2E 改走 /psy 路径并更新过时文案断言,恢复 L3 冒烟;补充 Phase F QA 报告。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-05 18:34:11 +08:00
co-authored by Cursor
parent e735aa43e3
commit 69fa1b85d6
5 changed files with 78 additions and 16 deletions
+8 -8
View File
@@ -83,24 +83,24 @@ test('star / rhythm / cards pages render with mocked API', async ({ page }) => {
await route.fulfill(ok({}))
})
await page.goto('/star?y=1983&m=6&d=6')
await expect(page.getByRole('heading', { name: '星象性格' })).toBeVisible()
await page.goto('/psy/star?y=1983&m=6&d=6')
await expect(page.getByText('E2E星象')).toBeVisible()
await expect(page.getByRole('button', { name: /深度版/ })).toBeVisible()
await expect(page.getByRole('button', { name: /解锁完整分析/ })).toBeVisible()
await page.goto('/rhythm?y=1992&m=6&d=8')
await expect(page.getByRole('heading', { name: '身心节律' })).toBeVisible()
await page.goto('/psy/rhythm?y=1992&m=6&d=8')
await expect(page.getByText('身心节律').first()).toBeVisible()
await expect(page.getByText('E2E节律')).toBeVisible()
await page.goto('/cards')
await expect(page.getByRole('heading', { name: '意象卡片' })).toBeVisible()
await page.goto('/psy/cards')
await expect(page.getByRole('heading', { name: 'Hi,我是愈心 AI' })).toBeVisible()
await page.getByRole('button', { name: '关联生日' }).click()
await page.locator('input[type="number"]').nth(0).fill('1990')
await page.locator('input[type="number"]').nth(1).fill('5')
await page.locator('input[type="number"]').nth(2).fill('12')
await page.getByRole('button', { name: '抽取卡片' }).click()
await expect(page.getByText('E2E卡片')).toBeVisible()
await page.goto('/companion')
await page.goto('/psy/companion')
await expect(page.getByText('立秋')).toBeVisible()
await expect(page.getByText('今日心情')).toBeVisible()
})
+8 -8
View File
@@ -58,14 +58,14 @@ test('home birth form opens portrait with summary and deep CTA', async ({ page }
})
})
await page.goto('/')
await expect(page.getByRole('img', { name: '愈心谷' }).first()).toBeVisible()
await page.goto('/psy/')
await expect(page.getByRole('navigation', { name: '主导航' })).toBeVisible()
await page.goto('/portrait?y=1990&m=5&d=12')
await expect(page.getByRole('img', { name: '愈心谷' }).first()).toBeVisible()
await expect(page.locator('header').getByRole('button', { name: '添加档案' })).toBeVisible()
await page.goto('/psy/portrait?y=1990&m=5&d=12')
await expect(page.getByRole('navigation', { name: '主导航' })).toBeVisible()
await expect(page.getByRole('heading', { name: '个人画像' })).toBeVisible()
await expect(page.getByText('E2E画像')).toBeVisible()
await expect(page.getByText('模拟摘要')).toBeVisible()
await expect(page.getByRole('button', { name: /深度版/ })).toBeVisible()
await expect(page.getByRole('heading', { name: '愈心解码' })).toBeVisible()
await expect(page.getByText('模拟摘要').first()).toBeVisible()
await expect(page.getByRole('link', { name: /在报告页打开/ })).toBeVisible()
await expect(page.getByRole('button', { name: /解锁完整分析/ }).first()).toBeVisible()
})
+2
View File
@@ -10,6 +10,8 @@ export default defineConfig({
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
use: {
// SPA Vite base is /psy/; absolute paths must include the prefix
// (Playwright treats `/foo` as origin-absolute, ignoring base path).
baseURL: 'http://127.0.0.1:4173',
trace: 'on-first-retry',
},
+1
View File
@@ -10,3 +10,4 @@
- **ECR-001 Phase A/C/D/E + ECR-002**membership 服务抽出;relation/star 引擎拆文件;`star/fortune``outlook`JSON 双写);integration 绿
- H5`/psy` baseURL + vite `/psy/api` 代理;首页 + 菜单 z-index 修复
- **ECR-001 Phase F + H5**types/sdk 对齐 OpenAPI;拆分 8 个超标页(均 ≤400);test:h5 35/35 绿
- QA:修 Playwright `/psy/` 路径与过时断言;e2e 2/2 绿(见 TEST_REPORT/ECR-001-phaseF-qa.md
+59
View File
@@ -0,0 +1,59 @@
# QA Report — ECR-001 Phase F post-ship review + functional test
**Date:** 2026-08-05
**Target:** `e735aa4` (+ local e2e harness fix for `/psy/`)
**Tier:** Standard smoke
## Code Review
**Decision: PASS**(与 `docs/CODE_REVIEW/ECR-001-phaseF-h5.md` 一致)
- 无接线/行为 blockers
- Should-fix 已在合入前修完
- 残留 nitsScale 交互单测仍缺;Relation/ImageCard router-link stub warnvue-tsc 仓库级既有错误
## Automated tests
| Suite | Result |
|-------|--------|
| `npm run test:h5` | PASS 15 files / 35 tests |
| `npm run test:e2e` | PASS 2/2(修 harness 后) |
| Live API `healthz` / create profile / star / ask quota / scales | PASS |
| H5 `http://localhost:5173/psy/` + `/psy/api` proxy | PASS(注意 Vite 仅监听 IPv6/`localhost` |
## E2E harness bug found & fixed(未推送)
根因:Vite `base: '/psy/'` 后,Playwright `goto('/star')` 落到站点根,被 Vite 提示改去 `/psy/star`
另:断言仍用旧文案(「星象性格」「个人画像」「意象卡片」标题、logo 位置等)。
本地已改:
- `e2e/*.spec.ts`:路径前缀 `/psy/` + 对齐现 UI
- 注释说明 Playwright 绝对路径忽略 base path
## Live API smoke evidence
```
ping ok
create profile ok
star report id + summary ok
ask quota remaining=3
membership inactive
scales 9 items
```
## Manual browse
gstack `browse` 因本机 Playwright chromium_headless_shell 未装全未能启动;改由 Playwright e2emock API+ curl 实机 API/代理覆盖。
## Residual risk
- 未做真人浏览器点触(Ask 发消息 / Scale 全流程 / Report 运势「一生」)— 建议本地打开 `http://localhost:5173/psy/` 点一遍
- e2e 修复尚未 commit/push
## Gate
- [x] Code review PASS
- [x] Unit + E2E green
- [x] API smoke PASS
- [ ] Human visual smoke(可选)
- [ ] Commit e2e harness fix