import { defineConfig, devices } from "@playwright/test"; import { reservePort, RUN_OUTPUT_ROOT_VARIABLE, TEST_PORT_VARIABLES, testRunPath, testRunRoot, } from "./scripts/lib/run-isolation.ts"; // 1105/12-04. With TEST_RUN_ID set, this run's results, report and the build // its preview serves are under .tmp/runs// (scripts/lib/run-isolation.ts), // so a second run in the same checkout neither empties this run's dist nor // deletes its results. Unset, the paths are artifacts/tests/e2e/* and dist, // which FE-GATE-008 and the CI upload read. The preview listens on a free // port (TEST_E2E_PORT pins one); a fixed 4173 made the second run fail with // "is already used". const dist = testRunPath("dist"); const port = await reservePort(TEST_PORT_VARIABLES.e2e); const origin = `http://127.0.0.1:${port}`; export default defineConfig({ testDir: "./tests/e2e", // Fixture specs build a repository copy once for the run, not once per // browser project (tests/e2e/support/shared-fixture-builds.ts). globalSetup: "./tests/e2e/support/e2e-global-setup.ts", forbidOnly: true, outputDir: testRunPath("artifacts/tests/e2e/results"), reporter: [ ["list"], ["html", { outputFolder: testRunPath("artifacts/tests/e2e/report"), open: "never" }], ["junit", { outputFile: testRunPath("artifacts/tests/e2e/results.xml") }], ], use: { baseURL: origin, trace: "retain-on-failure", screenshot: "only-on-failure", }, webServer: { env: { [RUN_OUTPUT_ROOT_VARIABLE]: testRunRoot() }, command: `corepack pnpm build && corepack pnpm preview --host 127.0.0.1 --port ${port} --strictPort --outDir ${dist}`, url: origin, reuseExistingServer: false, }, projects: [ { name: "chromium", testIgnore: "**/compact-smoke.spec.ts", use: { ...devices["Desktop Chrome"] }, }, { name: "firefox", testIgnore: "**/compact-smoke.spec.ts", use: { ...devices["Desktop Firefox"] }, }, { name: "webkit", testIgnore: "**/compact-smoke.spec.ts", use: { ...devices["Desktop Safari"] }, }, { name: "chromium-compact", testMatch: "**/compact-smoke.spec.ts", use: { ...devices["Desktop Chrome"], viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true, }, }, ], });