From e268e998605399970c8a62a8ec5b9b7978f5e450 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Fri, 12 Nov 2021 14:06:59 +0100 Subject: [PATCH] add captureBeyondViewport flag for Puppeteer Since v5.3.7 Puppeteer does not capture beyond viewport anymore, which could cause some issues for people relying on it. A new flag `captureBeyondViewport` for toggling that setting is introduced in BackstopJS settings as discussed in #1344. --- core/util/runPuppet.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/util/runPuppet.js b/core/util/runPuppet.js index 225c2d4ae..bafe99765 100644 --- a/core/util/runPuppet.js +++ b/core/util/runPuppet.js @@ -385,13 +385,10 @@ async function captureScreenshot (page, browser, selector, selectorMap, config, } const type = config.puppeteerOffscreenCaptureFix ? page : el; - const params = config.puppeteerOffscreenCaptureFix - ? { - captureBeyondViewport: false, - path: path, - clip: box - } - : { captureBeyondViewport: false, path: path }; + const params = { captureBeyondViewport: config.captureBeyondViewport ?? false, path: path }; + if (config.puppeteerOffscreenCaptureFix) { + params.clip = box; + } await type.screenshot(params); } else {