fix(ci): markdown screenshot example
This commit is contained in:
4
.github/scripts/markdown_example.mjs
vendored
4
.github/scripts/markdown_example.mjs
vendored
@@ -13,8 +13,10 @@ const page = await browser.newPage()
|
|||||||
//Select markdown example and take screenshot
|
//Select markdown example and take screenshot
|
||||||
await page.setViewport({width: 600, height: 600})
|
await page.setViewport({width: 600, height: 600})
|
||||||
await page.goto("https://github.com/lowlighter/metrics/blob/examples/metrics.markdown.md")
|
await page.goto("https://github.com/lowlighter/metrics/blob/examples/metrics.markdown.md")
|
||||||
|
await page.waitForSelector("article.markdown-body")
|
||||||
|
await new Promise(solve => setTimeout(solve, 4000))
|
||||||
const clip = await page.evaluate(() => {
|
const clip = await page.evaluate(() => {
|
||||||
const {x, y, width, height} = document.querySelector("#readme").getBoundingClientRect()
|
const {x, y, width, height} = document.querySelector("article.markdown-body").getBoundingClientRect()
|
||||||
return {x, y, width, height}
|
return {x, y, width, height}
|
||||||
})
|
})
|
||||||
await page.screenshot({type: "png", path: "/tmp/metrics.markdown.png", clip, omitBackground: true})
|
await page.screenshot({type: "png", path: "/tmp/metrics.markdown.png", clip, omitBackground: true})
|
||||||
|
|||||||
Reference in New Issue
Block a user