From 3b4c9cfddfc2eff4cb6a8829d403a391ea669cc0 Mon Sep 17 00:00:00 2001 From: weichen Date: Fri, 18 Sep 2026 03:02:06 +0000 Subject: [PATCH] test(web): add npm scripts for all e2e specs; retire redundant revision smoke Eliminate DOCREV_E2E_BASE_URL dual gating by deleting the one-assert smoke spec covered by document-revision-runtime UI-10, and expose per-spec scripts. Co-authored-by: Cursor --- web/e2e/README.md | 20 ++++++++++++++++++++ web/e2e/document-revision.spec.ts | 14 -------------- web/package.json | 10 +++++++++- 3 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 web/e2e/README.md delete mode 100644 web/e2e/document-revision.spec.ts diff --git a/web/e2e/README.md b/web/e2e/README.md new file mode 100644 index 00000000..4ac20830 --- /dev/null +++ b/web/e2e/README.md @@ -0,0 +1,20 @@ +# Playwright E2E 入口矩阵 + +默认 `playwright test` / `npm run test:e2e:list` 只枚举用例,**不实跑**(各 spec 内部有门禁 skip)。 + +| Spec | 门禁变量 | npm 脚本 | 备注 | +|------|----------|----------|------| +| `document-revision-runtime.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:ui-acceptance` | 主 UI-acceptance(含版本历史 UI-10) | +| `admin-console.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:e2e:admin-console` | 需管理员账号 | +| `controlled-document-reload.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:e2e:controlled-document-reload` | | +| `governance-action-level-authz.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:e2e:governance-action-level-authz` | | +| `intent-plan-cards.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:e2e:intent-plan-cards` | | +| `project143-regression.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:e2e:project143-regression` | 项目 143 只读 | +| `workflow-plan-409-frozen-duties.spec.ts` | `RUN_UI_ACCEPTANCE=1` | `npm run test:e2e:workflow-plan-409-frozen-duties` | | +| `conversation-intent-dual-tab.spec.ts` | `INTENT_DUAL_TAB=1` | `npm run test:e2e:conversation-intent-dual-tab` | 独立双标签风险口径 | + +约定: + +- `playwright test --list` 期望:**29 tests in 8 files**(Wave 3 退役冗余 `document-revision.spec.ts` / 消灭 `DOCREV_E2E_BASE_URL`)。 +- 新增 spec 必须同时补本表与 `package.json` 脚本。 +- 不升 `MULTI_INTENT_PLAN_TIER`;不触碰项目 143 写路径。 diff --git a/web/e2e/document-revision.spec.ts b/web/e2e/document-revision.spec.ts deleted file mode 100644 index 4557cebe..00000000 --- a/web/e2e/document-revision.spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test, expect } from '@playwright/test'; - -/** - * Smoke coverage for DOCREV toolbar / compare entry points. - * Full dual-user conflict E2E requires authenticated env fixtures. - */ -test.describe('document revision UI', () => { - test.skip(!process.env.DOCREV_E2E_BASE_URL, 'set DOCREV_E2E_BASE_URL to run'); - - test('toolbar renders version history control', async ({ page }) => { - await page.goto(process.env.DOCREV_E2E_BASE_URL!); - await expect(page.getByRole('button', { name: '版本历史' })).toBeVisible({ timeout: 30_000 }); - }); -}); diff --git a/web/package.json b/web/package.json index 89f3d531..4930e6c5 100644 --- a/web/package.json +++ b/web/package.json @@ -8,7 +8,15 @@ "build": "tsc && vite build && node scripts/precompress-dist.mjs", "preview": "vite preview", "test": "tsx --test \"src/**/!(*InteractiveCard*|*chatWindowArtifact*|*deliverableSync*).test.ts\" && vitest run src/components/chat/InteractiveCard.test.ts src/components/chat/chatWindowArtifact.test.ts src/components/chat/deliverableSync.test.ts", - "test:ui-acceptance": "RUN_UI_ACCEPTANCE=1 playwright test e2e/document-revision-runtime.spec.ts --project=chromium" + "test:ui-acceptance": "RUN_UI_ACCEPTANCE=1 playwright test e2e/document-revision-runtime.spec.ts --project=chromium", + "test:e2e:admin-console": "RUN_UI_ACCEPTANCE=1 playwright test e2e/admin-console.spec.ts --project=chromium", + "test:e2e:controlled-document-reload": "RUN_UI_ACCEPTANCE=1 playwright test e2e/controlled-document-reload.spec.ts --project=chromium", + "test:e2e:conversation-intent-dual-tab": "INTENT_DUAL_TAB=1 playwright test e2e/conversation-intent-dual-tab.spec.ts --project=chromium", + "test:e2e:governance-action-level-authz": "RUN_UI_ACCEPTANCE=1 playwright test e2e/governance-action-level-authz.spec.ts --project=chromium", + "test:e2e:intent-plan-cards": "RUN_UI_ACCEPTANCE=1 playwright test e2e/intent-plan-cards.spec.ts --project=chromium", + "test:e2e:project143-regression": "RUN_UI_ACCEPTANCE=1 playwright test e2e/project143-regression.spec.ts --project=chromium", + "test:e2e:workflow-plan-409-frozen-duties": "RUN_UI_ACCEPTANCE=1 playwright test e2e/workflow-plan-409-frozen-duties.spec.ts --project=chromium", + "test:e2e:list": "playwright test --list" }, "dependencies": { "@tanstack/react-virtual": "^3.14.11",