Repository Public
1// Planche des six gestes signature (symbole du centre, instants figés). Usage : node e2e/gestes.mjs [sortie.png] [light|dark]2import { chromium } from "playwright-core";3const BASE = process.env.BASE || "http://127.0.0.1:5220";4const [out = "/tmp/groupeka-v2/shots/gestes.png", theme = "light"] = process.argv.slice(2);5const IDS = ["louka", "immoka", "vraiprix", "autoka", "foodka", "fabrika"];6const jalons = [1380, 1560, 1740, 1920, 2100, 2300, 2550, 2900, 3400, 4100];7const browser = await chromium.launch({ executablePath: process.env.CHROME_EXE, headless: true });8const page = await browser.newPage({ viewport: { width: 1440, height: 900 }, colorScheme: theme });9await page.goto(BASE + "/", { waitUntil: "load" });10await page.waitForTimeout(500);11const lignes = [];12for (const id of IDS) {13 await page.evaluate(() => window.__rotonde.choisir(null, "direct"));14 await page.waitForTimeout(150);15 await page.evaluate((id) => { window.__t0 = performance.now(); window.__rotonde.choisir(id); }, id);16 const vues = [];17 for (const j of jalons) {18 const reste = j - (await page.evaluate(() => performance.now() - window.__t0));19 if (reste > 0) await page.waitForTimeout(reste);20 const b = await page.locator(`#porte-${id} .porte-sym`).boundingBox();21 const t = Math.round(await page.evaluate(() => performance.now() - window.__t0));22 const buf = await page.screenshot({ clip: { x: b.x - 14, y: b.y - 14, width: b.width + 28, height: b.height + 28 }, type: "png" });23 vues.push(`<figure style="margin:0"><img src="data:image/png;base64,${buf.toString("base64")}" width="150"><figcaption>${t}</figcaption></figure>`);24 }25 lignes.push(`<div style="display:flex;gap:6px;align-items:end"><b style="width:70px">${id}</b>${vues.join("")}</div>`);26}27const p2 = await browser.newPage({ viewport: { width: 1680, height: 400 } });28await p2.setContent(`<body style="margin:0;padding:12px;background:${theme === "dark" ? "#131416" : "#F4F2EC"};color:#888;font:12px Menlo;display:grid;gap:8px">${lignes.join("")}`);29await p2.screenshot({ path: out, fullPage: true });30console.log("gestes", out);31await browser.close();32