SPB Git

spb/ora-ka Public

Ora-Ka — cinq agrégateurs Ka, une barre de recherche hybride (exact + sémantique)

Python 80% TypeScript 12.9% CSS 6.8%
2.0 KB · 63 lines javascript
Raw Blame History
1// Auteur : Simon-Pierre Boucher — contact@spboucher.ai2// Régénère les captures du README depuis la prod (www.ora-ka.com).3//   NODE_PATH=<dir avec playwright> node scripts/screenshots.mjs [base_url]4import { chromium } from 'playwright';5import { mkdirSync } from 'node:fs';67const BASE = process.argv[2] || 'https://www.ora-ka.com';8const OUT = new URL('../docs/screenshots/', import.meta.url).pathname;9mkdirSync(OUT, { recursive: true });1011const browser = await chromium.launch();12const ctx = await browser.newContext({13  viewport: { width: 1440, height: 900 },14  deviceScaleFactor: 2,15});1617async function shot(page, name) {18  await page.screenshot({ path: `${OUT}${name}.png` });19  console.log(`✓ ${name}.png`);20}2122// 1. Splash « Groupe KA » (premier boot, sessionStorage vierge)23{24  const page = await ctx.newPage();25  await page.goto(BASE, { waitUntil: 'domcontentloaded' });26  await page.waitForTimeout(500);27  await shot(page, 'splash');28  await page.close();29}3031// Pages suivantes : splash déjà vu32await ctx.addInitScript(() => sessionStorage.setItem('oraka-splash', '1'));3334// 2. Landing — la barre de recherche unifiée35const page = await ctx.newPage();36await page.goto(BASE, { waitUntil: 'networkidle' });37await page.waitForTimeout(1200);38await shot(page, 'landing');3940// 3-4. Recherches hybrides (exact + sémantique, diversité d'univers)41for (const [name, q] of [42  ['recherche-condo', 'condo 2 chambres montréal'],43  ['recherche-fromage', 'fromage du québec'],44]) {45  await page.fill('#q', q);46  await page.waitForTimeout(2500);47  await page.waitForSelector('#results article, #results .card, #results > *', { timeout: 15000 }).catch(() => {});48  await page.waitForTimeout(1500);49  await shot(page, name);50}51await page.close();5253// 5-9. Les cinq univers montés sous leur préfixe54for (const app of ['immo', 'lou', 'fabri', 'auto', 'food']) {55  const p = await ctx.newPage();56  await p.goto(`${BASE}/${app}/`, { waitUntil: 'networkidle' }).catch(() => {});57  await p.waitForTimeout(3500);58  await shot(p, app);59  await p.close();60}6162await browser.close();63