import { chromium } from "@playwright/test"; import path from "node:path"; import { fileURLToPath } from "node:url"; const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../"); const outDir = path.join(root, "docs/evidence/ui-review/2026-11-19-console-full/screenshots"); const browser = await chromium.launch({ headless: true }); const page = await browser.newPage({ viewport: { width: 1440, height: 900 } }); await page.goto("http://127.0.0.1:5173/", { waitUntil: "networkidle" }); await page.waitForTimeout(600); await page.screenshot({ path: path.join(outDir, "login-1440x900-default-01.png"), fullPage: true }); await page.setViewportSize({ width: 1280, height: 800 }); await page.screenshot({ path: path.join(outDir, "login-1280x800-default-02.png"), fullPage: true }); const theme = page.getByRole("button", { name: "切换昼夜" }); if (await theme.count()) { await theme.click(); await page.waitForTimeout(400); await page.screenshot({ path: path.join(outDir, "login-1280x800-dark-03.png"), fullPage: true }); } await browser.close(); console.log("login screenshots ok");