import { chromium } from "@playwright/test"; const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true }); await p.goto((process.env.QA_BASE ?? "http://localhost:3000") + (process.argv[2] ?? "/"), { waitUntil: "networkidle" }); await p.waitForTimeout(800); for (let y = 0; y < 9000; y += 800) { await p.evaluate((yy) => window.scrollTo(0, yy), y); await p.waitForTimeout(250); } const out = await p.evaluate(() => { const vw = window.innerWidth; const res = []; const inScroller = (el) => { let q = el.parentElement; while (q && q !== document.body) { const o = getComputedStyle(q).overflowX; if (o === 'auto' || o === 'scroll') return true; q = q.parentElement; } return false; }; for (const el of document.querySelectorAll("body *")) { const r = el.getBoundingClientRect(); if (r.width > 0 && r.right > vw + 1 && r.left < vw && !el.closest(".snap-row, .marquee, [data-allow-overflow]") && !inScroller(el)) { res.push({ tag: el.tagName, cls: (el.className || "").toString().slice(0, 120), text: el.textContent?.trim().slice(0, 60), right: Math.round(r.right), parent: (el.parentElement?.className || "").toString().slice(0, 100) }); } } return { docOverflow: document.documentElement.scrollWidth - vw, res: res.slice(0, 8) }; }); console.log(JSON.stringify(out, null, 1)); await b.close();