Firefox doesn't start on CI but locally

I have a problem trying to run the grunt test step from openmrs-module-bahmniapps on my CI (Buildkite). On my local machine I have no problem, everything runs ok. I’m running the steps on the release-0.89 branch on a forked repo.

I have Firefox already installed on the CI server which is a Linux Ubuntu 14.04.5 LTS. From firefox -v I get Mozilla Firefox 55.0.2 and also I added the FIREFOX_BIN env var with the location /usr/bin/firefox.

But for any reason that I don’t know it can’t start Firefox. And this is the output I get:

12 09 2017 01:57:30.860:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
12 09 2017 01:57:30.865:INFO [launcher]: Starting browser Firefox
12 09 2017 01:57:30.896:ERROR [launcher]: Cannot start Firefox
 
12 09 2017 01:57:30.904:INFO [launcher]: Trying to start Firefox again (1/2).
12 09 2017 01:57:30.932:ERROR [launcher]: Cannot start Firefox
 
12 09 2017 01:57:30.933:INFO [launcher]: Trying to start Firefox again (2/2).
12 09 2017 01:57:30.960:ERROR [launcher]: Cannot start Firefox
 
12 09 2017 01:57:30.961:ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
Warning: Task "karma:unit" failed.a Use --force to continue.
 
Aborted due to warnings.

I have been looking to get this work for a long day, but I haven’t had success so far.

Can someone give me ideas to solve this?

Anymore logs as to why it’s not launching from the system itself?

@r0bby I set up the logLevel: config.LOG_DEBUG on the Karma config, and this is what I can see related to the previous output.

12 09 2017 16:04:27.283:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
12 09 2017 16:04:27.289:INFO [launcher]: Starting browser Firefox
12 09 2017 16:04:27.290:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-87727602
12 09 2017 16:04:27.291:DEBUG [launcher]: firefox http://localhost:9876/?id=87727602 -profile /tmp/karma-87727602 -no-remote
12 09 2017 16:04:27.679:DEBUG [launcher]: Process Firefox exited with code 1
12 09 2017 16:04:27.679:ERROR [launcher]: Cannot start Firefox
 
12 09 2017 16:04:27.679:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-87727602
12 09 2017 16:04:27.687:INFO [launcher]: Trying to start Firefox again (1/2).
12 09 2017 16:04:27.689:DEBUG [launcher]: Restarting Firefox
12 09 2017 16:04:27.689:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-87727602
12 09 2017 16:04:27.690:DEBUG [launcher]: firefox http://localhost:9876/?id=87727602 -profile /tmp/karma-87727602 -no-remote
12 09 2017 16:04:27.716:DEBUG [launcher]: Process Firefox exited with code 1
12 09 2017 16:04:27.716:ERROR [launcher]: Cannot start Firefox
 
12 09 2017 16:04:27.716:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-87727602
12 09 2017 16:04:27.717:INFO [launcher]: Trying to start Firefox again (2/2).
12 09 2017 16:04:27.718:DEBUG [launcher]: Restarting Firefox
12 09 2017 16:04:27.718:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-87727602
12 09 2017 16:04:27.718:DEBUG [launcher]: firefox http://localhost:9876/?id=87727602 -profile /tmp/karma-87727602 -no-remote
12 09 2017 16:04:27.746:DEBUG [launcher]: Process Firefox exited with code 1
12 09 2017 16:04:27.746:ERROR [launcher]: Cannot start Firefox
 
12 09 2017 16:04:27.746:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-87727602
12 09 2017 16:04:27.747:ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
12 09 2017 16:04:27.749:DEBUG [karma]: Run complete, exiting.
12 09 2017 16:04:27.750:DEBUG [launcher]: Disconnecting all browsers

We managed to make it work adding this xvfb-run -a to the karma command on the package.json since we don’t have a UI on the CI. So at the end the complete command to run the tests on the CI is xvfb-run -a karma start test/config/karma.conf.js. For some reason it doesn’t work when we run grunt test but it does with npm run test so we let that for the CI and grunt test for local environments.

@sommardahl @ronald721hn

1 Like