Running headless Jasmine tests with Jenkins

Getting the jasmine tests up and running on Jenkins had a few small caveats to the docs .. hope someone finds this helpful!

A list of troubles and thier shooting :)

  1. No module named wsgiserver2

Solution: Apparently, pip install cherrypy is broken, so you need to do the following after you have run pip install jasmine:

pip uninstall cherrypy
pip install --no-use-wheel CherryPy

This works locally, but in Jenkins, you'll run into trouble when it prompts you. The fix is to pipe "yes" to the script (which is pretty cool!)

/usr/bin/yes | pip uninstall CherryPy

Next, running the actual tests is just a case of:

jasmine-ci 

Only problem is that jasmine-ci by default uses the Firefox browser. If your Jenkins server does not have a screen (quite likely), then this might cause issues such as: "RuntimeError: Could not find firefox in your system PATH. Please specify the firefox binary location or install firefox"

The easy way round this is just to use phantomjs:

Install Phantomjs

npm install -g phantomjs

Specify the browser

jasmine-ci --browser phantomjs

Finally, my build process looked like this (two build steps using the ShinyPanda virtualenv plugin)

Step 1: setup

pip install jasmine
/usr/bin/yes | pip uninstall CherryPy
pip install --no-use-wheel CherryPy

Step 2: run the tests

jasmine-ci  --browser phantomjs

Result

[workspace] $ /bin/sh -xe /tmp/shiningpanda7111320138862971904.sh
+ jasmine-ci --browser phantomjs

      _                     _
     | |                   (_)
     | | __ _ ___ _ __ ___  _ _ __   ___
 _   | |/ _` / __| '_ ` _ \| | '_ \ / _ \
| |__| | (_| \__ \ | | | | | | | | |  __/
 \____/ \__,_|___/_| |_| |_|_|_| |_|\___|

[0;33m*[0m[0;32m.[0m

2 specs, 0 failed, 1 pending

Resources: