Files
site-portfolio/clean.mjs
T

23 lines
1.1 KiB
JavaScript

import puppeteer from 'puppeteer';
const b = await puppeteer.launch({ args:['--no-sandbox','--disable-setuid-sandbox','--use-gl=angle','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
const p = await b.newPage();
const errs=[]; p.on('pageerror',e=>errs.push(e.message)); p.on('console',m=>{if(m.type()==='error')errs.push(m.text());});
await p.setViewport({width:1100,height:1400});
await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000});
await new Promise(r=>setTimeout(r,1500));
const r = await p.evaluate(()=>{
const shaderCards=[...document.querySelectorAll('.card-shader[data-shader]')];
const mounted=shaderCards.map(w=>!!w.paperShaderMount);
return {
hasSecShader: !!document.querySelector('#sec-shader'),
hasSecShaderGrid: !!document.querySelector('#sec-shader-grid'),
hasSecContact: !!document.querySelector('#sec-contact'),
totalShaderWraps: shaderCards.length,
allMounted: mounted.every(Boolean),
mountedCount: mounted.filter(Boolean).length,
};
});
console.log(JSON.stringify(r,null,1));
console.log('ERRS', errs.slice(0,5));
await b.close();