21 lines
1013 B
JavaScript
21 lines
1013 B
JavaScript
import { chromium } from "playwright";
|
|
const [,, SP, ...specs] = process.argv;
|
|
const b = await chromium.launch();
|
|
const c = await b.newContext({ viewport: { width: 1280, height: 950 }, deviceScaleFactor: 2, colorScheme: "dark" });
|
|
const p = await c.newPage();
|
|
const errs = [];
|
|
p.on("pageerror", e => errs.push(String(e).slice(0,200)));
|
|
p.on("console", m => { if (m.type()==="error") errs.push("console: "+m.text().slice(0,160)); });
|
|
await p.goto("http://localhost:3011/anmelden");
|
|
await p.fill("#email", "demo@flimmer.local");
|
|
await p.fill("#password", "flimmer-demo-2026");
|
|
await Promise.all([p.waitForURL("http://localhost:3011/"), p.click("button[type=submit]")]);
|
|
for (const spec of specs) {
|
|
const [name, url, full] = spec.split("|");
|
|
await p.goto(`http://localhost:3011${url}`, { waitUntil: "networkidle" });
|
|
await p.waitForTimeout(900);
|
|
await p.screenshot({ path: `${SP}/${name}.png`, fullPage: full === "full" });
|
|
}
|
|
console.log("Fehler:", errs.length ? errs.slice(0,4) : "keine");
|
|
await b.close();
|