Skip to content

Instantly share code, notes, and snippets.

@santiycr
Created October 21, 2013 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santiycr/7087501 to your computer and use it in GitHub Desktop.
Save santiycr/7087501 to your computer and use it in GitHub Desktop.
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()
@agray
Copy link

agray commented Sep 12, 2014

What does the SauceAdvisor do? How and where does it report results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment