yap-blog/playwright.config.ts
2026-07-02 21:32:33 -04:00

31 lines
853 B
TypeScript

import "dotenv/config";
import { defineConfig, devices } from "@playwright/test";
const E2E_DATABASE_URL =
process.env.E2E_DATABASE_URL || "postgresql://blog:blog@localhost:5434/blog_e2e";
const PORT = 3100;
export default defineConfig({
testDir: "./tests/e2e",
fullyParallel: false,
workers: 1,
reporter: [["list"]],
timeout: 60_000,
use: {
baseURL: `http://localhost:${PORT}`,
trace: "retain-on-failure",
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
webServer: {
// Requires a prior `next build`; `npm run test:e2e` chains both.
command: `npx next start --port ${PORT}`,
url: `http://localhost:${PORT}/posts`,
reuseExistingServer: false,
timeout: 60_000,
env: {
...(process.env as Record<string, string>),
DATABASE_URL: E2E_DATABASE_URL,
},
},
});