From 537d515df900ee6fdc89fd8545ba515df53333da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Wed, 25 Mar 2026 01:44:12 +0100 Subject: [PATCH] Run E2E tests against production build in CI In CI, Playwright now starts apps with production commands (react-router- serve, node --experimental-strip-types) instead of dev servers. This catches runtime issues like missing exports and import resolution errors before deploy. Locally, dev servers are still used for fast iteration. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 3 +++ playwright.config.ts | 39 +++++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19a57c7..7487db2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,6 +175,9 @@ jobs: if: steps.playwright-cache.outputs.cache-hit == 'true' run: pnpm exec playwright install-deps chromium + - name: Build for production + run: pnpm build + - name: Run E2E tests run: pnpm test:e2e env: diff --git a/playwright.config.ts b/playwright.config.ts index 410e250..b8a79dc 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -39,16 +39,31 @@ export default defineConfig({ }, }, ], - webServer: [ - { - command: "pnpm --filter @trails-cool/journal dev", - url: "http://localhost:3000", - reuseExistingServer: !process.env.CI, - }, - { - command: "pnpm --filter @trails-cool/planner dev", - url: "http://localhost:3001", - reuseExistingServer: !process.env.CI, - }, - ], + webServer: process.env.CI + ? [ + { + command: "npx react-router-serve ./build/server/index.js", + url: "http://localhost:3000", + cwd: "./apps/journal", + reuseExistingServer: false, + }, + { + command: "node --experimental-strip-types server.ts", + url: "http://localhost:3001", + cwd: "./apps/planner", + reuseExistingServer: false, + }, + ] + : [ + { + command: "pnpm --filter @trails-cool/journal dev", + url: "http://localhost:3000", + reuseExistingServer: true, + }, + { + command: "pnpm --filter @trails-cool/planner dev", + url: "http://localhost:3001", + reuseExistingServer: true, + }, + ], });