Selenium on Travis may seem impossible because Travis has no window manager, instead it’s possible thank to xvfb and even easy to setup.
First of all, ensure to setup your app to use selenium for integration tests. Then push your stuff. Travis tests will fail (because it doesn’t know about selenium).
Now, let Travis meet Selenium!
We have to enable the virtual framebuffer on travis. You can do this appending the following to your
before_script: - "sh -e /etc/init.d/xvfb start" - "export DISPLAY=99:0"
We also need to download and execute selenium. To do this add the following (always inside
- "wget http://selenium-release.storage.googleapis.com/2.43/selenium-server-standalone-2.43.1.jar" - "java -jar selenium-server-standalone-2.43.1.jar > /dev/null &"
.travis.yml changes and push. Travis tests will NOW pass 🙂