test(e2e): add global setup, sign-in helpers and authenticated page tests

This commit is contained in:
2026-06-24 16:23:20 +02:00
parent a732e13ee8
commit 32b08245ca
4 changed files with 212 additions and 1 deletions

View File

@@ -2,10 +2,12 @@ import { defineConfig, devices } from "@playwright/test";
const port = process.env.PORT ?? "3100";
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? `http://127.0.0.1:${port}`;
const databaseFile = process.env.DATABASE_FILE ?? `/tmp/mal-e2e-${port}.db`;
export default defineConfig({
testDir: "./tests/e2e",
testMatch: "**/*.e2e.ts",
globalSetup: "./tests/e2e/global-setup.ts",
timeout: 30_000,
expect: { timeout: 5000 },
fullyParallel: true,
@@ -14,7 +16,7 @@ export default defineConfig({
webServer:
process.env.PLAYWRIGHT_BASE_URL === undefined
? {
command: `PORT=${port} DATABASE_FILE=/tmp/mal-e2e.db GIN_MODE=test go run ./cmd/server`,
command: `PORT=${port} DATABASE_FILE=${databaseFile} GIN_MODE=test go run ./cmd/server`,
url: baseURL,
reuseExistingServer: process.env.CI === undefined,
timeout: 120_000,