From b2488d858b10e30d43f05e76a4810d0c1c196cd5 Mon Sep 17 00:00:00 2001 From: axl89 Date: Tue, 24 May 2016 13:36:15 +0200 Subject: [PATCH] Trying Sauce Labs --- .travis.yml | 16 +++++++++++----- tests/console/PAN1.py | 2 -- tests/console/include/common_classes_60.py | 13 ++++++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14112f92f8..3c088b231f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,14 @@ language: python python: - 2.7 +env: + - SAUCE_USERNAME="artica_pandorafms" + global: + - secure: "MEfyEpYEBkPmgPYX3CDKhaoiOltH5lDcUOYZ/19Yflg6ee20IBZOywCmrKH7VouKlOHUrGTUQqHBou0npm93qBju3MrPCE2R62PiDV2EHCGl3AFpLkgt0m1/DceWCWKlL+gI8uvnEFzVUuaPm6cEcRn1ikzg5b084bTxJ2B1Bvs=" + addons: firefox: "latest" + sauce_connect: true services: - docker @@ -15,12 +21,12 @@ before_install: install: - docker run --rm -t -v "$TRAVIS_BUILD_DIR:/tmp/pandorafms" -p 80:80 pandorafms/pandorafms-base /tmp/pandorafms/tests/test.sh - - pip install selenium PyVirtualDisplay + - pip install selenium PyVirtualDisplay sauceclient -before_script: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - - sleep 4 # give xvfb some time to start +#before_script: +# - "export DISPLAY=:99.0" +# - "sh -e /etc/init.d/xvfb start" +# - sleep 4 # give xvfb some time to start script: - python $TRAVIS_BUILD_DIR/tests/console/PAN1.py diff --git a/tests/console/PAN1.py b/tests/console/PAN1.py index 2d25ac0376..a4ea29a4c1 100644 --- a/tests/console/PAN1.py +++ b/tests/console/PAN1.py @@ -16,9 +16,7 @@ class PAN1(PandoraWebDriverTestCase): def test_pan1(self): driver = self.driver - #login(driver,"admin","t3st1ng!",self.base_url) login(driver,"admin","pandora",self.base_url) - #driver.find_element_by_css_selector("#subSetup > li.sub_subMenu > a > div.submenu_text.submenu2_text_middle").click() element = driver.find_element_by_css_selector("#subSetup > li.sub_subMenu > a > div.submenu_text.submenu2_text_middle") driver.execute_script("arguments[0].click();", element) self.assertEqual("IP list with API access", driver.find_element_by_id("table2-15-0").text) diff --git a/tests/console/include/common_classes_60.py b/tests/console/include/common_classes_60.py index 0d15be62fc..f8ce65944b 100644 --- a/tests/console/include/common_classes_60.py +++ b/tests/console/include/common_classes_60.py @@ -8,6 +8,7 @@ from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException +from os import environ class ArticaTestResult(TestResult): @@ -24,10 +25,20 @@ class PandoraWebDriverTestCase(TestCase): time_started = None time_elapsed = None #Total time of the test tickets_associated = [] + sauce_username = environ["SAUCE_USERNAME"] + sauce_access_key = environ["SAUCE_ACCESS_KEY"] + + desired_cap = { + 'tunnel-identifier': environ["TRAVIS_JOB_NUMBER"], + 'platform': "Windows 10", + 'browserName': "firefox", + 'version': "46", + } def setUp(self): self.time_started = datetime.now() - self.driver = webdriver.Firefox() + #self.driver = webdriver.Firefox() + self.driver = webdriver.Remote(command_executor='http://'+self.sauce_username+':'+self.sauce_access_key+'@ondemand.saucelabs.com:80/wd/hub',desired_capabilities=self.desired_cap) self.driver.implicitly_wait(30) self.base_url = "http://localhost/" self.verificationErrors = []