Files
lage-chat-control/scripts/shot.mjs
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

23 lines
1.1 KiB
JavaScript

// Quick visual QA: screenshots a built page region in a given theme.
// Usage: node scripts/shot.mjs <url-path> <out.png> [dark|light] [#anchor]
// Requires `pnpm preview` (or any server) on 127.0.0.1:4321.
import { chromium } from '@playwright/test'
const [path = '/', out = 'shot.png', theme = 'dark', anchor = ''] = process.argv.slice(2)
const browser = await chromium.launch()
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } })
// 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(`http://127.0.0.1:4321${path}`)
if (anchor) {
/* global document -- runs inside the browser via page.evaluate */
await page.evaluate((id) => {
document.getElementById(id)?.scrollIntoView({ behavior: 'instant' })
}, anchor.slice(1))
await page.waitForTimeout(150)
}
await page.screenshot({ path: out })
await browser.close()
console.log(`[shot] ${out}${path}${anchor} (${theme})`)