2026-10-02 00:47:49 -04:00
const { chromium } = require ( 'playwright' ) ;
2026-10-06 09:41:27 -04:00
if ( ! process . env . DF _SESSION _COOKIE ) { console . error ( 'DF_SESSION_COOKIE env var not set — grab the dragonflight.sid cookie value from your browser devtools, export it, rerun.' ) ; process . exit ( 1 ) ; }
2026-10-02 00:47:49 -04:00
( async ( ) => { const b = await chromium . launch ( { args : [ '--no-sandbox' ] } ) ; const c = await b . newContext ( { viewport : { width : 1920 , height : 1080 } } ) ;
2026-10-06 09:41:27 -04:00
await c . addCookies ( [ { name : 'dragonflight.sid' , value : process . env . DF _SESSION _COOKIE , domain : 'mediacmdr.com' , path : '/' , httpOnly : true , secure : true } ] ) ;
2026-10-02 00:47:49 -04:00
const p = await c . newPage ( ) ; await p . goto ( 'https://mediacmdr.com/editor.html' , { waitUntil : 'networkidle' } ) ; await p . waitForTimeout ( 3000 ) ;
const r = await p . evaluate ( ( ) => { const s = [ ... document . querySelectorAll ( 'select' ) ] . find ( s => [ ... s . options ] . some ( o => / Broadcast Managment / . test ( o . text ) ) ) ; if ( ! s ) return 'nosel' ; const o = [ ... s . options ] . find ( o => / Broadcast Managment / . test ( o . text ) ) ; s . value = o . value ; s . dispatchEvent ( new Event ( 'change' , { bubbles : true } ) ) ; return o . value } ) ;
console . log ( 'sel' , r ) ; await p . waitForTimeout ( 6000 ) ;
const it = null ;
console . log ( 'item' , it ) ; await p . waitForTimeout ( 4000 ) ;
await p . keyboard . press ( 'e' ) ; await p . waitForTimeout ( 3000 ) ;
await p . evaluate ( ( ) => document . querySelectorAll ( 'video' ) . forEach ( v => { try { v . pause ( ) } catch ( e ) { } } ) ) ;
await p . screenshot ( { path : 'screenshots/18-ops-editor.png' } ) ;
console . log ( await p . evaluate ( ( ) => document . body . innerText . replace ( /\s+/g , ' ' ) . slice ( 0 , 500 ) ) ) ; await b . close ( ) } ) ( ) ;