import { chromium } from "@playwright/test"; const b = await chromium.launch(); for (const mobile of [true, false]) { const ctx = await b.newContext({ viewport: mobile ? { width: 390, height: 844 } : { width: 1280, height: 800 }, isMobile: mobile, hasTouch: mobile, storageState: "qa/.e2e-session.json" }); const p = await ctx.newPage(); p.on("pageerror", (e) => console.log("pageerror:", e.message.slice(0, 300))); await p.goto("http://localhost:3000/app/chat", { waitUntil: "networkidle" }); await p.getByRole("button", { name: /select model/i }).first().click(); await p.waitForTimeout(1500); const info = await p.evaluate(() => { const inner = document.querySelector("#model-selector-list > div"); 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 }; }); console.log(mobile ? "mobile" : "desktop", JSON.stringify(info)); await p.screenshot({ path: `qa/out/picker-${mobile ? "m" : "d"}.png` }); await ctx.close(); } await b.close();