import { chromium } from 'playwright-core' import { mkdirSync } from 'node:fs' import { fileURLToPath } from 'node:url' import { join } from 'node:path' const base = process.env.DEMO_URL || 'http://localhost:5174' const dir = fileURLToPath(new URL('./shots/', import.meta.url)) mkdirSync(dir, { recursive: true }) const pages = [ ['home', '/'], ['productivity', '/screen/productivity'], ['operation', '/screen/operation'], ['duty', '/screen/duty'], ['workbench', '/admin/workbench'], ['master', '/admin/master'], ['dutyops', '/admin/duty'], ['finance', '/admin/finance'], ['collab', '/admin/collab'], ] const browser = await chromium.launch({ executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', headless: true, }) const page = await browser.newPage({ viewport: { width: 1440, height: 900 } }) for (const [name, path] of pages) { await page.goto(base + path, { waitUntil: 'networkidle' }) await page.waitForTimeout(600) await page.screenshot({ path: join(dir, `${name}.png`), fullPage: true }) console.log('shot', name) } await browser.close()