17 lines
1.0 KiB
JavaScript
17 lines
1.0 KiB
JavaScript
import puppeteer from 'puppeteer';
|
|
import crypto from 'crypto';
|
|
import fs from 'fs';
|
|
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,1000));
|
|
await p.evaluate(()=>document.querySelector('[data-shader-demo]').scrollIntoView({block:'center'}));
|
|
await new Promise(r=>setTimeout(r,500));
|
|
const h1 = await p.screenshot({encoding:'binary'}); await fs.promises.writeFile('/tmp/s1.png', h1);
|
|
await new Promise(r=>setTimeout(r,1500));
|
|
const h2 = await p.screenshot({encoding:'binary'}); await fs.promises.writeFile('/tmp/s2.png', h2);
|
|
const m1=crypto.createHash('md5').update(h1).digest('hex'); const m2=crypto.createHash('md5').update(h2).digest('hex');
|
|
console.log('bytes', h1.length, h2.length, 'md5equal', m1===m2);
|
|
await b.close();
|