fix(ci): markdown screenshot example

This commit is contained in:
Simon Lecoq
2023-08-24 23:37:29 -04:00
parent 8f3910382f
commit d2a73059b5

View File

@@ -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})