update ai commerce section
This commit is contained in:
36
scripts/take-screenshot.js
Normal file
36
scripts/take-screenshot.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
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 (375px)
|
||||
await page.setViewport({ width: 375, 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();
|
||||
})();
|
||||
Reference in New Issue
Block a user