import { chromium } from 'playwright';
const b = await chromium.launch({ executablePath:'/usr/bin/chromium-browser', args:['--no-sandbox'] });
const ctx = await b.newContext({ viewport:{ width:390, height:1500 }, deviceScaleFactor:1.5, serviceWorkers:'block' });
await ctx.addInitScript(()=>{ localStorage.setItem('sz_theme','dark'); localStorage.setItem('sz_accent','green'); });
const p = await ctx.newPage();
await p.goto('https://poly-dev.szhub.space/', { waitUntil:'domcontentloaded', timeout:35000 });
await p.waitForTimeout(5000);
await p.click('.pk-card', { timeout:8000 }).catch(e=>console.log('card click',e.message));
await p.waitForTimeout(4500);
// click the Copy CTA (wpp-cta)
await p.click('.wpp-cta', { timeout:8000 }).catch(e=>console.log('cta click',e.message));
await p.waitForTimeout(2500);
const hasModal = await p.evaluate(()=>!!document.querySelector('.pk-ccm .ccm-modal'));
const titleFont = await p.evaluate(()=>{const e=document.querySelector('.pk-ccm .ccm-title'); return e?getComputedStyle(e).fontFamily:'none';});
await p.screenshot({ path:'_ccm.png' });
console.log('modal:', hasModal, '| title font:', titleFont);
await b.close();