Files
ipal-kit/reference/playwright.config.ts
T
Radosław SmolińskiandClaude Fable 5.2 2cceceffd0 Mail relay: state block without an import-map entry, e2e on the reference site, sharper failure reports
- the state block is rendered by IntegrationStatusBanner (no new admin component: generate:importmap gives no diff)
- reference site: e2e/mail-relay.spec.ts with a fixture and setup script; e2e:built runs it with both bundlers
- a failed enrolment is reported as what it was; the service's own refusal after a fresh enrolment
- a message keeps its key after any failure that is not final
- a local site is shown as refused in the panel before any e-mail

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-25 21:14:47 +01:00

39 lines
1.7 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
// .env holds the E2E_* test values locally; CI passes them as env
try {
process.loadEnvFile('.env')
} catch {
// no .env (CI)
}
/**
* Smoke tests against a built, seeded site: pnpm seed && pnpm build.
* The 2FA verify limit (5 attempts per account in 10 minutes) is stored in the database; the global setup resets the
* test admins and clears their counts before every run (e2e/global-setup.ts; E2E_SKIP_ADMIN_SETUP=1 for a run that
* needs an EMPTY database, the fresh-site spec).
* E2E_BASE_URL picks the port (default 3100). Playwright starts its own server there and fails when the port is
* taken, so another project's dev server is never tested by mistake; E2E_REUSE_SERVER=1 uses a server you started.
*/
const baseURL = process.env.E2E_BASE_URL ?? 'http://localhost:3100'
export default defineConfig({
forbidOnly: !!process.env.CI,
// makes every run independent of the one before: test admins reset, stored 2FA attempt counts cleared
globalSetup: './e2e/global-setup.ts',
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
reporter: process.env.CI ? 'line' : 'list',
retries: process.env.CI ? 1 : 0,
testDir: './e2e',
use: { baseURL, trace: 'retain-on-failure' },
webServer: {
command: 'pnpm start',
// E2E_MAIL_RELAY_URL: the mail service's stand-in that e2e/mail-relay.spec.ts starts (nothing listens there otherwise,
// and the other specs send through the SMTP sink, so the site never calls it)
env: { E2E_MAIL_RELAY_URL: `http://127.0.0.1:${process.env.E2E_RELAY_PORT ?? 2527}/mail`, PORT: new URL(baseURL).port || '3000' },
reuseExistingServer: process.env.E2E_REUSE_SERVER === '1',
url: `${baseURL}/api/health`,
},
workers: 1,
})