import { chromium } from "playwright"; import fs from "node:fs"; import path from "node:path"; const BASE = process.env.BASE, TOKEN = process.env.TOKEN; const OUT = path.resolve("../../../_qa_shots/wave35"); fs.mkdirSync(OUT, { recursive: true }); const b = await chromium.launch({ headless: true }); const ctx = await b.newContext({ viewport: { width: 1440, height: 900 } }); const seed = await ctx.newPage(); await seed.goto(BASE + "/", { waitUntil: "domcontentloaded" }); await seed.evaluate((t) => localStorage.setItem("airshelf_token", t), TOKEN); await seed.close(); const p = await ctx.newPage(); const errs = []; p.on("console", m => { if (m.type()==="error") errs.push(m.text()); }); p.on("pageerror", e => errs.push("PAGEERR:"+e.message)); await p.goto(BASE + "/team", { waitUntil: "load" }); await p.waitForTimeout(1500); const r = { inviteBtn: await p.locator("#open-gen-invite").count() }; if (r.inviteBtn) { await p.click("#open-gen-invite"); await p.waitForTimeout(450); r.modalShown = await p.locator(".modal-bg.show").count(); r.roleSelect = await p.locator(".invite-gen-modal select").count(); r.genBtnText = await p.locator(".modal-f .btn-primary").innerText().catch(()=>""); await p.screenshot({ path: path.join(OUT, "team-gen-invite.png") }); await p.keyboard.press("Escape"); await p.waitForTimeout(350); r.closedByEsc = (await p.locator(".modal-bg").count()) === 0; } r.consoleErrors = errs.filter(e => !/Invitation|invitations|500|Failed to load resource/i.test(e)); await b.close(); console.log(JSON.stringify(r, null, 2));