Initial commit 🚀
This commit is contained in:
commit
fd58a8d32f
235 files changed
+19775
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { chromium } from 'playwright';
|
||||
const [,, url, prefix, selector, width = '390'] = process.argv;
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage({ viewport: { width: Number(width), height: 900 } });
|
||||
await page.goto(url, { waitUntil: 'networkidle' });
|
||||
const root = page.locator(selector);
|
||||
const tabs = root.locator('[role="tab"]');
|
||||
const n = await tabs.count();
|
||||
for (let i = 0; i < n; i++) {
|
||||
await tabs.nth(i).click();
|
||||
await page.waitForTimeout(500);
|
||||
const panel = root.locator('[role="tabpanel"][data-open]').first();
|
||||
await panel.scrollIntoViewIfNeeded();
|
||||
await page.waitForTimeout(200);
|
||||
await panel.screenshot({ path: `${prefix}-${i}.png` });
|
||||
}
|
||||
console.log('panels', n);
|
||||
await browser.close();
|
||||
Reference in new issue
Block a user