This commit is contained in:
Dan Harrin
2023-02-16 13:18:07 +00:00
parent cc57700497
commit 4867619bbe
3 changed files with 6 additions and 6 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

-4
View File
@@ -1,8 +1,4 @@
export default {
home: {
url: '/',
selector: 'body',
},
'app/auth/login': {
url: 'admin/login',
selector: 'body',
+6 -2
View File
@@ -14,15 +14,19 @@ for (const [file, options] of Object.entries(schema)) {
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.setViewport(options.viewport ?? {
width: 1920,
height: 1080,
deviceScaleFactor: 1,
})
await page.goto(`http://localhost:8000/${options.url}`, {
waitUntil: 'networkidle2',
})
const element = await page.waitForSelector(options.selector)
const element = await page.waitForSelector(options.selector)
await element.screenshot({ path: `images/${file}.jpg` })
await element.dispose()
await browser.close()
})()
}