Python 61.6%
TypeScript 20.9%
CSS 11.4%
JavaScript 5.1%
HTML 1.1%
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:8095";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}/vehicule/${encodeURIComponent(UID)}`, { waitUntil: "networkidle" });14await page.waitForSelector(".ak-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(".ak-gallery-full"); await page.waitForSelector(".lightbox", { timeout: 3000 });18 await page.click(".lb-close"); await page.waitForSelector(".lightbox", { state: "detached", timeout: 3000 });19});20await step("accordéon score", async () => { await page.click("#score .ak-acc-btn"); await page.waitForSelector("#score .ak-acc-body.open", { timeout: 2000 }); });21await step("accordéon méthodologie prix", async () => {22 const b = page.locator("#prix .ak-acc-btn").first(); await b.scrollIntoViewIfNeeded(); await b.click();23 await page.waitForSelector("#prix .ak-acc-body.open", { timeout: 2000 });24});25await step("accordéon dossier", async () => {26 const b = page.locator("#dossier .ak-acc-btn").first(); await b.scrollIntoViewIfNeeded(); await b.click();27 await page.waitForSelector("#dossier .ak-acc-body.open", { timeout: 2000 });28});29await step("Demander à Ka : sheet", async () => {30 await page.evaluate(() => window.scrollTo(0, 1500)); await page.waitForTimeout(500);31 await page.click(".ak-ka-btn"); await page.waitForSelector(".ak-sheet", { timeout: 3000 });32 await page.click(".ak-sheet-x"); await page.waitForSelector(".ak-sheet", { state: "detached", timeout: 3000 });33});34await step("404", async () => {35 await page.goto(`${BASE}/vehicule/inexistant:0`, { waitUntil: "networkidle" }); await page.waitForSelector(".ak-page-error", { timeout: 8000 });36});37console.log("erreurs console:", errs.length, errs.slice(0, 5));38await browser.close();39process.exit(errs.filter((e) => !/Failed to fetch|api-ka|kaa/.test(e)).length ? 1 : 0);40