Lou·Ka — tous les logements à louer du Québec, un seul endroit.
HTML 98.9%
Python 0.6%
1// QA interactions de la fiche : bottom sheets, assistant Ka, filtres carte, fiche sans coordonnées.2// Usage : node frontend/scripts/interactions.mjs [baseUrl] [outDir] [uidRiche] [uidPauvre]3import { chromium, devices } from "playwright";4const BASE = process.argv[2] || "http://127.0.0.1:8095";5const OUT = process.argv[3] || "/tmp";6const RICHE = process.argv[4] || "zumper:60608306";7const PAUVRE = process.argv[5] || "royal_lepage:21803288";8const browser = await chromium.launch();9const ctx = await browser.newContext({ ...devices["iPhone 14"] });10const page = await ctx.newPage();11const errs = []; page.on("pageerror", (e) => errs.push("PAGEERROR " + e.message));12await page.goto(`${BASE}/logement/${encodeURIComponent(RICHE)}`, { waitUntil: "networkidle" });13await page.waitForSelector(".lk-hero"); await page.waitForTimeout(1500);14// accepter les témoins pour dégager l'écran15const ok = page.locator(".cookie-actions .btn-primary, .cookie-actions button").last(); if (await ok.count()) await ok.click().catch(() => {});16await page.waitForTimeout(400);17// 1) sheet des loyers18await page.locator("#loyers .lk-more").scrollIntoViewIfNeeded(); await page.locator("#loyers .lk-more").click();19await page.waitForTimeout(600); await page.screenshot({ path: `${OUT}/ix-sheet-loyers.png` });20await page.locator(".lk-sheet-x").click(); await page.waitForTimeout(300);21// 2) sheet lieux22await page.locator("#proximite .lk-more").scrollIntoViewIfNeeded(); await page.locator("#proximite .lk-more").click();23await page.waitForTimeout(600); await page.screenshot({ path: `${OUT}/ix-sheet-lieux.png` });24await page.locator(".lk-sheet-x").click(); await page.waitForTimeout(300);25// 3) filtres carte26await page.locator("#carte").scrollIntoViewIfNeeded(); await page.waitForTimeout(2500);27await page.locator("#carte .lk-chip", { hasText: "Transport" }).click();28await page.locator("#carte .lk-chip", { hasText: "Épiceries" }).click();29await page.waitForTimeout(2500); await page.screenshot({ path: `${OUT}/ix-carte-filtres.png` });30// 4) assistant Ka31await page.locator(".lk-ka-btn").click(); await page.waitForTimeout(600); await page.screenshot({ path: `${OUT}/ix-ka-sheet.png` });32await page.locator(".lk-ka-sug").first().click(); await page.waitForTimeout(1500); await page.screenshot({ path: `${OUT}/ix-ka-agent.png` });33const kaOpen = await page.evaluate(() => !!document.querySelector(".kaa-panel.kaa-open"));34console.log("KA Agent ouvert :", kaOpen);35// 5) accordéon dossier36await page.keyboard.press("Escape"); await page.waitForTimeout(400);37await page.locator("#dossier .lk-acc-btn").first().scrollIntoViewIfNeeded(); await page.locator("#dossier .lk-acc-btn").first().click();38await page.waitForTimeout(800); await page.screenshot({ path: `${OUT}/ix-dossier.png` });39// 6) fiche pauvre (sans chambres/KA Score)40await page.goto(`${BASE}/logement/${encodeURIComponent(PAUVRE)}`, { waitUntil: "networkidle" });41await page.waitForSelector(".lk-hero"); await page.waitForTimeout(3000);42await page.screenshot({ path: `${OUT}/ix-pauvre-top.png` });43await page.screenshot({ path: `${OUT}/ix-pauvre-full.png`, fullPage: true });44// 7) 40445const r = await page.goto(`${BASE}/logement/inexistant:0`, { waitUntil: "networkidle" });46await page.waitForTimeout(800); await page.screenshot({ path: `${OUT}/ix-404.png` });47console.log("404 status", r?.status(), "errors", errs);48await browser.close();49