From 0b28a591b6e696c7ae4e6e43bb844bee32d4717a Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 16 Jun 2019 19:48:33 -0400 Subject: [PATCH] Try using Travis CI + Sauce Labs. --- .travis.yml | 11 +++++++++++ tests/run_tests.py | 21 +++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4d9de27 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: generic +dist: xenial +addons: + sauce_connect: true +before_install: + - sudo apt-get install -y python3-pillow python3-numpy python3-pip + - sudo pip3 install selenium +jobs: + include: + - stage: test + script: python3 tests/run_tests.py diff --git a/tests/run_tests.py b/tests/run_tests.py index 3c87802..7b5beed 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -33,10 +33,23 @@ thread.start() # Create a new instance of the Firefox driver print("Starting web driver...") -fp = webdriver.FirefoxProfile() -fp.set_preference("layout.css.devPixelsPerPx", "1.0") -driver = webdriver.Firefox(firefox_profile=fp) -driver.set_window_size(800, 600) +if os.environ.get("TRAVIS_JOB_NUMBER"): + # Configuration for Travis CI / Sauce Labs testing + driver = webdriver.Remote( + command_executor="http://{}:{}@ondemand.saucelabs.com/wd/hub".format( + os.environ["SAUCE_USERNAME"], os.environ["SAUCE_ACCESS_KEY"] + ), + desired_capabilities={ + "tunnel-identifier": os.environ["TRAVIS_JOB_NUMBER"], + "build": os.environ["TRAVIS_JOB_NUMBER"], + "browserName": "firefox", + }, + ) +else: + fp = webdriver.FirefoxProfile() + fp.set_preference("layout.css.devPixelsPerPx", "1.0") + driver = webdriver.Firefox(firefox_profile=fp) + driver.set_window_size(800, 600) def run_tests():