Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : UQO Éval — Le Grand Défi Immobilier8 * File : scripts/shots-finale.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// Joue une partie d'entraînement de 10 propriétés par l'interface, puis capture la finale, le rapport et le classement.44import { chromium, devices } from "@playwright/test";45const base = process.env.BASE ?? "http://localhost:8090";46const out = process.env.OUT ?? "tmp/shots";47const browser = await chromium.launch();48for (const [label, opts] of [["desktop", { viewport: { width: 1440, height: 900 } }], ["mobile", { ...devices["iPhone 14"] }]]) {49 if (process.argv[2] && process.argv[2] !== label) continue;50 const ctx = await browser.newContext({ ...opts, locale: "fr-CA", reducedMotion: "reduce" });51 const page = await ctx.newPage();52 page.on("pageerror", (e) => console.log(label, "ERREUR PAGE:", e.message));53 page.on("console", (m) => m.type() === "error" && console.log(label, "console:", m.text().slice(0, 200)));54 await page.goto(base, { waitUntil: "networkidle" });55 await page.getByRole("button", { name: /S'entraîner sur 10/ }).click();56 await page.waitForURL(/jouer/);57 await page.click(".intro button");58 for (let i = 0; i < 10; i++) {59 await page.waitForSelector(".choice:not([disabled])", { timeout: 15000 });60 await page.waitForTimeout(250);61 await page.locator(".choice").nth(i % 4).click();62 await page.click(".answer-submit");63 await page.waitForSelector(".feedback-foot button");64 await page.waitForTimeout(150);65 await page.click(".feedback-foot button");66 }67 await page.waitForURL(/resultats/);68 await page.waitForTimeout(2500);69 await page.screenshot({ path: `${out}/${label}-10-finale.png` });70 await page.screenshot({ path: `${out}/${label}-11-rapport.png`, fullPage: true });71 await page.goto(`${base}/classement`, { waitUntil: "domcontentloaded" });72 await page.waitForTimeout(2500);73 await page.screenshot({ path: `${out}/${label}-12-classement.png` });74 await page.goto(`${base}/regles`, { waitUntil: "domcontentloaded" });75 await page.waitForTimeout(600);76 await page.screenshot({ path: `${out}/${label}-13-regles.png` });77 await ctx.close();78}79await browser.close();80