import { chromium } from "playwright"; import fs from "node:fs"; const BASE = process.env.BASE ?? "http://localhost:8500"; const PW = fs.readFileSync(process.env.PWFILE ?? (process.env.HOME + "/Desktop/Cluster/secrets/chat-spboucher-ai.devpassword"), "utf8").trim(); const browser = await chromium.launch(); const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } }); const page = await ctx.newPage(); const errors = []; page.on("pageerror", e => errors.push(e.message)); page.on("console", m => { if (m.type() === "error") errors.push(m.text().slice(0, 200)); }); await page.goto(BASE + "/login"); await page.fill('input[autocomplete="username"]', "simon"); await page.fill('input[type="password"]', PW); await page.click('button[type="submit"]'); await page.waitForURL(BASE + "/"); for (const p of ["models", "compare", "research", "memory", "images", "usage", "settings", "projects/new"]) { await page.goto(`${BASE}/${p}`); await page.waitForLoadState("networkidle").catch(() => {}); await page.waitForTimeout(1200); await page.screenshot({ path: `e2e-shots/page-${p.replace("/", "-")}.png` }); console.log("shot", p); } console.log("errors:", JSON.stringify(errors.slice(0, 8), null, 1)); await browser.close();