[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	ldimaggi sourceware org	2007-02-23 21:32:52

Modified files:
	luci/test      : congaDemoTests.py conga_Helpers.py 
Added files:
	luci/test      : cleaner.py 

Log message:
	Changes to sych up with GUI - cleaner.py = first cut at tool to ensure that all test-created Conga assets are deleted

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/cleaner.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.13&r2=1.14

/cvs/cluster/conga/luci/test/cleaner.py,v  -->  standard output
revision 1.1
--- conga/luci/test/cleaner.py
+++ -	2007-02-23 21:32:52.473689000 +0000
@@ -0,0 +1,102 @@
+#! /usr/bin/env python
+
+'''
+Script name:    cleaner.py
+Creation date:  Feb 2007
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0
+Summary:        Script to clean up all Conga test suite related artifacts - this script will be 
+                before Conga use case tests
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi redhat com>'
+
+from selenium import selenium
+import unittest, time, re
+from conga_Helpers import *
+import time
+import logging
+from loggerObject import loggerObject
+
+class cleaner:
+    
+    def cleanup(self):
+
+        selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+        sel = selenium
+        theloggerObject = setupLogger (CONGA_DEBUG_LOG)
+        logger = theloggerObject.getLogger()
+        
+        # Step 1 of 3 - Delete all clusters
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=cluster")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        
+        #####################
+            
+            
+        junk = sel.get_text("cluster_action")
+        print junk
+        print sel.get_body_text()
+        print '============================='
+        
+                
+        tempBool = sel.is_element_present("cluster_action")
+        if (tempBool == True):
+            sel.select("cluster_action", "label=Delete this cluster")
+            sel.click("//input[ value='Go']")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            time.sleep(300)
+        else:
+            print 'No cluster to delete'
+           
+        sel.click("link=homebase")
+        
+        # Create the users
+#        for userName in CONGA_USERS.keys(): 
+#            createUser (sel, userName, CONGA_USERS[userName], logger)
+#            # Validation - verify that the success message was displayed for each user
+#            assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+#            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+#            assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully')) 
+#     
+###############################################################################
+        # Delete the users 
+        for userName in CONGA_USERS.keys(): 
+            deleteUser (sel, userName, logger)
+            # Validation - verify that the success message was displayed for each user
+            try:
+                assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))  
+            except:
+                print 'Unable to delete user: ' + userName + ' does it exist?'
+    
+        
+#        # Create the storage systems
+#        for systemName in CONGA_STORAGE_SYSTEMS:
+#            createStorageSystem(sel, systemName, CONGA_STORAGE_SYSTEMS[systemName], logger)
+#            # Validation - verify that the success message was displayed for each storage system
+#            assertEqual("Do you really want to add the following Storage Systems:\n" + systemName, sel.get_confirmation())
+#            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+#            assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))            
+#            
+
+        tempBool = sel.is_element_present("link=Manage Systems")
+        if (tempBool == True):
+             # Delete the storage systems
+            for systemName in CONGA_STORAGE_SYSTEMS:
+                deleteStorageSystem(sel, systemName, logger)
+                try:
+                    # Validation - verify that the success message was displayed for each storage system
+                    assertEqual("Do you really want to remove the following managed systems:\nStorage Systems:\n-" + systemName, sel.get_confirmation())
+                    sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                    assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+                except:
+                    print 'Unable to delete system: ' + systemName + ' does it exist?'
+        else:
+            print 'No systems to delete'
+           
+        sel = selenium.stop()
+             
\ No newline at end of file
--- conga/luci/test/congaDemoTests.py	2007/02/20 20:18:25	1.10
+++ conga/luci/test/congaDemoTests.py	2007/02/23 21:32:52	1.11
@@ -32,11 +32,15 @@
 import unittest, time, re
 import logging
 from loggerObject import loggerObject
+from cleaner import *
 
 class congaDemoTests(unittest.TestCase):
 
     def setUp(self):
         
+        temp = cleaner()    
+        temp.cleanup()
+        
         # Set up logging      
         self.theloggerObject = setupLogger (CONGA_DEBUG_LOG)
         self.logger = self.theloggerObject.getLogger()
@@ -109,7 +113,7 @@
 
 def suite():
         suite = unittest.TestSuite()
-        suite.addTest(congaDemoTests('test_congaStorage'))
+#        suite.addTest(congaDemoTests('test_congaStorage'))
         suite.addTest(congaDemoTests('test_congaUsers'))
         return suite
 
--- conga/luci/test/conga_Helpers.py	2007/02/20 20:18:25	1.13
+++ conga/luci/test/conga_Helpers.py	2007/02/23 21:32:52	1.14
@@ -31,7 +31,6 @@
 import unittest, time, re
 import logging
 import logging.handlers
- 
 from loggerObject import loggerObject
 
 # Define data to support tests - global for now
@@ -108,12 +107,15 @@
 
 def deleteStorageSystem(sel, systemName, theLogger):
     """Common code to delete storage systems"""
-    theLogger.debug('Delete storage system: ' + systemName)
-    # Need to handle artifacts names - underscores in strings, not periods
-    systemNameMod = systemName.replace('.', '_')
-    sel.click("name=__SYSTEM:" + systemNameMod)
-    sel.click("document.adminform.Submit")
-    sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)          
+    try:
+        theLogger.debug('Delete storage system: ' + systemName)
+        # Need to handle artifacts names - underscores in strings, not periods
+        systemNameMod = systemName.replace('.', '_')
+        sel.click("name=__SYSTEM:" + systemNameMod)
+        sel.click("document.adminform.Submit")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)          
+    except:
+        print 'Unable to delete system: ' + systemName
 
 def createUser(sel, userName, userPassword, theLogger):
     """Common code to create users"""
@@ -128,12 +130,15 @@
     
 def deleteUser(sel, userName, theLogger):
     """Common code to delete users"""
-    theLogger.debug('Delete user: ' + userName)
-    sel.click("link=Delete a User")
-    sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
-    sel.select("deluserId", "label=" + userName)
-    sel.click("Submit")
-    sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)    
+    try:
+        theLogger.debug('Delete user: ' + userName)
+        sel.click("link=Delete a User")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.select("deluserId", "label=" + userName)
+        sel.click("Submit")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)    
+    except:
+        print 'Unable to delete user: ' + userName
         
 def login(userName, password):
     """Establish connection to selenium server, login to luci """
@@ -185,4 +190,4 @@
     theLogger.removeHandler(theHandler)
     theHandler.close()
 #    theHandler.doRollover()
-    
\ No newline at end of file
+    


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]