diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.ts index 9301772..e511135 100644 --- a/e2e/playwright.config.ts +++ b/e2e/playwright.config.ts @@ -4,7 +4,10 @@ import path from 'path'; // Use 127.0.0.1 explicitly — on Node.js 18+/Windows, `localhost` may resolve to ::1 // (IPv6) while the HTTP server only binds to 0.0.0.0 (IPv4), causing the webServer // readiness poll to time out even though the server is listening. -const BASE_URL = process.env.E2E_BASE_URL ?? 'http://127.0.0.1:3001'; +// Port 3099 avoids conflicts with locally running Docker containers on 3001-3003. +// Override with E2E_PORT env var if needed. +const E2E_PORT = process.env.E2E_PORT ?? '3099'; +const BASE_URL = process.env.E2E_BASE_URL ?? `http://127.0.0.1:${E2E_PORT}`; // Server env vars injected for local runs. In CI these are set at the step level. const serverEnv: Record = { @@ -15,6 +18,7 @@ const serverEnv: Record = { HTTP_REMOTE_USER_ENABLED: 'true', HTTP_REMOTE_USER_HEADER_NAME: 'remote-user', HTTP_REMOTE_TRUSTED_IPS: process.env.HTTP_REMOTE_TRUSTED_IPS ?? '127.0.0.1,::1,::ffff:127.0.0.1', + PORT: E2E_PORT, }; if (process.env.REDIS_HOST) { serverEnv.REDIS_HOST = process.env.REDIS_HOST; @@ -50,7 +54,7 @@ export default defineConfig({ cwd: path.resolve(__dirname, '../server'), // Poll a dedicated health endpoint — polling '/' can stall in Express 5 when // server/public/ doesn't exist in the working directory (no finalhandler match). - url: `http://127.0.0.1:3001/api/health`, + url: `http://127.0.0.1:${E2E_PORT}/api/health`, timeout: 15_000, reuseExistingServer: !process.env.CI, env: serverEnv, diff --git a/server/src/index.ts b/server/src/index.ts index e35e6d9..66193cf 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -201,9 +201,10 @@ app.use("/api/changelogs", changelogRoutes); app.use("/api/groups", groupRoutes); app.use("/api/stores", storeRoutes); -app.get('*splat', (_req, res) => { - res.sendFile(path.join(process.cwd(), 'public', 'index.html')); -}); +app.use(express.static(path.join(process.cwd(), 'public'))); +app.get('*splat', (_req, res) => { + res.sendFile(path.join(process.cwd(), 'public', 'index.html')); +}); // Middleware pro zpracování chyb app.use((err: any, req: any, res: any, next: any) => {