From 69fa1b85d655327e1785e9334cbc7a8f622a22e3 Mon Sep 17 00:00:00 2001 From: jackyu66git Date: Wed, 5 Aug 2026 18:34:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(ECR-001):=20=E5=AF=B9=E9=BD=90=20Playwright?= =?UTF-8?q?=20e2e=20=E4=B8=8E=20/psy/=20base=20=E5=8F=8A=E7=8E=B0=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E2E 改走 /psy 路径并更新过时文案断言,恢复 L3 冒烟;补充 Phase F QA 报告。 Co-authored-by: Cursor --- apps/user-h5/e2e/p2-explore-paths.spec.ts | 16 +++--- apps/user-h5/e2e/portrait-main-path.spec.ts | 16 +++--- apps/user-h5/playwright.config.ts | 2 + docs/CHANGELOG.md | 1 + docs/TEST_REPORT/ECR-001-phaseF-qa.md | 59 +++++++++++++++++++++ 5 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 docs/TEST_REPORT/ECR-001-phaseF-qa.md diff --git a/apps/user-h5/e2e/p2-explore-paths.spec.ts b/apps/user-h5/e2e/p2-explore-paths.spec.ts index 405bb35..5961320 100644 --- a/apps/user-h5/e2e/p2-explore-paths.spec.ts +++ b/apps/user-h5/e2e/p2-explore-paths.spec.ts @@ -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() }) diff --git a/apps/user-h5/e2e/portrait-main-path.spec.ts b/apps/user-h5/e2e/portrait-main-path.spec.ts index 1829c02..5bcc7b2 100644 --- a/apps/user-h5/e2e/portrait-main-path.spec.ts +++ b/apps/user-h5/e2e/portrait-main-path.spec.ts @@ -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() }) diff --git a/apps/user-h5/playwright.config.ts b/apps/user-h5/playwright.config.ts index 6b89baa..288077b 100644 --- a/apps/user-h5/playwright.config.ts +++ b/apps/user-h5/playwright.config.ts @@ -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', }, diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 551e92b..eb18fc4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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) diff --git a/docs/TEST_REPORT/ECR-001-phaseF-qa.md b/docs/TEST_REPORT/ECR-001-phaseF-qa.md new file mode 100644 index 0000000..e093c0f --- /dev/null +++ b/docs/TEST_REPORT/ECR-001-phaseF-qa.md @@ -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 已在合入前修完 +- 残留 nits:Scale 交互单测仍缺;Relation/ImageCard router-link stub warn;vue-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 e2e(mock 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