Files
vscode-workbench/login-templates/v4-showcase/debug2.js
T

1 line
863 B
JavaScript

const pw=require("playwright");(async()=>{const b=await pw.chromium.launch();const pg=await b.newPage();pg.on("pageerror",e=>console.log("PAGE ERROR:",e.message));pg.on("console",m=>{if(m.type()==="error")console.log("CONSOLE ERROR:",m.text())});await pg.setViewportSize({width:1440,height:900});await pg.goto("http://localhost:3333");await pg.waitForTimeout(2000);for(const t of["A","B","C","D","E"]){console.log("--- Testing "+t+" ---");const result=await pg.evaluate((x)=>{try{sw(x);const g=document.querySelector("[data-t=\""+x+"\"]");return{exists:!!g,classList:g?Array.from(g.classList):[],offsetW:g?g.offsetWidth:0,offsetH:g?g.offsetHeight:0,childCount:g?g.children.length:0,innerHtmlLen:g?g.innerHTML.length:0}}catch(e){return{error:e.message}}},t);console.log(t+": "+JSON.stringify(result))}await b.close()})().catch(e=>console.log("FATAL: "+e.message));