15 lines
848 B
JavaScript
15 lines
848 B
JavaScript
import { chromium } from 'playwright';
|
|
const browser = await chromium.launch();
|
|
/* Phone: the sweep should still run, the hover state should not exist. */
|
|
const ctx = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true });
|
|
const page = await ctx.newPage();
|
|
await page.goto(process.argv[2], { waitUntil: 'networkidle' });
|
|
await page.locator('.stages__list').scrollIntoViewIfNeeded();
|
|
await page.waitForTimeout(2000);
|
|
console.log('mobile shown:', JSON.stringify(await page.evaluate(() =>
|
|
Array.from(document.querySelectorAll('[data-reveal]')).map((o) => o.hasAttribute('data-shown')))));
|
|
console.log('grid opacity (no hover):', await page.evaluate(() =>
|
|
getComputedStyle(document.querySelector('.grid-object__base')).opacity));
|
|
await page.screenshot({ path: process.argv[3] });
|
|
await browser.close();
|