Headless Chrome times out without executing any tests
See original GitHub issueI have configured the headless chrome in my project getting rid of Phantom. When I run the tests on my OSX machine, all the tests get executed with the test runner on the headless chrome. But the same doesn’t happen on my linux server. It connects to the socket and then after some time, it disconnects and shows the error message saying “Karma tests failed”. Error:
25 09 2017 13:56:19.075:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/build/
25 09 2017 13:56:19.076:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
25 09 2017 13:56:19.080:INFO [launcher]: Starting browser Chrome
25 09 2017 13:56:19.263:INFO [HeadlessChrome 0.0.0 (Linux 0.0.0)]: Connected on socket zDM7md2A7Je8kqsPAAAA with id 1679961
25 09 2017 13:58:19.552:WARN [HeadlessChrome 0.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 120000 ms.
HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR
Disconnected, because no message in 120000 ms.
Here is my configuration:
const ChromiumRevision = require('puppeteer/package.json').puppeteer.chromium_revision;
const Downloader = require('puppeteer/utils/ChromiumDownloader');
const revisionInfo = Downloader.revisionInfo(Downloader.currentPlatform(), ChromiumRevision);
process.env.CHROME_BIN = revisionInfo.executablePath;
module.exports = function (config) {
config.set({
basePath: 'build/',
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
],
files: ['tests.js'],
customLaunchers: {
'ChromeHeadless': {
base: 'Chrome',
flags: [
'--headless',
'--disable-gpu',
// Without a remote debugging port, Google Chrome exits immediately.
'--remote-debugging-port=9222'
],
debug: true
}
},
autoWatch: false,
browsers: ['ChromeHeadless'],
singleRun: true,
browserNoActivityTimeout: 120000,
urlRoot: '/build/'
})
}
Using karma-chrome-launcher: "2.1.1"
. Tried with the latest 2.2.0
version too. Tried with karma: "1.5.0"
, "1.6.0"
, and the latest "1.7.1"
.
I tried other flags like “--no-sandbox
”, “--disable-web-security
” as suggested on a bunch of issues on karma repo. But still no luck. Is there a fix or workaround for this issue? Is there a reason why it’s not working on the Linux server [Ubuntu Server 14.04.5 LTS].
Issue Analytics
- State:
- Created 6 years ago
- Reactions:97
- Comments:132 (2 by maintainers)
Top GitHub Comments
try
npm install && npm rebuild && npm test
This worked for meAlso adding
--no-sandbox
to the flag list helpsnpm install && npm rebuild && npm test
appears to have worked for us.