test: authenticated admin E2E suite + accessibility + visual regression baselines

- Global setup: authenticates as admin, saves storageState for reuse
- playwright.config.ts: 3 projects (setup, authenticated, unauthenticated)
- authenticated-admin.spec.ts: 16 admin pages tested with real auth session
- accessibility.spec.ts: axe-core scans on all admin, public, and portal pages
- visual-regression.spec.ts: dark mode baselines for key pages (toHaveScreenshot)
- @axe-core/playwright added as devDependency
- .gitignore updated: excludes .auth/ and test-results/

Full suite: 262 tests passing (setup:1, authenticated:52, unauthenticated:209)
This commit is contained in:
Patrick Plate
2026-06-13 22:30:29 +02:00
parent aabde17532
commit cfb38e8fc6
8 changed files with 774 additions and 1 deletions
+25 -1
View File
@@ -1,4 +1,7 @@
import { defineConfig } from "@playwright/test"
import path from "path"
const authFile = path.join(__dirname, "e2e", ".auth", "admin.json")
export default defineConfig({
testDir: "./e2e",
@@ -12,6 +15,27 @@ export default defineConfig({
navigationTimeout: 60_000,
actionTimeout: 30_000,
},
projects: [{ name: "chromium", use: { browserName: "chromium" } }],
projects: [
{
name: "setup",
testMatch: /global-setup\.ts/,
},
{
name: "authenticated",
testMatch:
/authenticated-admin|visual-regression|accessibility/,
dependencies: ["setup"],
use: {
storageState: authFile,
browserName: "chromium",
},
},
{
name: "unauthenticated",
testMatch:
/functional-flows|full-check|user-story-tests|system-test|staff-management|screenshot-tour|authenticated-tour/,
use: { browserName: "chromium" },
},
],
outputDir: "./e2e/test-results",
})