SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
1.2 KB · 19 lines javascript
Raw Blame History
1import { chromium } from "@playwright/test";2const b = await chromium.launch();3for (const mobile of [true, false]) {4  const ctx = await b.newContext({ viewport: mobile ? { width: 390, height: 844 } : { width: 1280, height: 800 }, isMobile: mobile, hasTouch: mobile, storageState: "qa/.e2e-session.json" });5  const p = await ctx.newPage();6  p.on("pageerror", (e) => console.log("pageerror:", e.message.slice(0, 300)));7  await p.goto("http://localhost:3000/app/chat", { waitUntil: "networkidle" });8  await p.getByRole("button", { name: /select model/i }).first().click();9  await p.waitForTimeout(1500);10  const info = await p.evaluate(() => {11    const inner = document.querySelector("#model-selector-list > div");12    return { items: document.querySelectorAll("[data-index]").length, totalH: inner?.style.height, innerChildren: inner?.children.length, scrollH: document.querySelector("#model-selector-list")?.scrollHeight, clientH: document.querySelector("#model-selector-list")?.clientHeight };13  });14  console.log(mobile ? "mobile" : "desktop", JSON.stringify(info));15  await p.screenshot({ path: `qa/out/picker-${mobile ? "m" : "d"}.png` });16  await ctx.close();17}18await b.close();19