Skip to content

Commit 81440b8

Browse files
committed
refactor(web): use env var for Playwright port configuration
Use NEXT_PUBLIC_WEB_PORT env var in Playwright config instead of hardcoding port 3001. This allows Playwright to use the same port as the dev server and prevents conflicts when running tests locally. Also removed E2E_ENABLE_QUERY_FIXTURE env var since we removed that logic from production code in favor of Playwright's route mocking.
1 parent f6b38da commit 81440b8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

web/playwright.config.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { defineConfig, devices } from '@playwright/test'
22

3+
// Use the same port as the dev server, defaulting to 3000
4+
const PORT = process.env.NEXT_PUBLIC_WEB_PORT || '3000'
5+
const BASE_URL = `http://127.0.0.1:${PORT}`
6+
37
export default defineConfig({
48
testDir: './src/__tests__/e2e',
59
fullyParallel: true,
@@ -8,7 +12,7 @@ export default defineConfig({
812
workers: process.env.CI ? 1 : undefined,
913
reporter: 'html',
1014
use: {
11-
baseURL: 'http://127.0.0.1:3001',
15+
baseURL: BASE_URL,
1216
trace: 'on-first-retry',
1317
},
1418

@@ -28,11 +32,8 @@ export default defineConfig({
2832
],
2933

3034
webServer: {
31-
command: 'NEXT_PUBLIC_WEB_PORT=3001 bun run dev',
32-
url: 'http://127.0.0.1:3001',
35+
command: `NEXT_PUBLIC_WEB_PORT=${PORT} bun run dev`,
36+
url: BASE_URL,
3337
reuseExistingServer: !process.env.CI,
34-
env: {
35-
E2E_ENABLE_QUERY_FIXTURE: '1',
36-
},
3738
},
3839
})

0 commit comments

Comments
 (0)