SPB Git
993 B · 10 lines javascript
1import { chromium, devices } from "@playwright/test";2const b = await chromium.launch(); const base = "http://127.0.0.1:8540";3const shots = [["home", "/"], ["dir", "/tools?q=python"], ["tool", "/tools/duckdb"], ["compare", "/compare?tools=duckdb,python,r"]];4for (const [name, path] of shots) {5  const ctx = await b.newContext({ viewport: { width: 1440, height: 1000 } }); const p = await ctx.newPage(); await p.goto(base + path, { waitUntil: "networkidle" }); await p.screenshot({ path: `/tmp/shot-${name}.png`, fullPage: name !== "home" ? false : true }); await ctx.close();6}7const m = await b.newContext({ ...devices["iPhone 15"] }); const mp = await m.newPage(); await mp.goto(base + "/tools/duckdb", { waitUntil: "networkidle" }); await mp.screenshot({ path: "/tmp/shot-mobile.png", fullPage: false });8await mp.goto(base + "/", { waitUntil: "networkidle" }); await mp.emulateMedia({ colorScheme: "dark" }); await mp.screenshot({ path: "/tmp/shot-mobile-dark.png" });9await b.close();10
Files · laptop-initial-20261102
Menu

Theme