We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Hi,
I created a new project and changed the karma.conf.js file as described in your post (also copied your file from GitHub).
Unfortunately, it does not work. I ran "ng test" on my command-line, and after building modules i get the following output:
28 08 2017 11:07:04.120:WARN [karma]: No captured browser, open http://localhost:9876/
28 08 2017 11:07:04.141:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
28 08 2017 11:07:04.142:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
28 08 2017 11:07:04.218:INFO [launcher]: Starting browser Chrome
28 08 2017 11:08:04.228:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
28 08 2017 11:08:04.364:INFO [launcher]: Trying to start Chrome again (1/2).
28 08 2017 11:09:04.379:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
28 08 2017 11:09:04.573:INFO [launcher]: Trying to start Chrome again (2/2).
28 08 2017 11:10:04.585:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
28 08 2017 11:10:04.651:ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
When I set "logLevel: config.LOG_DEBUG", I get the following snippet:
...
28 08 2017 11:11:26.586:INFO [launcher]: Starting browser Chrome
...
28 08 2017 11:11:38.373:DEBUG [karma]: A browser has connected on socket An2PuwD_gIbmzfPAAAAA
28 08 2017 11:11:41.070:DEBUG [karma]: A browser has connected on socket StDOJg1R_7jwQX5oAAAB
28 08 2017 11:11:44.560:DEBUG [karma]: A browser has connected on socket se_6NS8QhyN233lOAAAC
28 08 2017 11:11:48.512:DEBUG [karma]: A browser has connected on socket HmSCO7MlersOgIHjAAAD
28 08 2017 11:11:54.729:DEBUG [karma]: A browser has connected on socket GG7uCuzIKZlVouixAAAE
28 08 2017 11:12:02.089:DEBUG [karma]: A browser has connected on socket R_tau5UriwWT51AjAAAF
28 08 2017 11:12:26.308:DEBUG [karma]: A browser has connected on socket vATHA00QoktqbBmLAAAG
28 08 2017 11:12:26.591:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
...
The tests run perfeclty with "browsers: ['Chrome']".
I noticed the following output, which is missing in ChromeHeadless mode:
28 08 2017 10:18:52.502:INFO [Chrome 60.0.3112 (Windows 7 0.0.0)]: Connected on socket AdyBftUKEYTROV6RAAAA with id 60318954
It seems as if the connection is not set up correctly in ChromeHeadless mode.
Do you have any idea, why ChromeHeadless does not work?
I'm very thankful for your help.
Best regards,
Fabian
Everything worked fine on my co-workers notebook running Windows 10. I upgraded from Windows 7 to Windows 10 and now ChromeHeadless is running on my notebook, too.
Seems like ChromeHeadless is only running on Windows 10, although a lot of websites say that ChromeHeadless support will be available for Windows in general...
Thanks for posting an update on this and good to hear you got it working.
I'm working on a Linux machine so haven't tried this on Windows at all.
Hello! Thanks for the article! The e2e tests seem to run great, and I put teamcity reporters on them as that's what we use for CI. Unfortunately, I can't get the unit tests to run successfully in headless mode. This is my script in package.json:
"teamcity-test": "ng test --single-run --config teamcity.karma.conf.js --reporters teamcity --progress false",and
teamcity.karma.conf.js
contains the changes you suggested in the article. The issue I see is this:
$ npm run teamcity-test
> tdportal@0.0.0 teamcity-test C:\Users\jakeh\Documents\work\tdportal
> ng test --single-run --config teamcity.karma.conf.js --reporters teamcity --progress false
##teamcity[blockOpened name='JavaScript Unit Tests']
24 08 2017 16:53:55.433:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
24 08 2017 16:53:55.436:INFO [launcher]: Launching browser ChromeHeadless with unlimited conc
urrency
24 08 2017 16:53:55.440:INFO [launcher]: Starting browser Chrome
24 08 2017 16:54:12.808:INFO [HeadlessChrome 0.0.0 (Windows 10 0.0.0)]: Connected on socket f
xfM1abewGZS__HIAAAA with id 13585545
24 08 2017 16:54:22.808:WARN [HeadlessChrome 0.0.0 (Windows 10 0.0.0)]: Disconnected (1 times
), because no message in 10000 ms.
HeadlessChrome 0.0.0 (Windows 10 0.0.0) ERROR
Disconnected, because no message in 10000 ms.
HeadlessChrome 0.0.0 (Windows 10 0.0.0) ERROR
Disconnected, because no message in 10000 ms.
##teamcity[blockClosed name='JavaScript Unit Tests']
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tdportal@0.0.0 teamcity-test: `ng test --single-run --config teamcity.karma.conf.js
--reporters teamcity --progress false`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tdportal@0.0.0 teamcity-test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output a
bove.
Any ideas on what could be going wrong?
What version of Chrome are you using?
Headless mode is available on Mac and Linux in Chrome 59. Windows support is coming in Chrome 60.
I finally got it to work but making it wait longer than 10 seconds before timing out. 30 seconds got it going. I was using version 60 the whole time though...
We run Protractor E2E using primarily Chrome (build 59); however, due to our IT policy the Chrome 59 unpacked extensions are getting blocked - showing message "Loading of unpacked extensions is disabled by the administrator".
Fortunately, we can click on the OK button to remove the warning message. Then the Chrome E2e scripts continue to run, and complete successfully.
The big question is: what exactly needs to be on the white list for approved extensions ? And since the automation extension is unpacked at run time, it's difficult to tell IT what exactly to allow.
There is a `AppData\Local\Temp\scoped_dir33\internal\` folder which contains a manifest.json file with some properties, so perhaps the "key" property and the "name" property can be used to communicate to our IT department.
Any advice on SO would be appreciated also (https://stackoverflow.com/q... ).
best regards,
Bob
Sorry, don't really know anything about that issue. Hope you get it sorted.
Thanks! :)
What linux terminal did you use?
In the screenshot it's the embedded terminal in Visual Studio Code. Or if you mean what shell it is, it's zsh with https://github.com/bhilburn... ;)
Nice article!
I've followed all the steps but at the end (when "ng test") the process still opens a Chrome window but with no content. Using it in a Jenkins pipeline throws an error as long as it tries to open it.
Am I missing here? Any updates from this point?
Thanks a lot in advance,
Cristóbal
Hi Cristóbal. What version of Chrome do you have installed (check running
google-chrome --version
on CLI or open chrome://version in the browser). You need version 59 or later. Also, what operating system are you running? Headless mode is only supported on Linux and Mac, so if you are on Windows it's not going to work.
If you have compatible version & OS, then you can see if it works by executing it on CLI, for example
google-chrome --headless --disable-gpu --remote-debugging-port=9222 https://google.com
and if you get no errors and no browser window pops open, it should work. You can then open http://localhost:9222/ in another browser to get into dev tools of the headless browser.
See this article https://developers.google.c... for more information about what you can do with the headless mode, like taking sreenshots etc.
I am not able to login to my application using chrome headless. The application uses google authentication.
OS:- Windows
Thank you for the write-up! It took me less than a minute to successfully switch, thanks to your clear instructions ;)