fix: accessibility improvements and test infrastructure hardening

Add aria-labels to form controls (selects, checkboxes, switches), set
html lang attribute and page title, fix color contrast for --candle-dim
and --text-faint tokens, underline inline links, remove opacity hack.
Harden dev login endpoints with atomic findOneAndUpdate and tokenVersion
in JWT. Update Playwright timeouts and E2E test helpers.
This commit is contained in:
Jennie Robinson Faber 2026-04-05 21:59:02 +01:00
parent 61c16d8bac
commit c40f2c7c63
35 changed files with 787 additions and 173 deletions

View file

@ -5,17 +5,27 @@
/**
* Login as admin via the dev test-login endpoint.
* Creates a test admin user if none exists.
* Creates a test admin user if none exists and sets the auth cookie.
* Handles cases where the dev server is slow to redirect under load.
*/
export async function loginAsAdmin(page) {
await page.goto('/api/dev/test-login')
await page.waitForURL('**/admin**')
await page.goto('/api/dev/test-login', { waitUntil: 'domcontentloaded' })
// The endpoint sets the cookie and redirects to /admin.
// Under heavy parallel load the redirect may not complete, so fall back to manual navigation.
try {
await page.waitForURL(/\/admin/, { timeout: 15000 })
} catch {
// Cookie should be set even if redirect failed — navigate manually
await page.goto('/admin', { waitUntil: 'domcontentloaded' })
await page.waitForURL(/\/admin/)
}
}
/**
* Login as a specific member by email via the dev member-login endpoint.
*/
export async function loginAsMember(page, email) {
await page.goto(`/api/dev/member-login?email=${encodeURIComponent(email)}`)
await page.waitForURL('**/member/**')
await page.goto(`/api/dev/member-login?email=${encodeURIComponent(email)}`, { waitUntil: 'domcontentloaded' })
await page.waitForURL(/\/member\//)
}