9

The information about testing Angular includes an example configuration (of Karma and Protractor) in which it disables the sandbox of the Chrome browser:

browsers: ['Chrome'],
customLaunchers: {
  ChromeHeadlessCI: {
    base: 'ChromeHeadless',
    flags: ['--no-sandbox']
  }
},

and

const config = require('./protractor.conf').config;

config.capabilities = {
  browserName: 'chrome',
  chromeOptions: {
    args: ['--headless', '--no-sandbox']
  }
};

exports.config = config;

But why? Why not leave the sandbox enabled? Is there a good reason to do that? Is it necessary for tests to run properly?

Raedwald
  • 46,613
  • 43
  • 151
  • 237

2 Answers2

3

I'm not sure why the example code disables the sandbox, but for what it's worth, we leave it on in our test suite and everything is fine. We used to specify --no-sandbox just like the examples, but removed it as a workaround to this issue, which was leaving orphaned chrome processes running after the test had completed.

Nathaniel C
  • 524
  • 4
  • 8
2

This is one of the reasons if you are using container for testing.

Sandboxing For security reasons, Google Chrome is unable to provide sandboxing when it is running in the container-based environment. To use Chrome in the container-based environment, pass the --no-sandbox flag to the chrome executable

google-chrome Failed to move to new namespace

snowpeak
  • 797
  • 9
  • 25