import { chromium } from "@playwright/test"; import fs from "fs"; import path from "path"; const outDir = path.resolve("../docs/images/readme"); fs.mkdirSync(outDir, { recursive: true }); const browser = await chromium.launch({ headless: true }); const context = await browser.newContext({ viewport: { width: 1600, height: 1000 }, deviceScaleFactor: 1 }); const page = await context.newPage(); async function shot(name, url, wait = 2000) { await page.goto(url, { waitUntil: "networkidle" }); await page.waitForTimeout(wait); await page.screenshot({ path: path.join(outDir, name), fullPage: true }); } await shot("login.png", "http://127.0.0.1:5173/login", 1500); await page.goto("http://127.0.0.1:5173/login", { waitUntil: "networkidle" }); await page.waitForTimeout(1000); await page.locator('button').first().click(); await page.waitForTimeout(3200); await page.goto("http://127.0.0.1:5173/dashboard", { waitUntil: "networkidle" }); await page.waitForTimeout(2500); await page.screenshot({ path: path.join(outDir, "dashboard.png"), fullPage: true }); for (const route of ["oracle", "sentinel", "inventory", "catalyst", "settings"]) { await page.goto(`http://127.0.0.1:5173/${route}`, { waitUntil: "networkidle" }); await page.waitForTimeout(route === "sentinel" ? 3000 : 2200); await page.screenshot({ path: path.join(outDir, `${route}.png`), fullPage: true }); } await browser.close(); console.log(outDir);