From 40dc09aaed0dcb568c2bdfa51875555e2df5dd90 Mon Sep 17 00:00:00 2001 From: Dan Grebb Date: Wed, 22 Nov 2023 13:23:19 -0500 Subject: [PATCH] fix: adds headless ternary to handle 'new', true, and false in a non-breaking fashion (#1485) (#1486) Puppet and Playwright complain and pollute logs with warnings about "new headless mode". This reads the value set in backstop.json, or uses true if 'headless' is not set, or 'new', as a string. README updated with details. Closes: #1485 --- README.md | 3 ++- core/util/runPlaywright.js | 2 +- core/util/runPuppet.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a97c858fc..eb166e1ff 100644 --- a/README.md +++ b/README.md @@ -644,12 +644,13 @@ ignoreHTTPSErrors: true, headless: ``` -You can add more settings (or override the defaults) with the engineOptions property. (properties are merged) +You can add more settings (or override the defaults) with the engineOptions property. (properties are merged). This is where headless mode can also be set to 'new', until "new headless mode" is the default in Puppet/Playwright. ```json "engineOptions": { "ignoreHTTPSErrors": false, "args": ["--no-sandbox", "--disable-setuid-sandbox"], + "headless": "new", "gotoParameters": { "waitUntil": "networkidle0" }, } ``` diff --git a/core/util/runPlaywright.js b/core/util/runPlaywright.js index 3018bae24..9153e19a1 100644 --- a/core/util/runPlaywright.js +++ b/core/util/runPlaywright.js @@ -36,7 +36,7 @@ module.exports.createPlaywrightBrowser = async function (config) { const playwrightArgs = Object.assign( {}, { - headless: !config.debugWindow + headless: config.debugWindow ? false : config?.engineOptions?.headless || true }, config.engineOptions ); diff --git a/core/util/runPuppet.js b/core/util/runPuppet.js index d513fa918..38bc4dcad 100644 --- a/core/util/runPuppet.js +++ b/core/util/runPuppet.js @@ -71,7 +71,7 @@ async function processScenarioView (scenario, variantOrScenarioLabelSafe, scenar {}, { ignoreHTTPSErrors: true, - headless: !config.debugWindow + headless: config.debugWindow ? false : config?.engineOptions?.headless || true }, config.engineOptions );