AvanzaCast/e2e/puppeteer-runner/save-candidates.js
Cesar Mendivil 8b458a3ddf feat: add initial LiveKit Meet integration with utility scripts, configs, and core components
- Add Next.js app structure with base configs, linting, and formatting
- Implement LiveKit Meet page, types, and utility functions
- Add Docker, Compose, and deployment scripts for backend and token server
- Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers
- Include CSS modules and global styles for UI
- Add postMessage and studio integration utilities
- Update package.json with dependencies and scripts for development and testing
2025-11-20 12:50:38 -07:00

21 lines
1.4 KiB
JavaScript

(async ()=>{
const mod = await import('puppeteer')
const puppeteer = (mod && mod.default) ? mod.default : mod
const fs = await import('fs')
const chromePath = process.env.CHROME_PATH || '/usr/bin/chromium'
const url = process.env.VITE_BROADCASTPANEL_URL || 'https://avanzacast-broadcastpanel.bfzqqk.easypanel.host'
const browser = await puppeteer.launch({ executablePath: chromePath, args: ['--no-sandbox','--disable-setuid-sandbox','--disable-dev-shm-usage'], defaultViewport: { width: 1400, height: 900 } })
const page = await browser.newPage()
try { await page.goto(url, { waitUntil: 'networkidle2', timeout: 60000 }) } catch(e) { }
await page.waitForTimeout(3000)
const candidates = await page.evaluate(()=>{
function norm(s){ return (s||'').replace(/\s+/g,' ').trim() }
const nodes = Array.from(document.querySelectorAll('button, a, [role="button"]'))
return nodes.slice(0,500).map(n=>({ text: norm(n.textContent||n.innerText||''), aria: n.getAttribute && n.getAttribute('aria-label'), classes: (n.className||'').toString().slice(0,300), role: n.getAttribute && n.getAttribute('role') }))
})
await fs.promises.writeFile('reports/candidates.json', JSON.stringify(candidates, null, 2), 'utf-8')
await browser.close()
console.log('saved candidates to reports/candidates.json')
})().catch(e=>{ console.error(e && e.stack?e.stack:e); process.exit(2) })