import { chromium } from "playwright"; import path from "node:path"; import fs from "node:fs"; const PID="53d7a7c3-2f41-431b-82d3-3acc97900310"; const OUT=path.resolve("../../../_qa_shots/pd"); fs.mkdirSync(OUT,{recursive:true}); const b=await chromium.launch({headless:true}); const r={consoleErrors:[]}; const p=await (await b.newContext({viewport:{width:1440,height:1000}})).newPage(); p.on("console",m=>{if(m.type()==="error")r.consoleErrors.push(m.text())}); p.on("pageerror",e=>r.consoleErrors.push("PE:"+e.message)); await p.goto("http://localhost:5200/login"); await p.waitForTimeout(300); await p.fill("#auth-username","airshelf"); await p.fill("#auth-pwd","Restraint2026"); await p.click("button.btn-cta"); await p.waitForFunction(()=>!location.pathname.startsWith("/login"),{timeout:12000}); await p.goto("http://localhost:5200/products/"+PID); await p.waitForTimeout(3000); r.groupCards=await p.locator(".pd-group-card").count(); r.groups=await p.locator(".pd-group-card .type-pill").allInnerTexts().catch(()=>[]); await p.screenshot({path:path.join(OUT,"pd-grouped.png"),fullPage:true}); if(r.groupCards>0){ await p.locator(".pd-group-card").first().click(); await p.waitForTimeout(1200); r.modalOpen=await p.locator(".pack-modal").count(); r.modalItems=await p.locator(".pd-group-item").count(); await p.screenshot({path:path.join(OUT,"pd-group-modal.png")}); } await b.close(); console.log(JSON.stringify(r,null,2));