Add option to run Selenium tests headless

Bug #1290329 reported by Maria Nita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Maria Nita

Bug Description

Selenium tests by default need a display and a browser driver for setup.
If no display settings are provided then the native display is used.
But if you run the tests on Jenkins or on a Vagrant machine, you usually want to run them headless.

In the setUp method of the BaseTestCase class, we define the Selenium webdriver. Tests inherit from this class.
Also we have a Selenium TestCase SeleniumTestCase, where we should also check for the option.

We can set an environment constant named WITH_DISPLAY to check, if we should start a headless session or not.
The default value should be True, which means that we run the tests with head = display.
If is False we can use https://pypi.python.org/pypi/xvfbwrapper/0.1.2 to start a headless session.

We should close the headless session on tearDown, if one was opened.

TODOs:

- In run_tests.sh we should add a new option to set the display type: head or headless. This will initialize a new environment constant - SELENIUM_WITH_DISPLAY
- Check for Selenium setup in TestCases and add a new condition to check the SELENIUM_WITH_DISPLAY value
- if the constant is set to True (default) then we will initialize the setup as it is now
- elif the constant is set to False, then we will start a new xvfb session (headless)
- at tearDown close the headless session if one is opened
- update requirements.txt with the new package

Changed in horizon:
assignee: nobody → Maria Nita (maria-nita-dn)
status: New → In Progress
description: updated
description: updated
description: updated
Revision history for this message
Julie Pichon (jpichon) wrote :

I believe this will help us get rid of the selenium-specific script in infra (see https://github.com/openstack-infra/config/blob/master/modules/jenkins/files/slave_scripts/run-selenium.sh), which means hopefully we could use regular tox jobs and avoid the problems around having a hard-coded command in run-selenium.sh (e.g. the integration tests also depend on selenium but run with a different flag, so can't use that script).

The review is currently open at https://review.openstack.org/#/c/79764/ .

Changed in horizon:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/79764
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=44055c167655166c8a2b44c28235c50734310d04
Submitter: Jenkins
Branch: master

commit 44055c167655166c8a2b44c28235c50734310d04
Author: marianitadn <email address hidden>
Date: Tue Mar 11 18:51:10 2014 +0200

    Add CLI option for running Selenium tests headless

    - Add requirement for xfvbwrapper
    - Add CLI option for running tests headless
    - Update Selenium TestCase to start virtual display if the option is set
    - Update documentation about running Selenium tests

    Change-Id: Icb1ac3491b8eef6c168bf1421cf073da67600982
    Closes-Bug: #1290329

Changed in horizon:
status: In Progress → Fix Committed
Changed in horizon:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-2 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.