27 lines
1.4 KiB
JavaScript
27 lines
1.4 KiB
JavaScript
import puppeteer from 'puppeteer';
|
|
const b = await puppeteer.launch({ args:['--no-sandbox','--disable-setuid-sandbox','--use-gl=angle','--enable-unsafe-swiftshader'] });
|
|
const p = await b.newPage();
|
|
await p.setViewport({width:1280,height:1000});
|
|
await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000});
|
|
await new Promise(r=>setTimeout(r,1200));
|
|
const info = await p.evaluate(()=>{
|
|
const host=document.querySelector('#sec-shader .card-shader-host');
|
|
const li=host; const card=host.querySelector('.contact-card'); const canvas=host.querySelector('canvas');
|
|
const lr=getComputedStyle(li), cr=getComputedStyle(card), cvr=getComputedStyle(canvas);
|
|
return {
|
|
liDisplay: lr.display, liPosition: lr.position, liW: li.getBoundingClientRect().width,
|
|
cardW: card.getBoundingClientRect().width, cardH: card.getBoundingClientRect().height,
|
|
canvasPointer: cvr.pointerEvents, canvasZ: cvr.zIndex, canvasInset: cvr.position,
|
|
cardPointer: cr.pointerEvents,
|
|
};
|
|
});
|
|
console.log(JSON.stringify(info,null,1));
|
|
// тест клика по ссылке
|
|
const link = await p.$('#sec-shader a.contact-card');
|
|
const box = await link.boundingBox();
|
|
await p.mouse.click(box.x+box.width/2, box.y+box.height/2);
|
|
await new Promise(r=>setTimeout(r,300));
|
|
const url = p.url();
|
|
console.log('after click url:', url, '(same page expected, external link opens new tab)');
|
|
await b.close();
|