From c4c1cb400b92cbbd809205fb40fdf9fda2fafab0 Mon Sep 17 00:00:00 2001 From: kurihada Date: Tue, 3 Mar 2026 14:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=20E2E=20=E9=97=A8=E7=A6=81?= =?UTF-8?q?=E5=B9=B6=E5=9B=BA=E5=AE=9A=20Playwright=20=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 12 ++++++++++++ PROJECT_AUDIT_2026-03-03.md | 1 + README.md | 3 ++- TEST_SUPPLEMENT_PLAN_2026-03-03.md | 3 ++- package.json | 5 +++-- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 53ada8a..2aba3f4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,6 +32,18 @@ pipeline { } } + stage('E2E Gate') { + options { + timeout(time: 20, unit: 'MINUTES') + } + steps { + retry(2) { + sh 'npm run test:e2e:install' + } + sh 'npm run test:e2e' + } + } + stage('Build Docker Image') { steps { sh "docker build --build-arg NEXT_PUBLIC_AMAP_API_KEY=${AMAP_KEY} -t ${APP_NAME}:${BUILD_NUMBER} -t ${APP_NAME}:latest ." diff --git a/PROJECT_AUDIT_2026-03-03.md b/PROJECT_AUDIT_2026-03-03.md index ef38e05..2ca8d3f 100644 --- a/PROJECT_AUDIT_2026-03-03.md +++ b/PROJECT_AUDIT_2026-03-03.md @@ -247,6 +247,7 @@ - 结果:`npm run lint` => `0 errors / 0 warnings`。 - 任务 3(补 E2E 用例):✅ 已完成(代码已补齐) - 新增:`playwright.config.ts`、`e2e/home-navigation.spec.ts`、`e2e/panic-join.spec.ts`、`e2e/invite-join.spec.ts`。 + - CI 门禁:`Jenkinsfile` 已新增 `E2E Gate` 阶段,执行 `test:e2e:install` + `test:e2e`。 - 说明:当前环境无法访问 `registry.npmjs.org`,Playwright 依赖安装受限,`npm run test:e2e` 需在可联网环境执行。 --- diff --git a/README.md b/README.md index fe97555..de464a2 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,11 @@ npm test npm run test:coverage npm run lint npx tsc --noEmit +npm run test:e2e:install npm run test:e2e ``` -> `test:e2e` 使用 Playwright。当前仓库通过 `npx playwright test` 运行,在可联网环境会自动拉取所需依赖。 +> `test:e2e` 使用 Playwright(固定 `1.51.1` 版本)。首次执行需要网络下载 Playwright CLI 与 Chromium。 ## Project Structure diff --git a/TEST_SUPPLEMENT_PLAN_2026-03-03.md b/TEST_SUPPLEMENT_PLAN_2026-03-03.md index 51fed10..77ad4c3 100644 --- a/TEST_SUPPLEMENT_PLAN_2026-03-03.md +++ b/TEST_SUPPLEMENT_PLAN_2026-03-03.md @@ -74,7 +74,8 @@ 1. `npm run test:e2e` 通过。 - 完成记录: 1. 已补齐 Playwright 配置与 3 条 E2E 用例(2026-03-03)。 -2. 当前环境无法访问 `registry.npmjs.org`,无法在线安装 Playwright 依赖,`test:e2e` 待在可联网环境执行。 +2. Jenkins 已接入 E2E 门禁(`test:e2e:install` + `test:e2e`)(2026-03-03)。 +3. 当前本地环境无法访问 `registry.npmjs.org`,无法在线安装 Playwright 依赖,`test:e2e` 待在可联网环境执行。 ## 状态追踪 - T1:已完成(2026-03-03) diff --git a/package.json b/package.json index 789d7c3..2f8ee3f 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,9 @@ "test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage", - "test:e2e": "npx playwright test", - "test:e2e:headed": "npx playwright test --headed" + "test:e2e:install": "npx -y playwright@1.51.1 install chromium", + "test:e2e": "npx -y playwright@1.51.1 test", + "test:e2e:headed": "npx -y playwright@1.51.1 test --headed" }, "dependencies": { "@dnd-kit/core": "^6.3.1",