import { chromium } from 'playwright' import { mkdirSync } from 'node:fs' const url = process.env.APP_URL || 'http://localhost:4173/' const out = new URL('../screenshots/full-page.png', import.meta.url).pathname mkdirSync(new URL('../screenshots', import.meta.url).pathname, { recursive: true }) const browser = await chromium.launch() const page = await browser.newPage({ viewport: { width: 1360, height: 900 }, deviceScaleFactor: 1 }) await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 }) await page.evaluate(() => document.fonts.ready) await page.waitForTimeout(1200) await page.screenshot({ path: out, fullPage: true }) const height = await page.evaluate(() => document.documentElement.scrollHeight) console.log(JSON.stringify({ screenshot: out, pageHeight: height })) await browser.close()