Skip to contentSkip to conversation

conga/luci/test CGA_0160_Add_User.py CGA_0200_ ...

Cluster-devel [email protected] 1 participant 1 message Feb 28, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-02-28 22:58:57

Modified files:

	luci/test      : CGA_0160_Add_User.py CGA_0200_Create_cluster.py 
	                 congaDemoTests.py conga_Helpers.py 
	                 conga_suite.py 

Added files:
luci/test : cleaner.py

Log message:
sync up the test suite

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/cleaner.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0160_Add_User.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0200_Create_cluster.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.2&r2=1.10.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.2&r2=1.7.2.3

/cvs/cluster/conga/luci/test/cleaner.py,v --> standard output revision 1.1.2.1

- renamed from luci/test/cleaner.py +102 -0
@@ -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 <[email protected]>'
+
+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
luci/test/CGA_0160_Add_User.py +3 -3
@@ -140,7 +140,7 @@
                     #print "DEBUG - loggedInUser=" + loggedInUser + " userName=" + userName
                     if (loggedInUser == userName):
                         # Validation 1 - seeing authorized systems
-                        print 'Verify user ' + userName + ' is able to access authorized systems'
+                        self.logger.info('Verify user ' + userName + ' is able to access authorized systems')
                         self.assertTrue (sel.is_text_present(CONGA_USERS_SYSTEMS[loggedInUser]))
                                                
                         sel.click("link=" + CONGA_USERS_SYSTEMS[loggedInUser])
@@ -157,13 +157,13 @@
                                 self.assertTrue (sel.is_text_present('hda'))
                                 break
                             except:
-                                print 'Failed to view hard disk - assume slow reponse - trying again'
+                                self.logger.info('Failed to view hard disk - assume slow reponse - trying again')
                             loopCounter = loopCounter +1    
                             time.sleep (30)
                         
                     else:
                         # Validation 2 - not seeing other systems
-                        print 'Verify user ' + loggedInUser + ' is not able to access unauthorized system ' + CONGA_USERS_SYSTEMS[userName]
+                        self.logger.info('Verify user ' + loggedInUser + ' is not able to access unauthorized system ' + CONGA_USERS_SYSTEMS[userName])
                         self.assertFalse (sel.is_text_present(CONGA_USERS_SYSTEMS[userName]))
                         
             logout(self.selenium)  
luci/test/CGA_0200_Create_cluster.py +30 -16

71 lines not on this page · raw message

luci/test/congaDemoTests.py +5 -67

96 lines not on this page · raw message

luci/test/conga_Helpers.py +21 -16
@@ -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
@@ -39,7 +38,7 @@
 CONGA_ADMIN_USERNAME = 'admin'
 CONGA_ADMIN_PASSWORD = 'password'
 CONGA_SERVER = 'http://tng3-5.lab.msp.redhat.com:8080'
-PAGE_DISPLAY_DELAY = '30000'
+PAGE_DISPLAY_DELAY = '60000'
 CONGA_LOG = '/var/tmp/congaTest.log'
 CONGA_DEBUG_LOG = '/var/tmp/congaTest_debug.log'
 
@@ -56,7 +55,7 @@
                          'tng3-3.lab.msp.redhat.com':'password',
                          'tng3-4.lab.msp.redhat.com':'password' }
 
-CONGA_LARGE_CLUSTER_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', 
+CONGA_LARGE_CLUSTER_SYSTEMS = {#'tng3-1.lab.msp.redhat.com':'password', 
                          #'tng3-2.lab.msp.redhat.com':'password', 
                          'tng3-3.lab.msp.redhat.com':'password',
                          'tng3-4.lab.msp.redhat.com':'password',
@@ -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
+    
luci/test/conga_suite.py +3 -3
@@ -67,10 +67,10 @@
 
 # Assemble the suite
 suite = unittest.TestSuite()
-#suite.addTest(congaDemoSuite)
+suite.addTest(congaDemoSuite)
 suite.addTest(CGA_0160_Add_UserSuite)
-#suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite)
-#suite.addTest(CGA_0200_Create_cluster_Suite)
+suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite)
+suite.addTest(CGA_0200_Create_cluster_Suite)
 
 # Run the test suite
 unittest.TextTestRunner(verbosity=2).run(suite)