conga/luci/test congaDemoTests.py conga_Helpers.py
CVSROOT: /cvs/cluster
Module name: conga
Changes by: ldimaggi at sourceware.org 2006-12-05 02:12:19
Modified files:
luci/test : congaDemoTests.py conga_Helpers.py
Log message:
More refactoring - pulled login/logout routines into conga_Helpers.py to make more code re-usable.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
luci/test/congaDemoTests.py +2 -17
@@ -36,19 +36,7 @@ def setUp(self): """Establish connection to selenium server, login to luci """ self.verificationErrors = [] - self.selenium = selenium("localhost", 4444, "*firefox", CONGA_SERVER) - self.selenium.start() - - # Login to the luci web app - self.selenium.open(CONGA_SERVER) - - # Wait for "Redirecting, please wait to complete" - it seems like this should not be needed, - # but as of 20061130, it still is - time.sleep(10) - self.selenium.type("__ac_name", CONGA_ADMIN_USERNAME) - self.selenium.type("__ac_password", CONGA_ADMIN_PASSWORD) - self.selenium.click("submit") - self.selenium.wait_for_page_to_load(PAGE_DISPLAY_DELAY) + self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD) def test_congaStorage(self): """Test to create and delete storage systems"""
@@ -165,10 +153,7 @@ def tearDown(self): """Logout and stop Selenium session""" - sel = self.selenium - self.selenium.click("link=Log out") - self.selenium.wait_for_page_to_load(PAGE_DISPLAY_DELAY) - self.selenium.stop() + logout(self.selenium) self.assertEqual([], self.verificationErrors) def suite():
luci/test/conga_Helpers.py +23 -1
@@ -119,5 +119,27 @@ sel.select("deluserId", "label=" + userName) sel.click("Submit") sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY) - + +def login(userName, password): + """Establish connection to selenium server, login to luci """ + sel = selenium("localhost", 4444, "*firefox", CONGA_SERVER) + sel.start() + + # Login to the luci web app + sel.open(CONGA_SERVER) + + # Wait for "Redirecting, please wait to complete" - it seems like this should not be needed, + # but as of 20061130, it still is + time.sleep(10) + sel.type("__ac_name", userName) + sel.type("__ac_password", password) + sel.click("submit") + sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY) + return sel + +def logout(sel): + """Logout and stop Selenium session""" + sel.click("link=Log out") + sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY) + sel.stop()