SPB Git

Repository Public

probe.mjs 3.5 KB 54 lines javascript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Note SPBoucher AI8 * File             : tests/e2e/probe.mjs9 * Module           : tests10 * Repository       : https://git.spboucher.ai/note-spboucher-ai11 * Project Website  : https://note.spboucher.ai12 * Created          : 2026-11-1713 * Last Modified    : 2026-11-1714 *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 */4243import { chromium } from "@playwright/test";44const O = "http://localhost:8481"; const b = await chromium.launch(); const ctx = await b.newContext({ baseURL: O, storageState: "test-results/.auth/state.json", viewport: { width: 360, height: 740 }, hasTouch: true, isMobile: true, deviceScaleFactor: 2 });45const p = await ctx.newPage(); const tree = await (await p.request.get("/api/tree")).json(); const dbp = tree.find((n) => n.title === "E2E Tasks DB");46await p.goto(`/p/${dbp.id}`); await p.getByRole("button", { name: "Open Call the notary" }).click(); await p.waitForTimeout(900);47const names = async (sel) => (await p.locator(sel).evaluateAll((els) => els.map((e) => (e.getAttribute("aria-label") || e.textContent || "").trim().replace(/\s+/g, " ").slice(0, 40)).filter(Boolean))).join(" | ");48console.log("SHEET:", await names('[role="dialog"] button, [role="dialog"] [role="switch"], [role="dialog"] input')); await p.screenshot({ path: "test-results/shots/360-db-row.png" });49const st = p.getByRole("dialog").getByRole("button", { name: /Status/ }).first(); if (await st.count()) { await st.click(); await p.waitForTimeout(700); console.log("STATUS:", await names('[role="dialog"] button')); await p.screenshot({ path: "test-results/shots/360-db-status.png" }); }50await p.keyboard.press("Escape"); await p.keyboard.press("Escape"); await p.waitForTimeout(300);51await p.getByRole("button", { name: "New", exact: true }).click(); await p.waitForTimeout(700); console.log("NEW:", await names('[role="dialog"] button, [role="dialog"] input, [role="dialog"] textarea')); await p.screenshot({ path: "test-results/shots/360-db-new.png" }); await p.keyboard.press("Escape");52await p.getByRole("button", { name: /View options/ }).click(); await p.waitForTimeout(700); console.log("OPTIONS:", (await names('[role="dialog"] button')).slice(0, 700)); await p.screenshot({ path: "test-results/shots/360-db-options.png" });53await b.close();54
Files main
Menu

Theme