Hopefully this will save people bunch of time who have a similar setup to what I have. I initially had issues getting headless selenium RC tests with Firefox running on our build server with Jenkins while they worked fine on my Mac. Here are a couple of notes on how I ultimately got it working:
- Below is the final arquillian.xml config I am using.
- I didn't need to use any custom Firefox profile template (as seen below). The default custom FF profile within the selenium jar will be used.
- The build host on jenkins have the Firefox environment variable set correctly. In our case, this was PATH=/usr/lib64/firefox. If you set debug to true for selenium server, you can look at the logs and see what firefox path it is trying to use and try to start firefox directly on the build server to see if this works. In our environment, we were getting an error saying it couldn't find the application.ini file. We couldn't see this in the test logs when we had debug property below set to true.
- We are using xvfb to launch firefox on our headless system using the selenium xvfb maven plugin at http://mojo.codehaus.org/selenium-maven-plugin/xvfb-mojo.html. Other than specifying just the display, we also had to make sure the option -ac was set for starting the xvfb instance. Below is a snapshot of the maven plugin configuration I have. You can debug if the tests work properly with xvfb by starting xvfb manually on your build server as the user who runs jenkins builds and then seeing if the tests run fine then. The tests ran fine and this helped us figure out we had an issue with how the xvfb plugin started the instance.
- Another debugging tip that helped figure out there was a problem with xvfb working with Firefox was connecting to the build server with X11 forwarding setup, starting selenium server directly versus through arquillian drone (set property 'skip' to true) and then running the tests. In this case, I could see the Firefox browser pop up and the tests run fine. Setting the -ac option in the pom helped fix the issue.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> <container qualifier="tomcat" default="true"> <configuration> <property name="tomcatHome">target/tomcat-embedded-7</property> <property name="workDir">work</property> <property name="bindHttpPort">8888</property> <property name="unpackArchive">true</property> </configuration> </container> <extension qualifier="selenium-server"> <property name="host">localhost</property> <property name="port">4444</property> <property name="userExtensions">user-extensions.js</property> <!-- <property name="debug">true</property> --> </extension> <extension qualifier="selenium"> <property name="serverPort">4444</property> <property name="serverHost">localhost</property> <property name="url">http://localhost:8888</property> <property name="browser">*firefox</property> </extension> </arquillian>
Here is the maven plugin configuration:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>2.3</version> <executions> <execution> <id>xvfb</id> <phase>pre-integration-test</phase> <goals> <goal>xvfb</goal> </goals> <configuration> <display>:99</display> <options> <option>-ac</option> </options> </configuration> </execution> </executions> </plugin>