← back to Consulting Rentv Com
scripts/local-open.mjs
21 lines
import { chromium } from 'playwright';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const HERE = dirname(fileURLToPath(import.meta.url));
const FILE = 'file://' + join(HERE, '..', 'public', 'portal.html');
const OUT = join(HERE, '..', 'reports');
const b = await chromium.launch();
const pg = await b.newPage({ viewport: { width: 1440, height: 1600 }, deviceScaleFactor: 2 });
await pg.goto(FILE, { waitUntil: 'networkidle', timeout: 45000 }).catch(()=>{});
await pg.evaluate(() => { document.body && (document.body.style.display='block'); });
await pg.waitForTimeout(1500);
const info = await pg.evaluate(() => ({
title: document.title,
deals: document.querySelectorAll('[class*="deal"]').length,
bodyBg: getComputedStyle(document.body).backgroundColor,
}));
console.log(JSON.stringify(info));
await pg.screenshot({ path: join(OUT, 'portal-live.png'), fullPage: false });
console.log('saved reports/portal-live.png');
await b.close();