mirror of
https://github.com/bitbaum/biaslens.git
synced 2026-12-04 05:57:18 +01:00
* Group navigation by task with SiteKit 0.7 * Record navigation acceptance and remaining work
22 lines
759 B
JavaScript
22 lines
759 B
JavaScript
import assert from 'node:assert/strict';
|
|
import { chromium } from 'playwright';
|
|
|
|
const [url, widthArg, heightArg, output] = process.argv.slice(2);
|
|
const width = Number(widthArg);
|
|
const height = Number(heightArg);
|
|
assert.ok(
|
|
url && output && Number.isInteger(width) && width > 0 && Number.isInteger(height) && height > 0,
|
|
);
|
|
const browser = await chromium.launch({
|
|
executablePath: process.env.BROWSER_EXECUTABLE,
|
|
args: ['--no-sandbox', '--disable-dev-shm-usage'],
|
|
});
|
|
try {
|
|
const page = await browser.newPage({ viewport: { width, height }, deviceScaleFactor: 1 });
|
|
await page.goto(url, { waitUntil: 'networkidle' });
|
|
await page.evaluate(() => document.fonts.ready);
|
|
await page.screenshot({ path: output });
|
|
} finally {
|
|
await browser.close();
|
|
}
|