Files

17 lines
1.2 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('PE '+e.message));
p.on('console', m=>{ if(m.type()==='error') errs.push('CE '+m.text()); });
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,1000));
const a = await p.evaluate(()=>{ const m=document.querySelector('[data-shader-demo] .card-shader')?.paperShaderMount; return m?{speed:m.currentSpeed,frame:m.getCurrentFrame(),inVp:m.isInViewport}:null; });
await new Promise(r=>setTimeout(r,2000));
const c = await p.evaluate(()=>{ const m=document.querySelector('[data-shader-demo] .card-shader')?.paperShaderMount; return m?{speed:m.currentSpeed,frame:m.getCurrentFrame(),inVp:m.isInViewport}:null; });
console.log('A',JSON.stringify(a),'C',JSON.stringify(c));
console.log('ANIMATING:', c && a && c.frame>a.frame && c.speed>0);
console.log('ERRS', errs.slice(0,5));
await b.close();