From 5ed0993f74031b8c6b07e5f7e4e6cf3d67a7c11c Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Mon, 4 May 2026 17:34:53 +0700 Subject: [PATCH] fix: stabilize e2e server startup --- playwright.config.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index f488194..f2eec1f 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -7,11 +7,13 @@ if (!process.env.CI) { config({ path: path.resolve(__dirname, '.env.test'), override: true }); } -// Server ports — configurable via env to avoid conflicts with dev containers. -// Defaults match .env.test (3011/3010); GitHub Actions uses 3001/3000. +// Server ports are configurable via env to avoid conflicts with dev containers. +// GitHub Actions loads .env.test before invoking Playwright. const API_PORT = process.env.API_PORT ?? '3001'; const WEB_PORT = process.env.WEB_PORT ?? '3000'; +const SERVER_STARTUP_TIMEOUT_MS = process.env.CI ? 180_000 : 60_000; + /** * Playwright E2E configuration for Goodgo Platform. * @@ -92,7 +94,7 @@ export default defineConfig({ command: `PORT=${API_PORT} pnpm --filter @goodgo/api run dev`, url: `http://localhost:${API_PORT}/api/v1/docs`, reuseExistingServer: !process.env.CI, - timeout: 60_000, + timeout: SERVER_STARTUP_TIMEOUT_MS, env: { ...process.env as Record, NODE_ENV: 'test', @@ -105,7 +107,7 @@ export default defineConfig({ cwd: './apps/web', url: `http://localhost:${WEB_PORT}`, reuseExistingServer: !process.env.CI, - timeout: 30_000, + timeout: SERVER_STARTUP_TIMEOUT_MS, env: { ...process.env as Record, PORT: WEB_PORT,