From 4b1a4219dce40a9e0b4f13512d432cc388f19c88 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Tue, 10 Mar 2026 00:43:11 +0000 Subject: [PATCH] fix: start workflowui dev server for E2E tests in CI (Gate 2.2) - Add webServer config to e2e/playwright.config.ts: starts Next.js workflowui on port 3000 automatically when PLAYWRIGHT_BASE_URL is not set - Default baseURL changed to http://localhost:3000/workflowui/ (Next.js dev) - Override via PLAYWRIGHT_BASE_URL=http://localhost/workflowui/ for Docker stack - Add workspace build step before playwright in Gate 2.2 (packages needed by workflowui) - Fix playwright-report upload path (was frontends/nextjs/playwright-report/) Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/gated-pipeline.yml | 5 +++- e2e/playwright.config.ts | 34 ++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gated-pipeline.yml b/.github/workflows/gated-pipeline.yml index 9e3f321cc..dd246f2f7 100644 --- a/.github/workflows/gated-pipeline.yml +++ b/.github/workflows/gated-pipeline.yml @@ -762,6 +762,9 @@ jobs: with: node-version: '20' + - name: Build workspace packages + run: npm run build --workspaces --if-present 2>&1 || true + - name: Install Playwright Browsers run: npx playwright install --with-deps chromium @@ -778,7 +781,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: playwright-report - path: frontends/nextjs/playwright-report/ + path: playwright-report/ retention-days: 7 - name: Record validation result diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index 3a0817d06..92323af08 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -2,30 +2,44 @@ import { defineConfig, devices } from '@playwright/test'; /** * See https://playwright.dev/docs/test-configuration. + * + * baseURL resolution: + * CI / local dev server: http://localhost:3000/workflowui/ (Next.js dev, port 3000) + * Docker stack: http://localhost/workflowui/ (nginx, port 80) + * + * Override via PLAYWRIGHT_BASE_URL env var, e.g.: + * PLAYWRIGHT_BASE_URL=http://localhost/workflowui/ npx playwright test */ +const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000/workflowui/'; + export default defineConfig({ testDir: './', testMatch: '**/*.spec.ts', - /* Run tests in files in parallel */ fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, - /* Retry on CI only */ retries: process.env.CI ? 2 : 0, - /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: 'html', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: 'http://localhost/workflowui/', - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + baseURL, trace: 'on-first-retry', screenshot: 'only-on-failure', }, - /* Configure projects for major browsers */ + /* Start workflowui dev server automatically when not running against Docker stack */ + webServer: process.env.PLAYWRIGHT_BASE_URL ? undefined : { + command: 'npm run dev -w frontends/workflowui', + url: 'http://localhost:3000/workflowui/', + reuseExistingServer: !process.env.CI, + timeout: 120_000, + env: { + NODE_ENV: 'development', + NEXT_PUBLIC_API_URL: 'http://localhost:8080', + NEXTAUTH_SECRET: 'test-secret', + NEXTAUTH_URL: 'http://localhost:3000', + }, + }, + projects: [ { name: 'chromium',