From 1a0d5f25d9d6f23fcbdd7ee8c9ec659037fdadbd Mon Sep 17 00:00:00 2001 From: Joshua Carp Date: Mon, 20 Apr 2015 16:04:52 -0400 Subject: [PATCH] Add Sauce Connect. --- .travis.yml | 22 ++++++++++++++----- .../tests/selenium/base_test_class.py | 14 ++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71824701b..427e74402 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,20 @@ python: "3.4" + +addons: + sauce_connect: true + +env: + global: + - SAUCE_USERNAME: "jmcarp" + - FEC_SELENIUM_DRIVER: "remote" + - FEC_WEB_API_URL: "http://fec-dev-api.cf.18f.us" + - secure: "NynrD/74WTcvizkmRrcJdT1vZk1bcyszxFg2kVcgWoaSolEElozrW3kwOYqL8LUlkZ2vJ+Jgo6b5Zp81Bh9RMeDeoxZTCfVMDH0n1UOpwj+7xEDZ1UHSIQr3RLHEmhcMyp2jfd9WcHjBayW1wYGtRm/YM/aXTun/o3wffxlIt2g=" + before_script: - - cd openfecwebapp -install: - - sudo pip install -r requirements.txt + - cd openfecwebapp + - pip install -r requirements.txt + - python __init__.py & + script: - - cd tests - - nosetests -a '!selenium' + - cd tests + - nosetests -a "selenium" diff --git a/openfecwebapp/tests/selenium/base_test_class.py b/openfecwebapp/tests/selenium/base_test_class.py index ca69ed7aa..01c9f551d 100644 --- a/openfecwebapp/tests/selenium/base_test_class.py +++ b/openfecwebapp/tests/selenium/base_test_class.py @@ -6,10 +6,24 @@ from nose.plugins.attrib import attr +sauce_url = 'http://{0}:{1}@ondemand.saucelabs.com:80/wd/hub'.format( + os.getenv('SAUCE_USERNAME'), + os.getenv('SAUCE_ACCESS_KEY'), +) + + drivers = { 'phantomjs': lambda: webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true']), 'firefox': lambda: webdriver.Firefox(), 'chrome': lambda: webdriver.Chrome(), + 'remote': lambda: webdriver.Remote( + desired_capabilities={ + 'platform': os.getenv('FEC_SAUCE_PLATFORM', 'Mac OS X 10.9'), + 'browserName': os.getenv('FEC_SAUCE_BROWSER', 'chrome'), + 'version': os.getenv('FEC_SAUCE_VERSION', ''), + }, + command_executor=sauce_url, + ), }