Files
site-portfolio/pulse.mjs
T

21 lines
1.4 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:1500});
await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000});
await new Promise(r=>setTimeout(r,1500));
await p.evaluate(()=>document.querySelector('#sec-all-shaders')?.scrollIntoView());
await new Promise(r=>setTimeout(r,1500));
const r = await p.evaluate(()=>{
const cells=[...document.querySelectorAll('[data-shader-cell="pulsingBorder"]')];
const info=cells.map(c=>{const m=c.querySelector('.card-shader')?.paperShaderMount; return {mounted:!!m, speed:m?.currentSpeed, frame:m?Math.round(m.getCurrentFrame()):null};});
// проверим, что noise-текстура задалась
const m0=cells[0]?.querySelector('.card-shader')?.paperShaderMount;
const texLoc=m0?m0.gl.getUniform(m0.program, m0.gl.getUniformLocation(m0.program,'u_noiseTexture')):null;
return { cellCount: cells.length, info, noiseTexSet: texLoc!==null && texLoc!==undefined };
});
console.log(JSON.stringify(r,null,1));
console.log('ERRS', errs.slice(0,8));
await b.close();