Nuxeo Core Developer Guide

WebDriver Tests

Updated: December 16, 2024

Compatible Firefox Location

Webdriver tests run on selenium 2.53.0 and they pass on Firefox 26 to 46 included. You can use the following system property while running the tests to make Webdriver use the correct Firefox:

-Dwebdriver.firefox.bin="/path/to/firefox/binary"

Webdriver tests can be launched from eclipse like any other unit tests. You can add the above system property to the JRE of your eclipse:

  • Go to 'Windows' -> 'Preferences' -> 'Java' -> 'Installed JREs'
  • Edit the default JRE
  • Add

    -Dwebdriver.firefox.bin="/path/to/firefox/binary"

    to the Default VM arguments

Running Tests Headless

If you want to run the tests without being disturbed by the Firefox windows opening and closing, under Linux, you may use:

xvfb-run -s "-screen 0 1920x1080x8" myCommand

Where:

  • -s "-screen 0 1920x1080x8" specifies a screen resolution. Note that without it, the resolution may be too small and your tests may fail because it cannot reach some graphical interface widgets.
  • myCommand is the command to be executed in this virtual frame buffer. E.g.: mvn integration-tests -Dwebdriver.firefox.bin=/path/to/firefox/binary.

Screenshot

On failure, a screenshot of the web page is captured and stored in the target directory.

Logging

It is possible to enable WebDriver logs when running tests. To do so, you need to pass a Environment Variable when running the tests:

nuxeo.log.webriver=true

As a result, WebDriver will log the driver connection details in the target directory. This also works in Jenkins by configuring a specific job and checking "Set environment variables" box in the "Build Environment" section.