Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions ui/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ const LIVE_COMMAND = `yarn dev --port ${LIVE_PORT}`;
/** A pre-bundle cache per server, so one server's re-optimize cannot delete another's. */
const ownCache = (port: number) => ({ KAGENT_UI_DEV_CACHE_DIR: `node_modules/.vite/e2e-${port}` });

/**
* The mock servers serve a production build, so the suite tests the bundle that ships.
* Each gets its own `outDir`, because its env pins are inlined at build time.
*/
const serveBuild = (port: number) =>
`yarn vite build --outDir dist/e2e-${port} && yarn vite preview --outDir dist/e2e-${port} --port ${port}`;

export default defineConfig({
testDir: "./playwright/tests",
// Both servers have to be rendering, not merely listening, before any test
Expand Down Expand Up @@ -220,18 +227,18 @@ export default defineConfig({
]
: [
{
command: `yarn dev --port ${PORT}`,
command: serveBuild(PORT),
url: BASE_URL,
reuseExistingServer: false,
timeout: 120_000,
env: { ...BARE_APP, ...ownCache(PORT) },
env: BARE_APP,
},
{
command: `yarn dev --port ${EXTENSION_PORT}`,
command: serveBuild(EXTENSION_PORT),
url: EXTENSION_BASE_URL,
reuseExistingServer: false,
timeout: 120_000,
env: { ...EXAMPLE_APP, ...ownCache(EXTENSION_PORT) },
env: EXAMPLE_APP,
},
],
});
Loading