import puppeteer from 'puppeteer'; import sharp from 'sharp'; 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)); const top = await p.evaluate(()=>{ const r=document.querySelector('[data-shader-demo]').getBoundingClientRect(); return r.top+window.scrollY; }); await p.evaluate((t)=>window.scrollTo(0, t-150), top); await new Promise(r=>setTimeout(r,700)); async function region(){ await p.screenshot({path:'/tmp/r.png'}); const rect = await p.evaluate(()=>{ const r=document.querySelector('[data-shader-demo]').getBoundingClientRect(); return {x:r.x,y:r.y,w:r.width,h:r.height}; }); const {data,info}=await sharp('/tmp/r.png').raw().toBuffer({resolveWithObject:true}); // хеш центральной полосы const samples=[]; const y=Math.floor(rect.y+rect.h*0.4); for(let x=Math.floor(rect.x+20); xsetTimeout(r,800)); const c=await region(); console.log('moved:', a!==c); console.log('t1 head:', a.slice(0,60)); console.log('t2 head:', c.slice(0,60)); await b.close();