test(qa): 图片工具卡三卡内容贴左核验脚本(存档,清理老样式前的干净回退点)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
seaislee1209
2026-06-21 21:43:54 +08:00
co-authored by Claude Opus 4.8
parent caec48c827
commit 435213a0e3
+20
View File
@@ -0,0 +1,20 @@
import { chromium } from "playwright";
const b=await chromium.launch({headless:true});
const p=await (await b.newContext({viewport:{width:1440,height:900}})).newPage();
const errs=[]; p.on("console",m=>{if(m.type()==="error")errs.push(m.text())}); p.on("pageerror",e=>errs.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/asset-factory"); await p.waitForTimeout(1500);
// 量每张卡的内容偏移
const n=await p.locator(".factory-card").count();
const offs=[];
for(let i=0;i<n;i++){
const card=await p.locator(".factory-card").nth(i).boundingBox();
const tag=await p.locator(".factory-card").nth(i).locator(".factory-tag").boundingBox();
const title=await p.locator(".factory-card").nth(i).locator(".factory-title").innerText();
offs.push({card:i+1,title:title.slice(0,8),offset:Math.round(tag.x-card.x)});
}
await p.locator(".factory-hero").screenshot({path:"../../../_qa_shots/factory-all.png"});
console.log(JSON.stringify({cards:n,offsets:offs,consoleErrors:errs},null,2));
await b.close();