import { defineConfig, devices } from "@playwright/test"; import { mkdtempSync } from "node:fs"; import os from "node:os"; import path from "node:path"; // Every E2E run must start from an uninitialized ledger. A unique temporary // directory keeps the login smoke test independent of previous runs. const e2eDataDir = mkdtempSync(path.join(os.tmpdir(), "tallynote-e2e-")); const e2ePort = Number(process.env.TALLYNOTE_E2E_PORT ?? 3400); export default defineConfig({ testDir: "./tests/e2e", timeout: 30_000, use: { baseURL: `http://127.0.0.1:${e2ePort}`, trace: "retain-on-failure", ...devices["Desktop Chrome"], }, webServer: { command: "node dist/server/index.js", url: `http://127.0.0.1:${e2ePort}/health`, reuseExistingServer: false, timeout: 120_000, env: { NODE_ENV: "production", TALLYNOTE_HOST: "127.0.0.1", TALLYNOTE_PORT: String(e2ePort), TALLYNOTE_PUBLIC_ORIGIN: `http://127.0.0.1:${e2ePort}`, TALLYNOTE_COOKIE_SECURE: "false", TALLYNOTE_DATA_DIR: e2eDataDir, }, }, });