PATCH: Feature/1525 headless mode deprecation #1535
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Puppeteer defaults to
"new"
headless mode, as per the feature request in #1525, also discussed in #1485.Playwright, on the other hand, will remain
headless: true
by default, as"new"
mode is not supported without some configuration overhead. And speaking of Playwright...Important
#1534 is fixed, which I found while exploring the above-mentioned caveats of
"new"
mode.This should be considered for an immediate patch
In the end, we support
"new"
headless mode in Playwright, but only when set by a Backstop configuration file.I also addressed a fix for GitHub Actions
npm run integration-test
error:Error: Process completed with exit code 254.
.Any and all input welcome! We want to be safe, but at the same time, want to support the cutting-edge and standards for Playwright, Puppeteer, and the various browser vendors and teams.
Details
Puppeteer
"new"
headless modePlaywright
From what I've gathered, Playwright is not planning to support
"new"
mode at this point in time. There are performance considerations for their users, so they make it more challenging to use the new mode.Once Playwright supports
"new"
mode, we should discuss enforcing this default for Playwright, but until then, this is a user configuration.Problem
Playwright expects a boolean for headless mode.
Solution
Override Playwrights default args.
We evaluate whether a user is trying to pass
headless
as a string, and includeignoreDefaultArgs: ["--headless"]
, which allows a string to be passed.We set the property
headless: true
if"new"
is passed, and include--headless=new
in the finalplaywrightArgs
sent to the runner.Notes
Example Playwright
headless: 'new'
errorExtra
I started adding inline documentation, which are a nice addition to overall developer experience. The workarounds for Playwright
"new"
headless mode are commented on for future reference.