Travis-CI uses YML-Files to configure the test run. I found only little documentation how to run Selenium tests on Travis-CI. But it is straight forward. The following YML file I took from a personal project of mine. (I simplified it a bit for this blog post.):
language: python python: - 2.6 before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - "wget http://selenium.googlecode.com/files/selenium-server-standalone-2.31.0.jar" - "java -jar selenium-server-standalone-2.31.0.jar &" - "export GOCEPT_SELENIUM_BROWSER='*firefox'" install: - python bootstrap.py - bin/buildout script: - bin/test
- Lines 1 – 4: My project is a Python project which currently only runs on Python 2.6. But other Python versions will work as well.
- Lines 5, 6: Firefox needs a running XServer, so we start it first as it takes some seconds to launch. See Travis-CI documentation, too.
- Lines 7, 8: The Selenium server seems not to be installed by default, so get it and launch it.
- Line 9: Tell gocept.selenium to use Firefox to run the tests. (Note: To use the new Webdriver-API in the upcoming version 2 of gocept.selenium you have to set other environment variables.)
- Lines 10 – 14: Install the project and run the tests as usual. (The example uses zc.buildout to do this.)
Note: Although I use the Firefox which is installed by default on the Travis-CI machine, I did not yet find out which version it is.