Chrome not captured when running tests on Travis #1144

Closed
justinmanley opened this Issue Jul 24, 2014 · 10 comments

Projects

None yet

8 participants

@justinmanley

Karma tests are failing on Travis when it tries to run tests in Chrome.

Since I posted this issue on the travis-ci issues page, I've noticed that the tests run successfully in PhantomJS, so I'm wondering if this error may be traced back to Karma.

The error message is:

INFO [launcher]: Starting browser Chrome
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (1/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (2/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.

Detailed issue report here: travis-ci/travis-ci#2555

@pkozlowski-opensource

@manleyjster AFAIK Travis-CI VMs don't have Chrome installed, by default only FFox is present. You could use this one but in this case you need to add

  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"

to your TravisCI install as explained here: http://docs.travis-ci.com/user/gui-and-headless-browsers/

Closing as this is an issue with what TravisCI provides and not a bug in Karma. If you want to test on multiple browsers you could use services like SaucLabs or similar.

@justinmanley

Thanks for responding - and thanks for the link to the GUI & Headless Browsers article - I hadn't seen that!

I take your point, but I still think it's possible that Karma is implicated in this issue.

If you look through my original issue report, you'll see that I was aware that Chrome is not installed by default on Travis CI and had added the following to my .travis.yml:

- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
- sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
- sudo apt-get update -qq
- sudo apt-get install -qq google-chrome-stable

At your suggestion (from above), I added:

- export DISPLAY=:0
- sh -e /etc/init.d/xvfb start

to my .travis.yml, but to no effect. As before, Karma started Chrome successfully, then failed to capture it: build 31091782.

Evidently it's more complicated than simply needing to start up the virtual X frame buffer.

@pkozlowski-opensource

@manleyjster I'm just going over various issues on Travis-CI and people are reporting various things about being able to install & start chrome in the Travis VM. Did you try to verify that chrome actually starts properly after you install it?

I still believe that the issue you are facing is due to the chrome not being installed properly and I'm pretty positive that this is not Karma problem. But yes, could you try to add a command to your Travis-CI sript that would open chrome?

@henvic
henvic commented Aug 21, 2014

👍 same problem here.

@henvic henvic referenced this issue in liferay/senna.js Aug 21, 2014
Closed

Adding Karma and Travis CI #24

@pkozlowski-opensource

@henvic could you elaborate? Did you try to verify that Chrome is properly installed on Travis-CI and operational? From what I can see on various info on the net installing Chrome on Travis requires some mad science, ex.: https://twitter.com/domenic/status/502571560944021506

For now it still sounds like Chrome install problem on Travis but I don't have free cycles left to investigate it further. Although I would be interested in the solution :-)

@MrOrz
MrOrz commented Aug 27, 2014

I did not got Google Chrome running on Travis-CI either. It installs but we are not sure if it starts up.

I happened to got it running on using the Chromium pre-installed in the Travis-CI VM though, by setting CHROME_BIN, the frame-buffer things, and the --no-sandbox flag.

https://github.com/MrOrz/SeeSS/blob/master/.travis.yml
https://github.com/MrOrz/SeeSS/blob/master/test/karma.conf.js

Build log: https://travis-ci.org/MrOrz/SeeSS/builds/33732670

@janpaepke

Thanks, MrOrz!
Your solution works! Awesome! :)

@binji binji added a commit to binji/naclbind.js that referenced this issue Sep 30, 2014
@binji binji Add Travis support for karma
Using suggestions from here:
karma-runner/karma#1144

This is currently using chromium, which probably does not have NaCl.
I'll likely need to download a prebuilt binary from the Chrome
waterfall.
b56019b
@djindjic

👍 @MrOrz

@gempesaw gempesaw added a commit to honeydew-sc/honeydew-ng that referenced this issue Mar 30, 2015
@gempesaw gempesaw Try chromium for TravisCI tests f839ca9
@gempesaw gempesaw added a commit to honeydew-sc/honeydew-ng that referenced this issue Mar 30, 2015
@gempesaw gempesaw Try chromium for TravisCI tests 5c98069
@gempesaw gempesaw added a commit to honeydew-sc/honeydew-ng that referenced this issue Mar 30, 2015
@gempesaw gempesaw Try chromium for TravisCI tests e3b3184
@shamansir shamansir added a commit to shamansir/rpd that referenced this issue Jun 20, 2015
@shamansir shamansir try the solution by @MrOrz from karma-runner/karma#1144 to run Chrome…
… on Travis
46517b6
@dignifiedquire
Member

Not an issue with karma, so closing.

@STRML STRML added a commit to mzabriskie/react-draggable that referenced this issue Oct 27, 2015
@STRML STRML Chrome fixes for travis - karma-runner/karma#1144 ac76fb4
@ybiquitous ybiquitous added a commit to ybiquitous/backbone.deepmodel that referenced this issue Dec 8, 2015
@ybiquitous ybiquitous Added Karma+Chrome setting on Travis CI. e0233a3
@MrAntix MrAntix added a commit to MrAntix/jquery-clean that referenced this issue Mar 15, 2016
@MrAntix MrAntix try fix for running chrome 2a07836
@inf3rno
Contributor
inf3rno commented Aug 5, 2016

@MrOrz Thanks! The no-sandbox flag was missing. :-)

@davidstutz davidstutz added a commit to davidstutz/jasmine-travis-example that referenced this issue Aug 16, 2016
@davidstutz davidstutz Another try from here: karma-runner/karma#1144 (comment) 14e26f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment