SPB Git

Repository Public

shots.mjs 3.7 KB 84 lines javascript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : UQO Éval — Le Grand Défi Immobilier8 * File             : scripts/shots.mjs9 * Module           : scripts10 * Repository       : https://git.spboucher.ai/uqo-eval-jeux11 * Project Website  : https://jeux.uqo-eval.app12 * Created          : 2026-11-2513 * Last Modified    : 2026-11-2514 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243// Captures d'écran des écrans principaux (ordinateur + mobile) pour l'inspection visuelle.44import { chromium, devices } from "@playwright/test";45const base = process.env.BASE ?? "http://localhost:8090";46const out = process.env.OUT ?? "tmp/shots";47const only = process.argv[2];48const browser = await chromium.launch();49for (const [label, opts] of [["desktop", { viewport: { width: 1440, height: 900 } }], ["mobile", { ...devices["iPhone 14"] }]]) {50  if (only && only !== label) continue;51  const ctx = await browser.newContext({ ...opts, locale: "fr-CA" });52  const page = await ctx.newPage();53  page.on("pageerror", (e) => console.log(label, "ERREUR PAGE:", e.message));54  page.on("console", (m) => m.type() === "error" && console.log(label, "console:", m.text().slice(0, 200)));55  await page.goto(base, { waitUntil: "networkidle" });56  await page.waitForTimeout(1500);57  await page.screenshot({ path: `${out}/${label}-01-accueil.png` });58  await page.screenshot({ path: `${out}/${label}-01b-accueil-page.png`, fullPage: true });59  await page.locator(".entry-alt").click();60  await page.waitForURL(/jouer/);61  await page.waitForTimeout(1600);62  await page.screenshot({ path: `${out}/${label}-02-intro.png` });63  await page.click(".intro button");64  await page.waitForTimeout(700);65  await page.screenshot({ path: `${out}/${label}-03-porte.png` });66  await page.waitForTimeout(5200);67  await page.screenshot({ path: `${out}/${label}-04-jeu.png` });68  await page.click(".choice >> nth=1");69  await page.waitForTimeout(300);70  await page.screenshot({ path: `${out}/${label}-05-selection.png` });71  await page.click(".answer-submit");72  await page.waitForTimeout(1800);73  await page.screenshot({ path: `${out}/${label}-06-retroaction.png` });74  if (process.env.MORE) {75    await page.click(".feedback-foot button");76    await page.waitForTimeout(2600);77    const tab = page.locator("#onglet-map");78    if (await tab.count()) { await tab.click(); await page.waitForTimeout(3500); }79    await page.screenshot({ path: `${out}/${label}-07-carte.png` });80  }81  await ctx.close();82}83await browser.close();84
Files main
Menu

Theme