Initial commit 🚀
This commit is contained in:
commit
fd58a8d32f
235 files changed
+19775
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { chromium } from 'playwright';
|
||||
/* Jumps to card 3 via its dot, then back to card 1 via its dot, and reports where the page rests. */
|
||||
const [,, url, width = '1440', height = '900'] = process.argv;
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage({ viewport: { width: Number(width), height: Number(height) } });
|
||||
await page.goto(url, { waitUntil: 'networkidle' });
|
||||
const snaps = await page.evaluate(() => Array.from(document.querySelectorAll('[data-deck-snap]')).map((a) => Math.round(a.getBoundingClientRect().top + window.scrollY - parseFloat(getComputedStyle(a).scrollMarginTop))));
|
||||
const dots = page.locator('[data-deck-dots] a');
|
||||
await page.evaluate((y) => window.scrollTo(0, y), snaps[2]);
|
||||
await page.waitForTimeout(800);
|
||||
const before = await page.evaluate(() => Math.round(window.scrollY));
|
||||
await dots.nth(0).click();
|
||||
await page.waitForTimeout(1500);
|
||||
const back = await page.evaluate(() => Math.round(window.scrollY));
|
||||
await dots.nth(3).click();
|
||||
await page.waitForTimeout(1500);
|
||||
const fwd = await page.evaluate(() => Math.round(window.scrollY));
|
||||
const active = await page.evaluate(() => Array.from(document.querySelectorAll('[data-deck-dots] a')).map((a) => a.getAttribute('aria-current') === 'true'));
|
||||
const hint = await page.evaluate(() => { const h = document.querySelector('[data-deck-hint]'); return { href: h?.getAttribute('href'), last: h?.hasAttribute('data-last') }; });
|
||||
console.log({ snaps, before, backTo1: back, expected1: snaps[0], fwdTo4: fwd, expected4: snaps[3], active, hint });
|
||||
await browser.close();
|
||||
Reference in new issue
Block a user