Files
touchbase/playwright.config.ts

36 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

import { defineConfig, devices } from "@playwright/test";
// Dedicated test port — keeps the e2e server isolated from any `pnpm dev`
// the user might have running, and pins it against the touchbase_test DB
// (loaded from .env.test in the webServer command below).
const PORT = Number(process.env.E2E_PORT ?? 3010);
const BASE_URL = process.env.E2E_BASE_URL ?? `http://localhost:${PORT}`;
export default defineConfig({
testDir: "./e2e",
fullyParallel: false,
retries: 0,
workers: 1,
reporter: [["list"]],
timeout: 30_000,
expect: { timeout: 10_000 },
use: {
baseURL: BASE_URL,
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "off",
},
webServer: {
// dotenv-cli loads .env.test (DATABASE_URL=touchbase_test) for the child.
command: `pnpm exec dotenv -e .env.test -- next dev -p ${PORT}`,
url: `${BASE_URL}/api/health`,
reuseExistingServer: !process.env.CI,
timeout: 60_000,
stdout: "pipe",
stderr: "pipe",
},
projects: [
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
],
});