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,1500)); async function probe(key){ if(key){ await p.click(`[data-shader-switch="${key}"]`); await new Promise(r=>setTimeout(r,1000)); } const el = await p.$('[data-shader-demo]'); await el.screenshot({path:'/tmp/demo.png'}); const {data,info}=await sharp('/tmp/demo.png').raw().toBuffer({resolveWithObject:true}); let n=info.width*info.height,rs=0,gs=0,bs=0; const cols=new Set(); for(let i=0;i>5},${data[i+1]>>5},${data[i+2]>>5}`); } return { key:key||'mesh', avg:[Math.round(rs/n),Math.round(gs/n),Math.round(bs/n)], distinct:cols.size }; } console.log(JSON.stringify(await probe())); console.log(JSON.stringify(await probe('grain'))); console.log(JSON.stringify(await probe('voronoi'))); console.log(JSON.stringify(await probe('staticMesh'))); await b.close();