- M package.json — added typecheck, test:e2e, verify scripts; added @playwright/test devDep - M pnpm-lock.yaml - M .gitignore — Playwright artifacts - M tsconfig.json — auto-modified by Next.js include path - ?? e2e/ — config + fixtures + 3 specs - ?? playwright.config.ts - ?? scripts/verify.sh, scripts/db-test-truncate.sql
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
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"] } },
|
|
],
|
|
});
|