forked from mattfair/SeleniumFactory-for-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sauce_ondemand_test.py
41 lines (32 loc) · 1.08 KB
/
sauce_ondemand_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from selenium import webdriver
import unittest, time, re
import os
import json
from ParseSauceURL import *
from SeleniumFactory import *
"""
"""
class testSauceWrappers(unittest.TestCase):
def retrieve_job_details(self, browser):
sauceRest = SauceRest(os.environ['SAUCE_USER_NAME'], os.environ['SAUCE_API_KEY'])
result = sauceRest.get(browser.id())
data = json.loads(result)
return data
def test_webdriver_success(self):
browser = SeleniumFactory().createWebDriver()
browser.get("http://amazon.com")
assert "Amazon.com" in browser.title
browser.job_passed()
data = self.retrieve_job_details(browser)
assert data['passed']
browser.quit()
def test_webdriver_failed(self):
browser = SeleniumFactory().createWebDriver()
browser.get("http://amazon.com")
assert "Amazon.com" in browser.title
browser.job_failed()
data = self.retrieve_job_details(browser)
assert not data['passed']
browser.quit()
if __name__ == "__main__":
unittest.main()