Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : Lou·Ka8 * File : scripts/screenshots.mjs9 * Module : scripts10 * Repository : https://git.spboucher.ai/lou-ka11 * Created : 2026-08-1312 * Last Modified : 2026-08-1313 *14 * Author : Simon-Pierre Boucher15 * Position : Professor of Finance16 * Institution : Université du Québec en Outaouais (UQO)17 * Organization : SP Boucher18 * Website : https://spboucher.ai19 * Git : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development : dev@spboucher.ai23 * Support : support@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// Capture les screenshots du site prod pour le README (docs/screenshots/).43// Usage : npm i playwright puis `node scripts/screenshots.mjs`44// (LOUKA_BASE pour cibler un autre déploiement, OUT_DIR pour changer la sortie)45import { chromium, devices } from 'playwright';46import { mkdirSync } from 'fs';4748const OUT = process.env.OUT_DIR || new URL('../docs/screenshots/', import.meta.url).pathname;49mkdirSync(OUT, { recursive: true });5051const BASE = process.env.LOUKA_BASE || 'https://www.lou-ka.com';5253const shots = [54 { name: 'accueil', url: '/', width: 1440, height: 900 },55 { name: 'annonces', url: '/', width: 1440, height: 900, scrollTo: 1400 },56 { name: 'carte', url: '/?view=carte', width: 1440, height: 900, settle: 8000 },57 { name: 'accueil-mobile', url: '/', mobile: true },58 { name: 'fiche-logement', url: '/logement/gimcote:26286', width: 1440, height: 900 },59 { name: 'ville-quebec', url: '/ville/quebec', width: 1440, height: 900 },60 { name: 'villes', url: '/villes', width: 1440, height: 900 },61 { name: 'sources', url: '/sources', width: 1440, height: 900 },62 { name: 'stats', url: '/stats', width: 1440, height: 900 },63];6465const browser = await chromium.launch();66for (const s of shots) {67 const ctx = s.mobile68 ? await browser.newContext({ ...devices['iPhone 14'], locale: 'fr-CA' })69 : await browser.newContext({70 viewport: { width: s.width, height: s.height },71 deviceScaleFactor: 2,72 locale: 'fr-CA',73 });74 // Consentement déjà donné → pas de bandeau dans les captures75 await ctx.addInitScript(() => {76 localStorage.setItem(77 'louka-consent-v1',78 JSON.stringify({ essential: true, preferences: true, statistics: false, ts: 1 })79 );80 });81 const page = await ctx.newPage();82 try {83 await page.goto(BASE + s.url, { waitUntil: 'networkidle', timeout: 45000 });84 } catch {85 // networkidle peut ne jamais arriver (ticker temps réel) — on capture quand même86 }87 if (s.scrollTo) {88 await page.mouse.wheel(0, s.scrollTo);89 }90 await page.waitForTimeout(s.settle ?? 2500);91 await page.screenshot({ path: `${OUT}${s.name}.png` });92 console.log('ok', s.name);93 await ctx.close();94}95await browser.close();96