SPB Git forge

spb/uqo-eval

Public
55commits 2branches 0releases
134.4 MBsize
maindefault branch
4 h agolast push
TypeScript 90.1% JavaScript 3.2% Python 3.2% CSS 1.8% HTML 1.8%
2.5 KB · 46 lines
Raw Blame History
1import { chromium } from "playwright";2const b = await chromium.launch();3const ctx = await b.newContext({ viewport: { width: 1440, height: 900 }, colorScheme: "dark" });4const p = await ctx.newPage();5const errors = [];6p.on("pageerror", (e) => errors.push("pageerror: " + e.message));7p.on("console", (m) => { if (m.type() === "error") errors.push("console: " + m.text().slice(0, 200)); });8await p.goto("http://localhost:8260/", { waitUntil: "networkidle", timeout: 90000 });9const live = await p.waitForSelector("section[aria-label] header span:has-text('LIVE')", { timeout: 20000 }).catch(() => null);10console.log("feed status:", live ? "LIVE" : "not live", "errors so far:", errors.slice(0,5));11await p.waitForTimeout(500);12await p.locator("article a[href^='/event/']").first().click();13const dlg = await p.waitForSelector("[role=dialog]", { timeout: 15000 }).catch(() => null);14console.log("drawer:", Boolean(dlg), "url:", p.url(), "errors:", errors.slice(0,5));15if (!dlg) { await p.screenshot({ path: "/tmp/no-drawer.png" }); await b.close(); process.exit(0); }16await p.waitForTimeout(2500);17await p.screenshot({ path: "/tmp/drawer.png" });18await p.keyboard.press("Escape");19await p.waitForTimeout(300);20await p.keyboard.press("Meta+k");21await p.waitForSelector("[role=combobox]", { timeout: 5000 });22await p.keyboard.type("openai pricing");23await p.waitForTimeout(1500);24await p.screenshot({ path: "/tmp/palette.png" });25await p.keyboard.press("Escape");26// density compact via prefs27await p.locator("[role=radiogroup] button").first().click();28await p.waitForTimeout(500);29await p.screenshot({ path: "/tmp/compact.png" });30// mobile31const m = await b.newContext({ viewport: { width: 390, height: 844 }, colorScheme: "dark", isMobile: true, hasTouch: true });32const mp = await m.newPage();33await mp.goto("http://localhost:8260/live?silent_change=true", { waitUntil: "networkidle", timeout: 90000 });34await mp.waitForTimeout(1000);35const ov = await mp.evaluate(() => document.documentElement.scrollWidth - window.innerWidth);36console.log("mobile /live overflow px:", ov);37await mp.locator("article a[href^='/event/']").first().click();38await mp.waitForSelector("[role=dialog]", { timeout: 15000 });39await mp.waitForTimeout(2000);40await mp.screenshot({ path: "/tmp/drawer-mobile.png" });41await mp.getByRole("button", { name: "More" }).click().catch(() => {});42await mp.waitForTimeout(600);43await mp.screenshot({ path: "/tmp/more-mobile.png" });44console.log("errors:", errors.slice(0, 8));45await b.close();46