forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_access.py
44 lines (37 loc) · 1.34 KB
/
test_access.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
42
43
44
from selenium import webdriver
import time, unittest, config
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_access(unittest.TestCase):
def setUp(self):
if (config.local):
self.wd = webdriver.Firefox()
else:
desired_capabilities = webdriver.DesiredCapabilities.FIREFOX
desired_capabilities['version'] = '24'
desired_capabilities['platform'] = 'Linux'
desired_capabilities['name'] = 'test_access'
self.wd = webdriver.Remote(
desired_capabilities=desired_capabilities,
command_executor="http://esodvn:[email protected]:80/wd/hub"
)
self.wd.implicitly_wait(60)
def test_test_access(self):
success = True
msg = "Success"
wd = self.wd
wd.get(config.accessURL)
if not ("Log In" in wd.find_element_by_tag_name("html").text):
success = False
print("Could not verify page text.")
self.assertTrue(success)
def tearDown(self):
if not (config.local):
print("Link to your job: https://saucelabs.com/jobs/%s" % self.wd.session_id)
self.wd.quit()
if __name__ == '__main__':
unittest.main()