25 lines
1.3 KiB
JavaScript
25 lines
1.3 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:1400});
|
|
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('#sec-shader-grid')?.scrollIntoView());
|
|
await new Promise(r=>setTimeout(r,800));
|
|
const r = await p.evaluate(()=>{
|
|
const shaderCard=document.querySelector('#sec-shader-grid .neu-card--shader');
|
|
const plainCard=document.querySelector('#sec-shader-grid .neu-card:not(.neu-card--shader)');
|
|
const cs=getComputedStyle(shaderCard);
|
|
const after=getComputedStyle(shaderCard,'::after');
|
|
const plain=getComputedStyle(plainCard);
|
|
const countShadows=(s)=>s.split(/,(?![^()]*\))/).filter(x=>x.trim()).length;
|
|
return {
|
|
shaderBoxShadow: cs.boxShadow.slice(0,80)+'...', shaderShadowCount: countShadows(cs.boxShadow),
|
|
afterBoxShadow: after.boxShadow.slice(0,80)+'...', afterShadowCount: countShadows(after.boxShadow),
|
|
afterZ: after.zIndex, beforeZ: getComputedStyle(shaderCard,'::before').zIndex,
|
|
plainShadowCount: countShadows(plain.boxShadow),
|
|
};
|
|
});
|
|
console.log(JSON.stringify(r,null,1));
|
|
await b.close();
|