forked from warmachine028/github-super-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtake-snapshot.mjs
More file actions
17 lines (15 loc) · 770 Bytes
/
take-snapshot.mjs
File metadata and controls
17 lines (15 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import puppeteer from 'puppeteer'
const sleep = (ms) => new Promise((res) => setTimeout(res, ms))
const takeSnapShot = async () => {
const url = 'https://github.com/warmachine028/github-super-starter-kit' // Replace with your actual deployed URL
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.setViewport({ width: 1920, height: 1080 })
await page.goto(url)
await page.emulateMediaFeatures([{ name: "prefers-color-scheme", value: "light" }]);
await page.screenshot({ path: '.github/preview-light.png' })
await page.emulateMediaFeatures([{ name: "prefers-color-scheme", value: "dark" }]);
await page.screenshot({ path: '.github/preview-dark.png' })
await browser.close()
}
takeSnapShot()