const { chromium } = require('@playwright/test'); const path = require('path'); const fs = require('fs'); const http = require('http'); const OUTPUT_DIR = 'C:/Users/encep/.gemini/antigravity-cli/brain/3ab7ae82-5634-41d5-93a7-3c12c22503e2/screenshots/ad_services_live'; async function captureSettlementLedgerFull() { const SITE_DIR = path.resolve(__dirname, '../site/dist'); const serverSite = http.createServer((req, res) => { let filePath = path.join(SITE_DIR, req.url === '/' ? 'launch-readiness.html' : req.url); if (!fs.existsSync(filePath)) filePath = path.join(SITE_DIR, 'launch-readiness.html'); const ext = path.extname(filePath); let contentType = 'text/html'; if (ext === '.js') contentType = 'application/javascript'; if (ext === '.css') contentType = 'text/css'; if (ext === '.json') contentType = 'application/json'; if (ext === '.png') contentType = 'image/png'; if (ext === '.svg') contentType = 'image/svg+xml'; res.writeHead(200, { 'Content-Type': contentType }); res.end(fs.readFileSync(filePath)); }); await new Promise((resolve) => serverSite.listen(4895, resolve)); const browser = await chromium.launch({ channel: 'msedge', headless: true }); const context = await browser.newContext({ viewport: { width: 1440, height: 1200 }, deviceScaleFactor: 2, }); const page = await context.newPage(); await page.goto('http://localhost:4895/launch-readiness.html', { waitUntil: 'networkidle' }); await page.waitForTimeout(1000); // Switch to Admin Tab await page.evaluate(() => { if (typeof window.switchTab === 'function') { window.switchTab('admin'); } }); await page.waitForTimeout(1000); await page.screenshot({ path: path.join(OUTPUT_DIR, '12_admin_settlement_ledger_withholding_tax.png'), fullPage: true, }); await browser.close(); serverSite.close(); console.log('--- Full Settlement Ledger Captured! ---'); } captureSettlementLedgerFull().catch((err) => { console.error('Capture error:', err); process.exit(1); });