diff --git a/playwright.config.ts b/playwright.config.ts index 8a9a4f28d..1ee341f56 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -33,6 +33,14 @@ export default defineConfig({ trace: "retain-on-failure", screenshot: "only-on-failure", video: "retain-on-failure", + // HealthLog ships dark mode as the default (Dracula theme) — `globals.css` + // sets `color-scheme: dark` on the root and the `` defaults + // to "system". Playwright's stock context is `colorScheme: "light"`, which + // means axe-core was scanning a layout users never actually see (Dracula + // greens on a light card → 1.18 contrast). Forcing the test theme to dark + // matches what real users render on first paint and is the only honest + // a11y baseline for this app. + colorScheme: "dark", }, projects: [ @@ -41,6 +49,7 @@ export default defineConfig({ use: { ...devices["Desktop Chrome"], viewport: { width: 1280, height: 720 }, + colorScheme: "dark", }, }, { @@ -51,6 +60,7 @@ export default defineConfig({ // webkit. iPhone-13 is intentionally avoided here; the // mobile-Safari smoke is exercised by the iOS app suite. ...devices["Pixel 5"], + colorScheme: "dark", }, }, ], diff --git a/src/components/admin/__tests__/user-management-responsive.test.tsx b/src/components/admin/__tests__/user-management-responsive.test.tsx new file mode 100644 index 000000000..76837f560 --- /dev/null +++ b/src/components/admin/__tests__/user-management-responsive.test.tsx @@ -0,0 +1,128 @@ +import { describe, expect, it, vi } from "vitest"; +import { renderToStaticMarkup } from "react-dom/server"; + +/** + * Phase A5 / B-mobile CRITICAL #2 — `/admin/users` mobile layout. + * + * The audit at 393 CSS px showed the desktop table (6 cols × N rows) + * truncating the role badge ("ADMI", "USE") and pushing the action + * column entirely off the right edge — the destructive force-logout + * action was unreachable on mobile. + * + * Fix: render the desktop table only at `≥ md`, and on `< md` paint + * a card-list (`