接入 E2E 门禁并固定 Playwright 执行版本

This commit is contained in:
2026-03-03 14:06:40 +08:00
parent fe3016d710
commit c4c1cb400b
5 changed files with 20 additions and 4 deletions
Vendored
+12
View File
@@ -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') { stage('Build Docker Image') {
steps { steps {
sh "docker build --build-arg NEXT_PUBLIC_AMAP_API_KEY=${AMAP_KEY} -t ${APP_NAME}:${BUILD_NUMBER} -t ${APP_NAME}:latest ." sh "docker build --build-arg NEXT_PUBLIC_AMAP_API_KEY=${AMAP_KEY} -t ${APP_NAME}:${BUILD_NUMBER} -t ${APP_NAME}:latest ."
+1
View File
@@ -247,6 +247,7 @@
- 结果:`npm run lint` => `0 errors / 0 warnings` - 结果:`npm run lint` => `0 errors / 0 warnings`
- 任务 3(补 E2E 用例):✅ 已完成(代码已补齐) - 任务 3(补 E2E 用例):✅ 已完成(代码已补齐)
- 新增:`playwright.config.ts``e2e/home-navigation.spec.ts``e2e/panic-join.spec.ts``e2e/invite-join.spec.ts` - 新增:`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` 需在可联网环境执行。 - 说明:当前环境无法访问 `registry.npmjs.org`Playwright 依赖安装受限,`npm run test:e2e` 需在可联网环境执行。
--- ---
+2 -1
View File
@@ -59,10 +59,11 @@ npm test
npm run test:coverage npm run test:coverage
npm run lint npm run lint
npx tsc --noEmit npx tsc --noEmit
npm run test:e2e:install
npm run test:e2e npm run test:e2e
``` ```
> `test:e2e` 使用 Playwright。当前仓库通过 `npx playwright test` 运行,在可联网环境会自动拉取所需依赖 > `test:e2e` 使用 Playwright(固定 `1.51.1` 版本)。首次执行需要网络下载 Playwright CLI 与 Chromium
## Project Structure ## Project Structure
+2 -1
View File
@@ -74,7 +74,8 @@
1. `npm run test:e2e` 通过。 1. `npm run test:e2e` 通过。
- 完成记录: - 完成记录:
1. 已补齐 Playwright 配置与 3 条 E2E 用例(2026-03-03)。 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 - T1:已完成(2026-03-03
+3 -2
View File
@@ -10,8 +10,9 @@
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:coverage": "vitest run --coverage", "test:coverage": "vitest run --coverage",
"test:e2e": "npx playwright test", "test:e2e:install": "npx -y playwright@1.51.1 install chromium",
"test:e2e:headed": "npx playwright test --headed" "test:e2e": "npx -y playwright@1.51.1 test",
"test:e2e:headed": "npx -y playwright@1.51.1 test --headed"
}, },
"dependencies": { "dependencies": {
"@dnd-kit/core": "^6.3.1", "@dnd-kit/core": "^6.3.1",