30 lines
1007 B
JavaScript
30 lines
1007 B
JavaScript
let playwright
|
|
try {
|
|
playwright = await import('playwright')
|
|
} catch (e) {
|
|
console.error('\nPlaywright no está instalado en este entorno.');
|
|
console.error('Instálalo con: npm install -D playwright (en la raíz del repo) y luego ejecuta: npx playwright install');
|
|
process.exitCode = 2
|
|
throw e
|
|
}
|
|
|
|
const { chromium } = playwright;
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const page = await browser.newPage();
|
|
try {
|
|
// Target studio-panel dev server on port 3021
|
|
await page.goto('http://localhost:3021/', { waitUntil: 'networkidle' , timeout: 15000});
|
|
const sheets = await page.evaluate(() => Array.from(document.styleSheets).map(s => s.href || s.ownerNode?.textContent?.slice(0,250) || null));
|
|
console.log('document.styleSheets count =', sheets.length);
|
|
console.log(JSON.stringify(sheets, null, 2));
|
|
} catch (e) {
|
|
console.error('Error:', e.toString());
|
|
process.exitCode = 2;
|
|
} finally {
|
|
await browser.close();
|
|
}
|
|
})();
|
|
|