media-command-guide/capture-playout-staging.js

17 lines
1.1 KiB
JavaScript

// Read-only: opens Staging with the pre-built non-air playlist selected (via localStorage). No transport clicks.
const { chromium } = require('playwright');
const OUT='/home/zgaetano/media-command-guide/screenshots';
const COOKIE='REDACTED';
const CH='ccea5e02-2c7e-4154-953b-1f9621336ceb', PL=process.argv[2];
(async()=>{
const b=await chromium.launch({args:['--no-sandbox']});
const c=await b.newContext({viewport:{width:1920,height:1080}});
await c.addCookies([{name:'dragonflight.sid',value:COOKIE,domain:'mediacmdr.com',path:'/',httpOnly:true,secure:true}]);
await c.addInitScript(([k,v])=>localStorage.setItem(k,v),['df.staging.'+CH,PL]);
const p=await c.newPage();
p.on('request',r=>{if(r.url().includes('/api/')&&r.method()!=='GET')console.log('WRITE',r.method(),r.url())});
await p.goto('https://mediacmdr.com/#playout',{waitUntil:'networkidle'});await p.waitForTimeout(8000);
await p.locator('button',{hasText:/^Staging$/}).first().click(); await p.waitForTimeout(6000);
await p.screenshot({path:`${OUT}/16g-playout-staging.png`});
console.log((await p.evaluate(()=>document.body.innerText)).match(/STAGING[\s\S]{0,700}/)?.[0]);
await b.close();})();