import { chromium } from "playwright"; import fs from "node:fs"; import path from "node:path"; const BASE="http://localhost:5200", PROJ="bdbf39d3-1a89-4135-b1b7-26d3331a7021"; const OUT=path.resolve("../../../_qa_shots/export"); 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:900}})).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(BASE+"/login"); await p.waitForTimeout(400); 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(BASE+"/pipeline/"+PROJ); await p.waitForTimeout(2500); await p.locator('a[data-stage="4"]').first().click().catch(()=>{}); await p.waitForTimeout(2500); const qb=await p.locator(".queue-bar").innerText().catch(()=>""); r.queueBar=qb.replace(/\n/g," | "); r.hasExportBtn=await p.locator(".queue-bar button",{hasText:"导出全部"}).count(); r.exportEnabled=r.hasExportBtn? !(await p.locator(".queue-bar button",{hasText:"导出全部"}).first().isDisabled()):false; await p.locator('[data-stage-pane="4"] .queue-bar').screenshot({path:path.join(OUT,"queue-bar.png")}).catch(()=>p.screenshot({path:path.join(OUT,"stage4.png"),fullPage:true})); await p.screenshot({path:path.join(OUT,"stage4-full.png"),fullPage:true}); await b.close(); console.log(JSON.stringify(r,null,2));