import { chromium } from "playwright"; import fs from "node:fs"; import path from "node:path"; const BASE = process.env.BASE || "http://localhost:5200"; const OUT = path.resolve("../../../_qa_shots/cleanup"); fs.mkdirSync(OUT, { recursive: true }); const browser = await chromium.launch({ headless: true }); const r = { consoleErrors: [] }; const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } }); const p = await ctx.newPage(); p.on("console", (m) => { if (m.type() === "error") r.consoleErrors.push(m.text()); }); p.on("pageerror", (e) => r.consoleErrors.push("PAGEERR:" + e.message)); await p.goto(BASE + "/login", { waitUntil: "load" }); await p.waitForTimeout(400); await p.fill("#auth-username", "airshelf"); await p.fill("#auth-pwd", "Restraint2026"); await p.click("button.btn-cta"); await p.waitForFunction(() => !location.pathname.startsWith("/login"), { timeout: 12000 }); await p.goto(BASE + "/projects", { waitUntil: "load" }); await p.waitForTimeout(2600); await p.screenshot({ path: path.join(OUT, "projects.png"), fullPage: true }); await p.goto(BASE + "/library", { waitUntil: "load" }); await p.waitForTimeout(2600); r.libTabs = (await p.locator(".tab").allInnerTexts().catch(() => [])).join(" | "); await p.screenshot({ path: path.join(OUT, "library.png"), fullPage: true }); await p.goto(BASE + "/models", { waitUntil: "load" }); await p.waitForTimeout(2600); r.modelCards = await p.locator(".model-card").count(); await p.screenshot({ path: path.join(OUT, "models.png"), fullPage: true }); await browser.close(); console.log(JSON.stringify(r, null, 2));