Created
October 21, 2013 17:20
-
-
Save santiycr/7087501 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import selenium | |
import unittest | |
import json | |
import os | |
config = {"username": os.environ['SAUCE_USER'], | |
"access-key": os.environ['SAUCE_KEY'], | |
"browser": "iexplore", | |
"name": "Testing sauce advisor", | |
} | |
class sauceTest(unittest.TestCase): | |
def setUp(self): | |
self.browser = selenium( | |
'ondemand.saucelabs.com', | |
80, | |
json.dumps(config), | |
'https://saucelabs.com') | |
self.browser.start() | |
self.browser.set_timeout(90000) | |
def test_sauce(self): | |
browser = self.browser | |
browser.open("/") | |
assert "Sauce" in browser.get_title() | |
try: | |
self.browser.click("css=#not-gonna-find-me") # this will trigger advisor | |
except Exception: | |
pass | |
self.browser.get_text("xpath=//h1") # this will trigger advisor | |
browser.open("/") | |
self.browser.set_timeout(1) | |
try: | |
browser.open("/") # this will trigger advisor | |
except Exception: | |
pass | |
browser.set_context("sauce:job-info=%s" % json.dumps(dict(passed=True))) | |
def tearDown(self): | |
self.browser.stop() | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What does the SauceAdvisor do? How and where does it report results?