const puppeteer = require('puppeteer-core'); const path = require('path'); (async () => { const browser = await puppeteer.launch({ executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true }); const page = await browser.newPage(); // Desktop Screenshot (1440px) await page.setViewport({ width: 1440, height: 900 }); try { await page.goto('http://localhost:3000', { waitUntil: 'networkidle2', timeout: 15000 }); console.log('Successfully navigated to http://localhost:3000'); } catch (err) { console.error('Navigation failed:', err); await browser.close(); process.exit(1); } const desktopPath = path.join(__dirname, 'desktop_screenshot.png'); await page.screenshot({ path: desktopPath, fullPage: true }); console.log('Saved desktop screenshot to:', desktopPath); // Mobile Screenshot (390px) await page.setViewport({ width: 390, height: 844, isMobile: true, hasTouch: true }); await page.goto('http://localhost:3000', { waitUntil: 'networkidle2', timeout: 15000 }); const mobilePath = path.join(__dirname, 'mobile_screenshot.png'); await page.screenshot({ path: mobilePath, fullPage: true }); console.log('Saved mobile screenshot to:', mobilePath); await browser.close(); })();