Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions lib/funcPerform.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,23 +920,14 @@ module.exports = {

logger.debug('start screenshot')

if (jobItem.project_id === 21292 && parseInt(jobItem.breakpoint) === 1440 && !page.isClosed()) {
const hasScrollHash = await page.evaluate(() => window.location.hash === '#scroll')
if (hasScrollHash) {
await page.evaluate(() => {
const scrollValue = 230
window.scrollTo(0, scrollValue)

if (document.scrollingElement) {
document.scrollingElement.scrollTop = scrollValue
}

window.dispatchEvent(new Event('scroll', { bubbles: true }))
document.dispatchEvent(new Event('scroll', { bubbles: true }))
})
await page.waitForTimeout(500)
await safeEval(page, async () => {
if (!document.fonts || typeof document.fonts.ready?.then !== 'function') {
return null
}
}

await document.fonts.ready
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))
}, undefined, 'fonts.ready wait (pre-screenshot)')

await captureScreenshot(page, filename, isWebkit)

Expand Down