diff tests/test_access.py @ 10:a50cf11e5178

Rewrite LGDataverse completely upgrading to dataverse4.0
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 08 Sep 2015 17:00:21 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_access.py	Tue Sep 08 17:00:21 2015 +0200
@@ -0,0 +1,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:325caef9-81dd-47a5-8b74-433057ce888f@ondemand.saucelabs.com: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()