21 lines
1.1 KiB
JavaScript
21 lines
1.1 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();
|
|
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,500));
|
|
// достанем mount через глобальный хук: ShaderMount сохраняет себя в parentElement.paperShaderMount
|
|
const r = await p.evaluate(async()=>{
|
|
const wrap=document.querySelector('[data-shader-demo] .card-shader');
|
|
const m=wrap.paperShaderMount;
|
|
if(!m) return {hasMount:false};
|
|
const f1=m.getCurrentFrame();
|
|
await new Promise(r=>setTimeout(r,600));
|
|
const f2=m.getCurrentFrame();
|
|
return { hasMount:true, frame1:f1, frame2:f2, rafRunning: f2>f1, speed: m.speed, inViewport: m.isInViewport, currentSpeed: m.currentSpeed };
|
|
});
|
|
console.log(JSON.stringify(r,null,1));
|
|
await b.close();
|