Agrégateur de produits québécois — www.fabri-ka.com
Python 38.4%
HTML 30.3%
TypeScript 17.2%
CSS 11%
JavaScript 3.2%
1// Parcours d'interactions Playwright sur la fiche (mobile) : galerie plein2// écran, panneau « Voir les N lieux », « Demander à Ka », accordéons — vérifie3// l'absence d'erreur JS et que chaque panneau s'ouvre puis se ferme.4// Usage : node frontend/scripts/interactions.mjs <uid> [baseUrl]5import { chromium, devices } from "playwright";6const UID = process.argv[2]; const BASE = process.argv[3] || "http://127.0.0.1:8097";7if (!UID) { console.error("usage: node interactions.mjs <uid> [baseUrl]"); process.exit(2); }8const browser = await chromium.launch();9const ctx = await browser.newContext({ ...devices["iPhone 14"] }); const page = await ctx.newPage();10const errs = [];11page.on("pageerror", (e) => errs.push("PAGEERROR " + e.message));12page.on("console", (m) => { if (m.type() === "error") errs.push(m.text().slice(0, 160)); });13await page.goto(`${BASE}/produits/${encodeURIComponent(UID)}`, { waitUntil: "networkidle" });14await page.waitForSelector(".fb-hero");15const step = async (name, fn) => { try { await fn(); console.log("OK ", name); } catch (e) { console.log("FAIL", name, String(e).split("\n")[0]); } };16await step("galerie → plein écran → fermer", async () => {17 await page.click(".fb-gallery-full"); await page.waitForSelector(".fb-lightbox", { timeout: 3000 });18 await page.click(".fb-lightbox-close"); await page.waitForSelector(".fb-lightbox", { state: "detached", timeout: 3000 });19});20await step("accordéon méthodologie prix", async () => {21 const b = page.locator("#prix .fb-acc-btn").first(); await b.scrollIntoViewIfNeeded(); await b.click();22 await page.waitForSelector("#prix .fb-acc-body.open", { timeout: 2000 });23});24await step("accordéon dossier", async () => {25 const b = page.locator("#dossier .fb-acc-btn").first(); await b.scrollIntoViewIfNeeded(); await b.click();26 await page.waitForSelector("#dossier .fb-acc-body.open", { timeout: 2000 });27});28await step("Demander à Ka : sheet", async () => {29 await page.evaluate(() => window.scrollTo(0, 1500)); await page.waitForTimeout(500);30 await page.click(".fb-ka-btn"); await page.waitForSelector(".fb-sheet", { timeout: 3000 });31 await page.click(".fb-sheet-x"); await page.waitForSelector(".fb-sheet", { state: "detached", timeout: 3000 });32});33await step("404", async () => {34 await page.goto(`${BASE}/produits/inexistant-00000000000000000000`, { waitUntil: "networkidle" }); await page.waitForSelector(".fb-page-error", { timeout: 8000 });35});36console.log("erreurs console:", errs.length, errs.slice(0, 5));37await browser.close();38process.exit(errs.filter((e) => !/Failed to fetch|api-ka|kaa/.test(e)).length ? 1 : 0);39