Files
OneOS1.2/scripts/shot-ds-controls.mjs

32 lines
1.1 KiB
JavaScript

import puppeteer from 'puppeteer';
import path from 'path';
async function main() {
const browser = await puppeteer.launch({
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 1200, deviceScaleFactor: 2 });
const url = 'http://localhost:51720/prototypes/oneos-v2';
await page.goto(url, { waitUntil: 'networkidle2', timeout: 15000 });
await new Promise(r => setTimeout(r, 2000));
await page.evaluate(() => {
const el = document.getElementById('sec-controls');
if (el) el.scrollIntoView({ behavior: 'auto', block: 'start' });
});
await new Promise(r => setTimeout(r, 1000));
const shotControlsPath = path.resolve('.tmp-ds-showcase-controls-optimized.png');
await page.screenshot({ path: shotControlsPath, fullPage: false });
console.log(`Captured Controls section screenshot to ${shotControlsPath}`);
await browser.close();
}
main().catch(console.error);