Files
jobtrackingapp/job-tracker-ui/playwright.auth-recovery.config.ts
T

67 lines
2.5 KiB
TypeScript

import { defineConfig } from "@playwright/test";
import os from "node:os";
import path from "node:path";
import base from "./playwright.config";
// Run sequentially after the ordinary native suite. Real Identity + SMTP, fresh
// synthetic SQLite and keys; no provider calls or test-only product endpoints.
if (!Array.isArray(base.webServer)) throw new Error("Native server definitions are required.");
const [backend, app] = base.webServer;
const smtpPort = process.env.AUTH_RECOVERY_SMTP_PORT ?? "2527";
const mailPort = process.env.AUTH_RECOVERY_MAIL_PORT ?? "5303";
const nodeCommand = `"${process.execPath.replaceAll('"', '\\"')}"`;
const captureCommand = `"${path.resolve("scripts/localSMTPfixture.mjs").replaceAll('"', '\\"')}"`;
export default defineConfig({
testDir: "./auth-tests",
workers: 1,
fullyParallel: false,
retries: 0,
timeout: 120_000,
use: { ...base.use, baseURL: "http://localhost:3300" },
projects: base.projects,
webServer: [
{
command: `${nodeCommand} ${captureCommand}`,
url: `http://127.0.0.1:${mailPort}/health`,
timeout: 20_000,
reuseExistingServer: false,
env: { AUTH_RECOVERY_SMTP_PORT: smtpPort, AUTH_RECOVERY_MAIL_PORT: mailPort },
},
{
...backend,
reuseExistingServer: false,
env: {
...backend.env,
Data__Root: path.join(os.tmpdir(), `jobtracker-auth-recovery-${process.pid}-${Date.now().toString(36)}`),
App__PublicBaseUrl: "http://localhost:3300",
Auth__AllowRegistration: "true",
Auth__RequireEmailVerification: "true",
Auth__GoogleClientId: "",
Auth__MicrosoftClientId: "",
Turnstile__SiteKey: "",
Turnstile__SecretKey: "",
Email__Enabled: "true",
Email__SmtpHost: "127.0.0.1",
Email__SmtpPort: smtpPort,
Email__SmtpUser: "",
Email__SmtpPassword: "",
Email__From: "capture@example.test",
Email__FromName: "Local recovery test",
Email__SmtpEnableSsl: "false",
Email__SmtpTimeoutMs: "5000",
Ai__BaseUrl: "http://127.0.0.1:1",
Stripe__SecretKey: "",
Backups__Enabled: "false",
Workers__AiOperationsEnabled: "false",
Workers__RulesEnabled: "false",
Workers__FollowUpRemindersEnabled: "false",
Workers__DailyExportEnabled: "false",
Workers__JobEnrichmentEnabled: "false",
Workers__SavedJobSearchAlertsEnabled: "false",
},
},
{ ...app, reuseExistingServer: false },
],
});