import { chromium } from "playwright"; import path from "node:path"; import fs from "node:fs"; const OUT=path.resolve("../../../_qa_shots/adopt"); fs.mkdirSync(OUT,{recursive:true}); const b=await chromium.launch({headless:true}); const r={}; const p=await (await b.newContext({viewport:{width:1440,height:900}})).newPage(); 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/pipeline/bdbf39d3-1a89-4135-b1b7-26d3331a7021"); await p.waitForTimeout(2200); await p.locator('a[data-stage="2"]').first().click().catch(()=>{}); await p.waitForTimeout(2200); r.delBtnInDom=await p.locator(".asset-card-del").count(); // hover 含 toggle 的那张真实角色卡 const realCard=p.locator(".asset-card-2:has(.adopt-toggle)").first(); r.realCardCount=await realCard.count(); if(await realCard.count()){ await realCard.hover(); await p.waitForTimeout(400); const opacity=await realCard.locator(".asset-card-del").evaluate(el=>getComputedStyle(el).opacity).catch(()=>"n/a"); r.delOpacityOnHover=opacity; await realCard.screenshot({path:path.join(OUT,"card-hover.png")}); } await b.close(); console.log(JSON.stringify(r,null,2));