deadhead-space-freight-tycoon/apps/web/playwright.config.ts

36 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig, devices } from "@playwright/test";
const WEB_PORT = 4173;
const WEB = `http://127.0.0.1:${WEB_PORT}`;
/** The production build (no developer tools), for checking what it loads (Step 14.11). */
export const PRODUCTION_PORT = 4174;
/**
* Browser tests against the web build alone (Phases 11–12, CR-014): the game
* runs in the page, saved in IndexedDB. Build with `pnpm build:e2e` first: it
* makes the test build (developer tools and the `window.deadhead` test hook on)
* and, in dist-production, the production build. The tests move the
* game clock with the developer offset, so they run one at a time.
*/
export default defineConfig({
testDir: "e2e",
testMatch: "**/*.e2e.ts",
workers: 1,
fullyParallel: false,
retries: process.env.CI ? 1 : 0,
timeout: 120_000,
use: { baseURL: WEB, ...devices["Desktop Chrome"] },
webServer: [
{
command: `pnpm exec vite preview --port ${WEB_PORT} --strictPort --host 127.0.0.1`,
url: WEB,
reuseExistingServer: !process.env.CI,
},
{
command: `pnpm exec vite preview --outDir dist-production --port ${PRODUCTION_PORT} --strictPort --host 127.0.0.1`,
url: `http://127.0.0.1:${PRODUCTION_PORT}`,
reuseExistingServer: !process.env.CI,
},
],
});