← back to Cronjobs Viewer
5x/click-liveness.js
22 lines
const pw=require('/Users/macstudio3/.npm-global/lib/node_modules/playwright');
const CHROME='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
(async()=>{
const b=await pw.chromium.launch({executablePath:CHROME});
const ctx=await b.newContext({httpCredentials:{username:'admin',password:'DW2024!'}});
const p=await ctx.newPage();
const errs=[]; p.on('console',m=>{if(m.type()==='error')errs.push(m.text())}); p.on('pageerror',e=>errs.push('PAGEERR '+e.message));
const hits=[]; p.on('request',r=>{ if(r.url().includes('/api/liveness/')) hits.push(r.url()); });
await p.goto('http://127.0.0.1:9772/',{waitUntil:'networkidle',timeout:20000});
await p.waitForSelector('#grid .card .live',{timeout:8000});
const before=await p.$eval('#grid .card .live',el=>el.textContent.trim());
await p.click('#grid .card .live'); // click the FIRST card's pill
await p.waitForTimeout(1500);
const after=await p.$eval('#grid .card .live',el=>el.textContent.trim());
const runsAfter=await p.$eval('#grid .card .runsv',el=>el.textContent.trim());
console.log('liveness fetch fired:', hits.length, hits[0]?('→ '+hits[0].split('/api/')[1]):'');
console.log('pill before:', JSON.stringify(before), '→ after:', JSON.stringify(after));
console.log('runs cell after:', JSON.stringify(runsAfter));
console.log('console errors:', errs.length?errs.join(' || '):'none');
await b.close();
})();