@@ -218,8 +218,10 @@ async function doesItWorkInChrome (t, cfg) {
218218 const margin = ' ' . padStart ( t . _objectPrintDepth || 0 , '.' ) ; // eslint-disable-line no-underscore-dangle
219219
220220 // Since v112, Chrome/Chromium has "new" headless mode, which supports extensions and does not need XVFB
221+ // But there are problems running it through GitHub Actions inside rootfull container,
222+ // so allow to force using "full mode" by setting `CHROME_DISABLE_SANDBOX` in environment.
221223 /* eslint-disable array-element-newline, array-bracket-newline, multiline-comment-style */
222- const runFullModeMode = ! testVersion ( chromeVersion . trim ( ) , '112.0.5614.0' ) ;
224+ const runFullModeMode = process . env . CHROME_DISABLE_SANDBOX || ! testVersion ( chromeVersion . trim ( ) , '112.0.5614.0' ) ;
223225 const browserIgnoreDefaultArgs = [
224226 '--disable-extensions' , // Do not disable extensions when we want to test them ;P
225227 '--disable-background-networking' // Do not prevent browser from force_installing our stuff
@@ -229,7 +231,7 @@ async function doesItWorkInChrome (t, cfg) {
229231 // Without this, puppeteer (or Chromium?) in Alpine container hangs and `newPage()` is never resolved nor failed.
230232 '--disable-gpu'
231233 ] ;
232- if ( true ) {
234+ if ( runFullModeMode ) {
233235 t . comment ( `${ margin } Running full browser, XVFB is required` ) ;
234236 // Make sure we do not run in "old" headless mode because it disables support for extensions
235237 browserIgnoreDefaultArgs . unshift ( '--headless' ) ;
@@ -250,10 +252,6 @@ async function doesItWorkInChrome (t, cfg) {
250252 }
251253 else {
252254 t . comment ( `${ margin } Running browser using "new" headless mode, XVFB is not needed` ) ;
253- // Running by GitHub Action in a rootful Docker sucks, and we have to bring back some of the old stuff.
254- if ( process . env . CHROME_DISABLE_SANDBOX ) {
255- browserArgs . push ( '--no-sandbox' ) ;
256- }
257255 }
258256 /* eslint-enable array-element-newline, array-bracket-newline, multiline-comment-style */
259257
0 commit comments