import { defineConfig } from '@playwright/test'; // Where browsers run and how the app is addressed: // (default) browsers on the shared remote Playwright server (Docker, 192.168.1.4:3000); // app local via webServer; baseURL = this box's LAN IP because pages load // from the remote browser's perspective. // E2E_LOCAL=1 everything local — browsers here, localhost baseURL (fallback when B is down). // E2E_REMOTE=1 runner not on this box: skip webServer; pair with E2E_BASE_URL if needed. const local = process.env.E2E_LOCAL === '1'; const remoteRunner = process.env.E2E_REMOTE === '1'; if (!local && !process.env.PW_TEST_CONNECT_WS_ENDPOINT) { process.env.PW_TEST_CONNECT_WS_ENDPOINT = 'ws://192.168.1.4:3000/'; } export default defineConfig({ testDir: './e2e', timeout: 30_000, retries: 1, use: { baseURL: process.env.E2E_BASE_URL ?? (local ? 'http://localhost:3000' : 'http://192.168.1.26:3000'), trace: 'on-first-retry', }, webServer: remoteRunner ? undefined : { command: 'npm run dev', url: 'http://localhost:3000/api/airports', reuseExistingServer: true, timeout: 120_000, }, });