cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [07/50] [abbrv] git commit: updated refs/heads/rbac to 48e08fe
Date Thu, 06 Mar 2014 22:06:50 GMT
add some wait statements to tests

Signed-off-by: Sebastien Goasguen <runseb@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cefd4ce3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cefd4ce3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cefd4ce3

Branch: refs/heads/rbac
Commit: cefd4ce3bee970a41f6ca8d3fc1a6343c7f8b587
Parents: 58a3e75
Author: yichi.lu <yichi.lu@sungard.com>
Authored: Wed Feb 26 08:47:36 2014 -0600
Committer: Sebastien Goasguen <runseb@gmail.com>
Committed: Sun Mar 2 16:24:43 2014 -0500

----------------------------------------------------------------------
 test/selenium/cspages/login/loginpage.py        |  2 +-
 test/selenium/cspages/loginpage.py              | 63 -----------------
 .../cstests/smoketests/login_logout_test.py     | 72 +++++++++++++++++---
 3 files changed, 65 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cefd4ce3/test/selenium/cspages/login/loginpage.py
----------------------------------------------------------------------
diff --git a/test/selenium/cspages/login/loginpage.py b/test/selenium/cspages/login/loginpage.py
index 39e4295..e7795d9 100644
--- a/test/selenium/cspages/login/loginpage.py
+++ b/test/selenium/cspages/login/loginpage.py
@@ -76,7 +76,7 @@ class LoginPage(object):
     @try_except_decor
     def logout(self, directly_logout = False):
 
-        self.browser.set_window_size(1200,980)
+#       self.browser.set_window_size(1200,980)
         Shared.wait_for_element(self.browser, 'id', 'user')
 
         # must click this icon options first

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cefd4ce3/test/selenium/cspages/loginpage.py
----------------------------------------------------------------------
diff --git a/test/selenium/cspages/loginpage.py b/test/selenium/cspages/loginpage.py
deleted file mode 100644
index c6e736c..0000000
--- a/test/selenium/cspages/loginpage.py
+++ /dev/null
@@ -1,63 +0,0 @@
-from selenium import webdriver
-from selenium.common.exceptions import *
-from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
-from selenium.webdriver.common.action_chains import ActionChains as action
-from common import Global_Locators
-
-from common.shared import *
-
-class LoginPage(object):
-    def __init__(self, browser):
-        self.browser = browser
-        self.username = ""
-        self.password = ""
-        self.language = ""
-
-    @try_except_decor
-    def set_username(self, username):
-        self.username = username
-        usernameElement = self.browser.find_element_by_css_selector(Global_Locators.login_username_css)
-        usernameElement.send_keys(self.username)
-
-    @try_except_decor
-    def set_password(self, password):
-        self.password = password
-        passwordElement = self.browser.find_element_by_css_selector(Global_Locators.login_password_css)
-        passwordElement.send_keys(self.password)
-        self.pwelement = passwordElement
-
-    @try_except_decor
-    def set_language(self, language):
-        self.language = language
-        ele = self.browser.find_element_by_class_name('select-language')
-        option = ele.find_element_by_xpath("//option[@value='en']")
-        option.click()
-
-        time.sleep(1)
-
-    @try_except_decor
-    def login(self, expect_fail = False):
-        if self.username == "" or self.password == "":
-            print "Must set email and password before logging in"
-            return
-        loginElement = self.browser.find_element_by_css_selector(Global_Locators.login_submit_css)
-        loginElement.click()
-
-    @try_except_decor
-    def logout(self):
-        # must click this icon options first
-        ele1 = self.browser.find_element_by_xpath("//div[@id='user' and @class='button']/div[@class='icon
options']").click()
-        ele2 = self.browser.find_element_by_xpath("//div[@id='header']/div[@id='user-options']")
-        ele3 = ele2.find_element_by_link_text('Logout')
-        ele3.click()
-
-        Shared.wait_for_element(self.browser, 'class_name', 'login')
-
-    @try_except_decor
-    def get_error_msg(self, loginpage_url):
-        if loginpage_url is not None and len(loginpage_url) > 0 and \
-            (self.browser.current_url.find(loginpage_url) > -1 or loginpage_url.find(self.browser.current_url)
> -1):
-            ele = self.browser.find_element_by_id('std-err')
-            return ele.text
-        else:
-            return ""

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cefd4ce3/test/selenium/cstests/smoketests/login_logout_test.py
----------------------------------------------------------------------
diff --git a/test/selenium/cstests/smoketests/login_logout_test.py b/test/selenium/cstests/smoketests/login_logout_test.py
index 66fcc4a..c94e4e3 100644
--- a/test/selenium/cstests/smoketests/login_logout_test.py
+++ b/test/selenium/cstests/smoketests/login_logout_test.py
@@ -58,74 +58,130 @@ class TestCSLoginLogout(unittest.TestCase):
         self.loginpage.logout(directly_logout = True)
         shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login', waittime
= 300)
 
-    def xtest_failure_1(self):
+    def test_failure_1(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['badusername'])
         self.loginpage.set_password(smokecfg['password'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_2(self):
+    def test_failure_2(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['username'])
         self.loginpage.set_password(smokecfg['badpassword'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_3(self):
+    def test_failure_3(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['badusername'])
         self.loginpage.set_password(smokecfg['badpassword'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_4(self):
+    def test_failure_4(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['sqlinjection_1'])
         self.loginpage.set_password(smokecfg['password'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_5(self):
+    def test_failure_5(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['sqlinjection_2'])
         self.loginpage.set_password(smokecfg['password'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_6(self):
+    def test_failure_6(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['sqlinjection_3'])
         self.loginpage.set_password(smokecfg['password'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_7(self):
+    def test_failure_7(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['sqlinjection_4'])
         self.loginpage.set_password(smokecfg['password'])
         self.loginpage.login(expect_fail = True)
 
-    def xtest_failure_8(self):
+    def test_failure_8(self):
         self.browser.set_url(smokecfg['cssite'])
         self.loginpage = loginpage.LoginPage(self.browser.get_browser())
+
+        # wait for at most 5 minutes, in case we have an anoyingly slow server
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language',
waittime = 300)
+
         # language selection must be done before username and password
         self.loginpage.set_language(smokecfg['language'])
+
+        shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields',
waittime = 300)
+
         self.loginpage.set_username(smokecfg['sqlinjection_5'])
         self.loginpage.set_password(smokecfg['password'])
         self.loginpage.login(expect_fail = True)


Mime
View raw message