From e44140b8b8e57ba7d6b666f18c0c326326763c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Sun, 29 Mar 2026 11:22:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DE2E=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=B8=BA=E6=B5=8B=E8=AF=95=E6=9C=AC=E5=9C=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=80=8C=E9=9D=9E=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题根本原因: - E2E测试访问生产环境URL (https://novalon.cn) - 应该测试代码库中的代码,而非生产环境 - CI环境需要启动本地服务器进行测试 修复方案: - 更新playwright.config.tiered.ts配置 - baseURL改为 http://localhost:3000 - 添加webServer配置,自动启动本地服务器 - 更新CI配置 - 添加BASE_URL环境变量 - 先构建项目(npm run build) - 然后运行E2E测试 验证: - E2E测试将测试本地构建的代码 - 不依赖生产环境 Ralph Loop #8 完成 --- .woodpecker.yml | 8 ++++++-- e2e/playwright.config.tiered.ts | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index b3ac469..aec506f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -147,9 +147,13 @@ steps: environment: NODE_ENV: test CI: true + BASE_URL: http://localhost:3000 commands: - - echo "E2E tests temporarily disabled - requires production environment access" - - echo "Skipping e2e-standard step to allow pipeline to pass" + - npm ci + - npm run build + - cd e2e && npm ci + - cd e2e && npx playwright install chromium --with-deps + - cd e2e && npm run test:standard when: event: - push diff --git a/e2e/playwright.config.tiered.ts b/e2e/playwright.config.tiered.ts index 33b8764..174aad4 100644 --- a/e2e/playwright.config.tiered.ts +++ b/e2e/playwright.config.tiered.ts @@ -35,7 +35,7 @@ export default defineConfig({ ['list'] ], use: { - baseURL: process.env.BASE_URL || 'https://novalon.cn', + baseURL: process.env.BASE_URL || 'http://localhost:3000', trace: 'on-first-retry', screenshot: 'only-on-failure', video: 'retain-on-failure', @@ -43,6 +43,12 @@ export default defineConfig({ args: ['--disable-dev-shm-usage', '--no-sandbox'] } }, + webServer: process.env.CI ? { + command: 'npm run start', + port: 3000, + timeout: 120000, + reuseExistingServer: false, + } : undefined, projects: [ { name: 'chromium',