I'm working on a sample Angular project generated by yeoman.
I am able to run karma tests locally (I set system variable CHROME_BIN
to point to chromium binary, but this could have been done in more elegant way. Just a quick work-around.)
However, when attempting to produce a successful build with travis, I get following error:
ERROR [launcher]: Cannot start Chrome
Can not find the binary google-chrome
Please set env variable CHROME_BIN
I've followed the steps described here (basically using generator-travis-ci
)
Then tried to fix it with this - got another error:
/home/travis/build.sh: line 142: ./.travis/scripts/install_chrome.sh: Permission denied
It's a standard angular app created with Yeoman - things should work out of the box, whereas reality is different ...
Has anybody successfully configured it?
Software versions I've been using:
user@machine:~/somewhere $ yo -v; grunt --version; bower -v
1.0.4
grunt-cli v0.1.9
grunt v0.4.1
1.2.6
my Travis job: https://travis-ci.org/vucalur/editor-yeoman-test
Option 1: APT Addon
You can make Travis execute Angular tests in Chrome by using the APT Addon to install the
google-chrome-stable
package and run it headless using Xvfb.Option 2: Chrome Addon
Alternatively, if your virtualization environment is Linux Trusty or OS X you can use the Chrome addon in headless mode.
To run e2e tests, update
protractor.conf.js
to specify headless chrome.Use this solution to get it running using the preinstalled Chromium Version in Travis-CI VM: https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076
.travis.yml
karma.conf.js
Based in karma-runner project issue (https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076) You should set
CHROME_BIN
environment variable in your.travis.yml
and configure a customLauncher in your karma file configuration.For example, your .travis.yml file content will be:
And your
karma.conf.js
content:I'm afraid to say that you can only run Firefox (because it's already installed in the VM) and PhantomJS (because it's portable and headless).
Add the following into your
.travis.yml
file to startup Firefox:Then you'll just have to enable Firefox as a Karma browser in your configs.
Documentation