Skip to content

Commit b67c169

Browse files
authored
fix: adds headless ternary to handle 'new', true, and false in a non-breaking fashion (#1485) (#1486) (#1511)
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
1 parent f0651dc commit b67c169

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,13 @@ ignoreHTTPSErrors: true,
644644
headless: <!!!config.debugWindow>
645645
```
646646

647-
You can add more settings (or override the defaults) with the engineOptions property. (properties are merged)
647+
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.
648648

649649
```json
650650
"engineOptions": {
651651
"ignoreHTTPSErrors": false,
652652
"args": ["--no-sandbox", "--disable-setuid-sandbox"],
653+
"headless": "new",
653654
"gotoParameters": { "waitUntil": "networkidle0" },
654655
}
655656
```

core/util/runPlaywright.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports.createPlaywrightBrowser = async function (config) {
3636
const playwrightArgs = Object.assign(
3737
{},
3838
{
39-
headless: !config.debugWindow
39+
headless: config.debugWindow ? false : config?.engineOptions?.headless || true
4040
},
4141
config.engineOptions
4242
);

core/util/runPuppet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async function processScenarioView (scenario, variantOrScenarioLabelSafe, scenar
7171
{},
7272
{
7373
ignoreHTTPSErrors: true,
74-
headless: !config.debugWindow
74+
headless: config.debugWindow ? false : config?.engineOptions?.headless || true
7575
},
7676
config.engineOptions
7777
);

0 commit comments

Comments
 (0)