-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChromeHeadless can't run as root with --no-sandbox anymore #158
Comments
Workaround: browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
}, |
@boboldehampsink Is it assumed that your actual configuration also has |
When specifying the browser as |
This worked for us. Thanks, @boboldehampsink |
Worked for me too. Thanks. |
Solution trouvée ici : karma-runner/karma-chrome-launcher#158
Worked for me too. Thanks guys! Keywords: CodeBuild, Karma, Chrome |
boboldehampsink, sorry, but where should this workaround be written? Is it about docker? |
In karma config |
Sorry for the rookie question: and where should I put this text? browsers: ['ChromeHeadlessNoSandbox'], Where is this karma config? |
@DragonRus By default, most projects have Karma configuration stored in a file named "karma.conf.js." However, that is just the default; the configuration file could be named anything and passed to Karma like this: If your project doesn't have a configuration file, you can generate it by running |
I was not aware of the ability to define custom launchers. I would consider it very helpful if this was added to the README. |
Motivation for this change: As a tester, I want to execute npm unit tests in a headless chrome environment. Notes on implementation: * Running headless chrome requires verion chrome 59 or greater[1] * --no-sandbox flag is a workaround for running as root[2] * HeadlessChrome base was added in karma-chrome-launcher v2.1.0[3] - upgrading to this package caused a CHROME_BIN not set error[4]. Setting CHROME_BIN to chromium-browser fixes the issue. * Using Chrome without the upgraded packages causes an error during the coverage report generation - TypeError: Cannot read property 'start' of undefined[5] [1] https://github.com/karma-runner/karma-chrome-launcher#available-browsers [2] karma-runner/karma-chrome-launcher#158 [3] https://github.com/karma-runner/karma-chrome-launcher/releases/tag/v2.1.0 [4] http://paste.openstack.org/show/715433/ [5] https://review.openstack.org/#/c/456556/9 Change-Id: I907708d73b5fe5345f3a56d8d638c51e7d3aa6f7
The Travis CI build for wikimedia/oojs has been failing since January 2018 due to an incompatibility between Travis' Docker configuration, and Chrome's sandboxing feature. The --no-sandbox flag is a documented workaround. The alternative being to switch to sudo-enabled builds, but those are slower, and we don't need sandboxing within Travis CI docker builds anyway. https://docs.travis-ci.com/user/chrome karma-runner/karma-chrome-launcher#158 Also: * Rename `saucelabs.browsers.js` to `karma.browsers.js`. * Rename 'qunit karma:other' to 'qunit karma:firefox'. Change-Id: I3b688c9ef12e0c156bb9908d61d959adbc41276f
I keep getting smth like this in bitbucket pipeline.
|
^^ I had something like that in Jenkins. Turned out I had to set the Where module.exports = function (config) {
process.env.CHROME_BIN = require('puppeteer').executablePath()
config.set({
// You may use 'ChromeCanary', 'Chromium' or any other supported browser
browsers: ['Chrome_without_security'],
// you can define custom flags
customLaunchers: {
Chrome_without_security: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
}
});
}; Puppeteer is there to handle any missing Chrome package, of course. |
If you're running Puppeteer directly from Node code, you can provide this flag as follows: |
Thanks! @yuri-wisestamp |
Don't forget to add
It's probably obvious to you, but it took me a minute to figure that out. I hope that helps. |
Hello I just tried the following line code and it works perfectly 💯 run this line in the terminal: or you go here : https://stackoverflow.com/questions/12258086/how-do-i-run-google-chrome-as-root |
@Zicrou or any can give some advice about How it works for you? i will show mine config for compare karma.config
protractor.config
gitlab-ci.yml
definition for npm run test-ci is:
and that is the error give me gitlab jobs in console
I have this version of puppeteer --> "puppeteer": "^1.19.0", i am missing something? thx
|
about this solution i have this setup karma.config
in package.json apply npm run test-ci
gitlab-ci results
|
i solved after see this videos https://youtu.be/tc379GTTgys 100% problem has been fixed :) .. |
That results in a SIGSEGV for me, although the tests appear to pass.
|
For me, my karma.config.js was missing this:
|
My karma.conf.js looks like module.exports = function (config) {
}); but after running npm test Disconnected (0 times) , because no message in 30000 ms. Chrome Headless 92.0.4515.131 (Windows 10) ERROR npm ERR! Test failed. See above for more details. |
bro where i have to save this code i mean can you share location |
THANKS BRO FOR THIS VIDEO MY PROBLEM SOLVED; |
After updating to Chrome 62 and Chromedriver 2.33, I get the following error when running karma tests with ChromeHeadless:
This is in Docker running Ubuntu 16
The text was updated successfully, but these errors were encountered: