ci: run e2e on alternate ports (3100/3101) to avoid collision with prod stack on host runner
This commit is contained in:
@@ -135,6 +135,14 @@ jobs:
|
|||||||
INITIAL_ADMIN_EMAIL: admin@example.com
|
INITIAL_ADMIN_EMAIL: admin@example.com
|
||||||
INITIAL_ADMIN_PASSWORD: testpassword123
|
INITIAL_ADMIN_PASSWORD: testpassword123
|
||||||
CI: "1"
|
CI: "1"
|
||||||
|
# The host runs the production stack on :3000/:3001; shift the e2e
|
||||||
|
# dev servers to :3100/:3101 so Playwright doesn't collide with prod.
|
||||||
|
VITE_PORT: "3100"
|
||||||
|
PORT: "3101"
|
||||||
|
API_PROXY_TARGET: http://localhost:3101
|
||||||
|
E2E_BASE_URL: http://localhost:3100
|
||||||
|
E2E_WEB_SERVER_CMD: bun run dev
|
||||||
|
E2E_WEB_SERVER_URL: http://localhost:3100/api/health
|
||||||
run: bunx playwright test
|
run: bunx playwright test
|
||||||
|
|
||||||
- name: Stop ephemeral Postgres
|
- name: Stop ephemeral Postgres
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --port 3000",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
port: 3000,
|
port: parseInt(process.env.VITE_PORT || "3000", 10),
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: "http://localhost:3001",
|
target: process.env.API_PROXY_TARGET || "http://localhost:3001",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/mcp": {
|
"/mcp": {
|
||||||
target: "http://localhost:3001",
|
target: process.env.API_PROXY_TARGET || "http://localhost:3001",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default defineConfig({
|
|||||||
timeout: 5_000,
|
timeout: 5_000,
|
||||||
},
|
},
|
||||||
use: {
|
use: {
|
||||||
baseURL: 'http://localhost:3000',
|
baseURL: process.env.E2E_BASE_URL || 'http://localhost:3000',
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
screenshot: 'only-on-failure',
|
screenshot: 'only-on-failure',
|
||||||
video: 'on-first-retry',
|
video: 'on-first-retry',
|
||||||
@@ -36,8 +36,10 @@ export default defineConfig({
|
|||||||
// `bun run dev` boots the API (:3001) and the Vite dev server (:3000) via
|
// `bun run dev` boots the API (:3001) and the Vite dev server (:3000) via
|
||||||
// concurrently. Poll the API health endpoint through the Vite proxy so we
|
// concurrently. Poll the API health endpoint through the Vite proxy so we
|
||||||
// don't start running tests until both servers are actually up.
|
// don't start running tests until both servers are actually up.
|
||||||
command: 'bun run dev',
|
// In CI the host runs the production stack on :3000/:3001, so shift to
|
||||||
url: 'http://localhost:3000/api/health',
|
// :3100/:3101 to avoid port collisions.
|
||||||
|
command: process.env.E2E_WEB_SERVER_CMD || 'bun run dev',
|
||||||
|
url: process.env.E2E_WEB_SERVER_URL || 'http://localhost:3000/api/health',
|
||||||
reuseExistingServer: !CI,
|
reuseExistingServer: !CI,
|
||||||
timeout: 120_000,
|
timeout: 120_000,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user