Datasets:
File size: 689 Bytes
d77bae9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import { chromium } from 'playwright'
const browser = await chromium.launch()
for (const [w,h,name] of [[768,1024,'tablet'],[390,844,'mobile']]) {
const page = await browser.newPage({ viewport: { width: w, height: h } })
await page.goto('http://localhost:4173/', { waitUntil: 'networkidle' })
await page.evaluate(() => document.fonts.ready)
await page.waitForTimeout(300)
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth)
console.log(name, 'horizontal overflow px:', overflow)
await page.screenshot({ path: `/workspace/tmp/resp-${name}.png`, fullPage: true })
await page.close()
}
await browser.close()
|