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(); await p.setViewport({width:1100,height:1300}); await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000}); await new Promise(r=>setTimeout(r,1200)); await p.evaluate(()=>document.querySelector('[data-shader-demo]').scrollIntoView({block:'center'})); await new Promise(r=>setTimeout(r,300)); // достанем mount из WeakMap нельзя, но проверим через глобальный хук: переопределим requestAnimationFrame до загрузки? уже поздно. // Вместо этого — вручную создадим ShaderMount и проверим frame рост + readPixels внутри rAF const res = await p.evaluate(async()=>{ const mod = await import('/vendor/paper-shaders/index.js'); const wrap = document.querySelector('[data-shader-demo] .card-shader'); const cv = wrap.querySelector('canvas'); // создадим свой mount того же шейдера в НОВЫЙ контейнер чтобы не конфликтовать const host = document.createElement('div'); host.style.cssText='position:fixed;left:0;top:0;width:200px;height:120px;z-index:9999'; document.body.appendChild(host); const m = new mod.ShaderMount(host, mod.meshGradientFragmentShader, { u_colors:['#7c5cff','#00c2c7','#ff5c8a'], u_colorsCount:3, u_distortion:0.6, u_swirl:0.4, u_grainMixer:0.08, u_grainOverlay:0.04 }, {preserveDrawingBuffer:true}, 0.2); await new Promise(r=>setTimeout(r,500)); const frame1 = m.getCurrentFrame(); await new Promise(r=>setTimeout(r,500)); const frame2 = m.getCurrentFrame(); // читаем пиксель через свой canvas с preserveDrawingBuffer const c2 = host.querySelector('canvas'); const gl = c2.getContext('webgl', {preserveDrawingBuffer:true}) || c2.getContext('webgl2',{preserveDrawingBuffer:true}); let px='n/a'; if(gl){ const a=new Uint8Array(4); gl.readPixels(10,10,1,1,gl.RGBA,gl.UNSIGNED_BYTE,a); px=Array.from(a); } m.dispose(); host.remove(); return { frame1, frame2, animated: frame2>frame1, px }; }); console.log(JSON.stringify(res,null,1)); await b.close();