Files
lage-chat-control/tests/e2e/anchors.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

29 lines
1.1 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { expect, test } from '@playwright/test'
import { localePaths } from './helpers'
// Legacy deep links (/#messagerie, /#t-signal…) are shared all over the
// place — every anchor id from the old index.html must resolve on every
// locale page. The inventory is produced by migration/extract.mjs.
// Four legacy ids were toggle BUTTONS in the old chrome (never link
// targets, nothing on the web points at them) — the new chrome replaces
// them, so they are deliberately not preserved.
const LEGACY_CHROME_IDS = new Set(['lang-fr', 'lang-en', 'lang-nl', 'theme'])
const inventory = (
JSON.parse(
readFileSync(new URL('../../migration/inventory/anchors.json', import.meta.url), 'utf8'),
) as string[]
).filter((id) => !LEGACY_CHROME_IDS.has(id))
for (const path of localePaths) {
test(`all ${inventory.length} legacy anchors exist on ${path}`, async ({ page }) => {
await page.goto(path)
const present = await page.evaluate(
(ids) => ids.filter((id) => !document.getElementById(id)),
inventory,
)
expect(present, 'missing legacy anchor ids').toEqual([])
})
}