Debian Codegraph @

www/tests/e2e/screenshot.ts

raw symbols SCIP
1 import { chromium } from '@playwright/test';
2
3 const PAGES = [
4 { url: '/docs', name: 'docs-index', width: 1440 },
5 { url: '/docs', name: 'docs-index-wide', width: 1920 },
6 { url: '/reference', name: 'reference-index', width: 1440 },
7 { url: '/', name: 'landing', width: 1440 },
8 ];
9
10 (async () => {
11 const browser = await chromium.launch();
12
13 for (const { url, name, width } of PAGES) {
14 const context = await browser.newContext({
15 viewport: { width, height: 900 },
16 colorScheme: 'dark',
17 });
18 const page = await context.newPage();
19 await page.goto(`http://localhost:4321${url}`, { waitUntil: 'networkidle' });
20 await page.screenshot({ path: `/tmp/screenshot-${name}.png`, fullPage: false });
21 await page.close();
22 await context.close();
23 }
24
25 await browser.close();
26 console.log('Screenshots saved to /tmp/screenshot-*.png');
27 })();