// Auteur : Simon-Pierre Boucher — contact@spboucher.ai
// Régénère les captures du README depuis la prod (www.ora-ka.com).
// NODE_PATH=
node scripts/screenshots.mjs [base_url]
import { chromium } from 'playwright';
import { mkdirSync } from 'node:fs';
const BASE = process.argv[2] || 'https://www.ora-ka.com';
const OUT = new URL('../docs/screenshots/', import.meta.url).pathname;
mkdirSync(OUT, { recursive: true });
const browser = await chromium.launch();
const ctx = await browser.newContext({
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 2,
});
async function shot(page, name) {
await page.screenshot({ path: `${OUT}${name}.png` });
console.log(`✓ ${name}.png`);
}
// 1. Splash « Groupe KA » (premier boot, sessionStorage vierge)
{
const page = await ctx.newPage();
await page.goto(BASE, { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(500);
await shot(page, 'splash');
await page.close();
}
// Pages suivantes : splash déjà vu
await ctx.addInitScript(() => sessionStorage.setItem('oraka-splash', '1'));
// 2. Landing — la barre de recherche unifiée
const page = await ctx.newPage();
await page.goto(BASE, { waitUntil: 'networkidle' });
await page.waitForTimeout(1200);
await shot(page, 'landing');
// 3-4. Recherches hybrides (exact + sémantique, diversité d'univers)
for (const [name, q] of [
['recherche-condo', 'condo 2 chambres montréal'],
['recherche-fromage', 'fromage du québec'],
]) {
await page.fill('#q', q);
await page.waitForTimeout(2500);
await page.waitForSelector('#results article, #results .card, #results > *', { timeout: 15000 }).catch(() => {});
await page.waitForTimeout(1500);
await shot(page, name);
}
await page.close();
// 5-9. Les cinq univers montés sous leur préfixe
for (const app of ['immo', 'lou', 'fabri', 'auto', 'food']) {
const p = await ctx.newPage();
await p.goto(`${BASE}/${app}/`, { waitUntil: 'networkidle' }).catch(() => {});
await p.waitForTimeout(3500);
await shot(p, app);
await p.close();
}
await browser.close();