diff --git a/tests/e2e/wdio.conf.js b/tests/e2e/wdio.conf.js index 395d34a..7448ca4 100644 --- a/tests/e2e/wdio.conf.js +++ b/tests/e2e/wdio.conf.js @@ -112,6 +112,24 @@ export const config = { } } catch { /* no process on port — good */ } + // CRITICAL: The debug binary has devUrl (localhost:9700) baked in. + // If another app (e.g., BridgeCoach) is serving on that port, the Tauri + // WebView loads the WRONG frontend. Fail fast if port 9700 is in use. + const DEV_URL_PORT = 9700; + try { + const devPids = execSync(`lsof -ti:${DEV_URL_PORT} 2>/dev/null`, { encoding: 'utf8' }).trim(); + if (devPids) { + throw new Error( + `Port ${DEV_URL_PORT} (Tauri devUrl) is in use by another process (PIDs: ${devPids}). ` + + `The debug binary will load that app instead of Agent Orchestrator frontend. ` + + `Either stop the process on port ${DEV_URL_PORT}, or use a release build.` + ); + } + } catch (e) { + if (e.message.includes('Port 9700')) throw e; + // lsof returned non-zero = port is free, good + } + // Verify binary exists if (!existsSync(tauriBinary)) { if (process.env.SKIP_BUILD) {