Files
lage-chat-control/tests/e2e/a11y.spec.ts
T
Aurealibe 8ebc1da9e4 Rebuild du site sur Astro : i18n multilingue, faits verifies, Docker, CI, tests
- Astro statique, EN par defaut + /fr/ + /nl/, detection langue navigateur
- i18n par fichiers JSON, ajouter une langue = ajouter des traductions
- Contenu original porte a l'identique (diff d'inventaire par langue)
- Chronologie legislative corrigee sur sources primaires (PE, Conseil, votes)
- Timeline 23 precedents + observatoire 35 items + annuaire 66 outils FOSS,
  chaque affirmation verifiee et sourcee
- Zero requete tierce (teste), lisible JS coupe, axe WCAG AA x2 themes
- Version offline monofichier par langue a chaque build
- Docker multi-stage vers nginx + CSP stricte auto-generee
- CI GitHub Actions (SHA-pinnees) + verification hebdo des liens
- CONTRIBUTING : divulgation d'affiliation obligatoire, allowlist de
  domaines testee en CI
2026-07-10 03:52:49 +01:00

25 lines
1.0 KiB
TypeScript

import AxeBuilder from '@axe-core/playwright'
import { expect, test } from '@playwright/test'
import { localePaths } from './helpers'
// WCAG 2 A/AA on every locale, in BOTH themes. The theme override is
// applied exactly like the boot script does (data-theme on <html>).
test.skip(({ javaScriptEnabled }) => javaScriptEnabled === false, 'axe needs JS')
for (const path of localePaths) {
for (const theme of ['light', 'dark'] as const) {
test(`axe WCAG A/AA · ${path} · ${theme}`, async ({ page }) => {
// documentElement doesn't exist yet at init-script time — go through
// localStorage, which the theme boot script applies before first paint.
await page.addInitScript((t) => {
localStorage.setItem('ecc-theme', t)
}, theme)
await page.goto(path)
const results = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa']).analyze()
expect(
results.violations.map((v) => `${v.id}: ${v.nodes.length} node(s) — ${v.help}`),
).toEqual([])
})
}
}