Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(e2e): let E2E_PORT move the Playwright run off :3000

nirholasa6113184d220
diff --git a/playwright.config.js b/playwright.config.js
index f3f1628b7..9267c9e2c 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -33,6 +33,16 @@ function liveHomeSpecs() {
.sort();
}
+// The dev server this run drives. :3000 is the default, and reuse of a server
+// already there is how a developer runs this beside their own `npm run dev`.
+// E2E_PORT moves the whole run (baseURL, the server it starts, the specs that
+// open a bare browser) to another port, so an unattended run never touches a
+// server someone else owns. Published back to the environment because the
+// workers inherit it and play-photo-mode opens pages outside the fixture.
+const E2E_PORT = Number(process.env.E2E_PORT) || 3000;
+const E2E_ORIGIN = `http://localhost:${E2E_PORT}`;
+process.env.E2E_ORIGIN = E2E_ORIGIN;
+
export default defineConfig({
testDir: 'tests/e2e',
// The home lane's live journeys (the specs that import ./home-support.js)
@@ -50,15 +60,15 @@ export default defineConfig({
retries: 1,
fullyParallel: false,
use: {
- baseURL: 'http://localhost:3000',
+ baseURL: E2E_ORIGIN,
headless: true,
screenshot: 'only-on-failure',
video: 'retain-on-failure',
trace: 'retain-on-failure',
},
webServer: {
- command: 'npm run dev',
- url: 'http://localhost:3000',
+ command: E2E_PORT === 3000 ? 'npm run dev' : `npx vite --port ${E2E_PORT} --strictPort`,
+ url: E2E_ORIGIN,
timeout: 180_000,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
diff --git a/tests/e2e/coin-buy-trade.spec.js b/tests/e2e/coin-buy-trade.spec.js
index eb737064f..29d5735a5 100644
--- a/tests/e2e/coin-buy-trade.spec.js
+++ b/tests/e2e/coin-buy-trade.spec.js
@@ -168,7 +168,7 @@ async function installHarness(page, cfg) {
}
async function openTrade(page, coin) {
- await page.goto('http://localhost:3000/__e2e/trade-harness');
+ await page.goto('/__e2e/trade-harness');
await page.addStyleTag({ path: CC_CSS });
await page.evaluate(async (c) => {
const mod = await import('/src/game/coin-buy.js');
diff --git a/tests/e2e/play-photo-mode.spec.js b/tests/e2e/play-photo-mode.spec.js
index d57fffc55..3520c280a 100644
--- a/tests/e2e/play-photo-mode.spec.js
+++ b/tests/e2e/play-photo-mode.spec.js
@@ -18,7 +18,8 @@ import { test, expect, chromium, webkit } from '@playwright/test';
import { serveHarness, collectPageErrors } from './_support.js';
const HARNESS = '**/e2e/photo-mode';
-const URL = 'http://localhost:3000/e2e/photo-mode';
+const ORIGIN = process.env.E2E_ORIGIN || 'http://localhost:3000';
+const URL = `${ORIGIN}/e2e/photo-mode`;
// The synthetic world's clear colour, distinctive enough that finding it in the
// PNG proves the shot is the scene and not an empty buffer. Set from a hex
@@ -168,7 +169,7 @@ for (const engine of ENGINES) {
browser = await engine.type.launch();
// Pay the cold Vite transform of the three.js graph once, outside the
// tests, so the first assertion is not racing the build server.
- const warm = await browser.newPage({ baseURL: 'http://localhost:3000' });
+ const warm = await browser.newPage({ baseURL: ORIGIN });
await serveHarness(warm, HARNESS, { title: 'warm-up' });
await warm.addInitScript(RETRYING_IMPORT);
await warm.goto(URL);
@@ -181,7 +182,7 @@ for (const engine of ENGINES) {
test.afterAll(async () => { await browser?.close(); });
test.beforeEach(async () => {
- page = await browser.newPage({ baseURL: 'http://localhost:3000' });
+ page = await browser.newPage({ baseURL: ORIGIN });
errors = collectPageErrors(page);
await serveHarness(page, HARNESS, { title: 'photo mode harness' });
await page.addInitScript(RETRYING_IMPORT);