Skip to content

Instantly share code, notes, and snippets.

@omaciel
Created May 27, 2014 14:43
Show Gist options
  • Save omaciel/3d0bd0a5dc15211007a5 to your computer and use it in GitHub Desktop.
Save omaciel/3d0bd0a5dc15211007a5 to your computer and use it in GitHub Desktop.
Locally running UI tests from Robottelo using Sauce Labs

Step 1

Sauce Connect is a secure tunneling app which allows you to execute tests securely when testing behind firewalls via a secure connection between Sauce Labs’ client cloud and your environment.

Download the version of Sauce Connect that corresponds to your guest's platform. For some reason Sauce Connect v4 never worked for me, so I use Sauce Connect v3 instead.

Step 2

After unpacking Sauce Connect, cd to its directory and start it up using your SauceLabs credentials:

  • Sauce Connect v4:
$ bin/sc -u YOUR-SAUCE-USERNAME -k YOUR-SAUCE-API-KEY
  • Sauce Connect v3
$ java -jar ~/Dropbox/Applications/Sauce-Connect-latest/Sauce-Connect.jar YOUR-SAUCE-USERNAME YOUR-SAUCE-API-KEY

Step 3

The following environment variables are needed before you can run UI tests. Please note that SELENIUM_PLATFORM, SELENIUM_BROWSER and SELENIUM_VERSION can be adjusted to match one of the supported platforms and web browser from Sauce Labs. For more information, check this page. The example below uses Linux, Firefox and 29 for these values:

export SELENIUM_HOST=ondemand.saucelabs.com
export SELENIUM_PORT=4444
export SELENIUM_PLATFORM=Linux
export SELENIUM_BROWSER=firefox
export SELENIUM_VERSION=29
export SAUCE_USER_NAME=YOUR-SAUCE-USERNAME
export SAUCE_API_KEY=YOUR-SAUCE-API-KEY
export SELENIUM_DRIVER="sauce-ondemand:?os=$SELENIUM_PLATFORM&browser=$SELENIUM_BROWSER&browser-version=$SELENIUM_VERSION&username=$SAUCE_USER_NAME&access-key=$SAUCE_API_KEY"
export SELENIUM_STARTING_URL='YOUR-SATELLITE-SERVER'

Step 4

Finally, edit your robottelo.properties file and make sure to set the remote attribute to ``1'`. Then run your tests:

$ nosetests -c robottelo.properties tests/foreman/ui/test_login.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment