All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] conga/luci/test conga_Helpers.py conga_suite.p ...
@ 2006-12-05 21:23 ldimaggi
  0 siblings, 0 replies; 3+ messages in thread
From: ldimaggi @ 2006-12-05 21:23 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	ldimaggi at sourceware.org	2006-12-05 21:23:51

Modified files:
	luci/test      : conga_Helpers.py conga_suite.py 
Added files:
	luci/test      : CGA_0160_Add_User.py 

Log message:
	Added first cut of new test:
	
	Test for Conga use case CGA-160 - Adding a new user (http://sourceware.org/cluster/conga/usecases/cga-0160.html)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0160_Add_User.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

/cvs/cluster/conga/luci/test/CGA_0160_Add_User.py,v  -->  standard output
revision 1.1
--- conga/luci/test/CGA_0160_Add_User.py
+++ -	2006-12-05 21:23:51.935346000 +0000
@@ -0,0 +1,170 @@
+#! /usr/bin/env python
+
+'''
+Script name:    CGA_0160_Add_User.py
+Creation date:  Dec 2006
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0
+Summary:        Test for Conga use case CGA-160 - Adding a new user 
+                http://sourceware.org/cluster/conga/usecases/cga-0160.html
+                
+                The sequence of actions is:
+                
+                As admin:
+                    Login
+                    Add systems
+                    Add users
+                    Assign user to a machine
+                    Logout
+  
+                As each user:  
+                    Login
+                    Verify user view machine storage
+                    Verify user cannot view other machines
+                    Logout
+  
+                As admin:
+                    Login
+                    Delete systems
+                    Delete users
+                    Logout
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+from selenium import selenium
+import unittest, time, re
+from conga_Helpers import *
+
+class CGA_0160_Add_User (unittest.TestCase):
+
+    def setUp(self):      
+        """Establish connection to selenium server, login to luci """
+        self.verificationErrors = []
+        self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+
+        """Test to create and delete storage systems"""
+        sel = self.selenium
+
+        # Create the storage systems
+        for systemName in CONGA_STORAGE_SYSTEMS:
+            createStorageSystem(sel, systemName, CONGA_STORAGE_SYSTEMS[systemName])
+            # Validation - verify that the success message was displayed for each storage system
+            self.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)
+            self.assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))               
+        
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # Create the users
+        for userName in CONGA_USERS.keys(): 
+            createUser (sel, userName, CONGA_USERS[userName])
+            # Validation - verify that the success message was displayed for each user
+            self.assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully')) 
+     
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)    
+
+        # Assign permissions to users as defined in CONGA_USERS_SYSTEMS
+        for userName in CONGA_USERS_SYSTEMS:
+            # Temporary - 20061205 - only tng3-2, 3-3, and 3-5 are reliable systems right now
+            if ((userName == 'user2') or (userName == 'user3') or (userName == 'user5') ):
+                systemName = CONGA_USERS_SYSTEMS[userName]
+                # Replace . with _ in system name to match HTML
+                systemNameMod = systemName.replace('.', '_')
+
+                sel.click("link=User Permissions")
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                
+                sel.select("userList", "label=" + userName)
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                sel.click("name=__SYSTEM:" + systemNameMod)
+                
+                sel.click("document.adminform.elements['Update Permissions']")
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                # The following statement is failing - not clear why - is luci not displaying the confirm dialog?
+                #self.assertEqual('Modify permissions for ' + userName, sel.get_confirmation())  - why is this failing?
+                sel.get_confirmation()
+                #print "DEBUG = " + userName + " " + systemName
+                self.assertTrue (sel.is_text_present('Added permission for ' + userName + ' for system ' + systemName))
+ 
+        # Logout as admin
+        logout(self.selenium)
+
+    def test_create_users_systems(self):
+        """Test to verify user permissions - control of access to view systems"""
+        
+        #####################################################
+        # Validation: Two part test:
+        #   1) Verify that the loggedin user can see the systems for which they have authorization
+        #   2) Verify that the loggedin user cannot see any other systems
+        for loggedInUser in CONGA_USERS:
+            self.selenium = login (loggedInUser, CONGA_USERS[loggedInUser])
+            sel = self.selenium 
+            sel.click("link=storage")
+            sel.wait_for_page_to_load("30000")
+            
+            for userName in CONGA_USERS_SYSTEMS:
+                if ((userName == 'user2') or (userName == 'user3') or (userName == 'user5') ):
+                    if (loggedInUser == userName):
+                        # Validation 1 - seeing authorized systems
+                        print 'Verify user ' + userName + ' is able to access authorized systems'
+                        self.assertTrue (sel.is_text_present(CONGA_USERS_SYSTEMS[loggedInUser]))
+                    else:
+                        # Validation 2 - not seeing other systems
+                        print '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)     
+
+    def tearDown(self):        
+        # login as admin
+        self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+        sel = self.selenium 
+        
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # View the defined storage systems 
+        sel.select_window("null")
+        sel.click("link=Manage Systems")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+        # Delete the storage systems
+        for systemName in CONGA_STORAGE_SYSTEMS:
+            deleteStorageSystem(sel, systemName)
+            # Validation - verify that the success message was displayed for each storage system
+            self.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)
+            self.assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+ 
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # Delete the users 
+        for userName in CONGA_USERS.keys(): 
+            deleteUser (sel, userName)
+            # Validation - verify that the success message was displayed for each user
+            self.assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))  
+       
+        """Logout and stop Selenium session"""
+        logout(self.selenium)
+        self.assertEqual([], self.verificationErrors)
+
+def suite():
+        suite = unittest.TestSuite()
+        suite.addTest(CGA_0160_Add_User('test_create_users_systems'))
+        return suite
+
+if __name__ == "__main__":
+    #unittest.main()
+    unittest.TextTestRunner( verbosity=2 ).run( suite() )
--- conga/luci/test/conga_Helpers.py	2006/12/05 02:12:18	1.3
+++ conga/luci/test/conga_Helpers.py	2006/12/05 21:23:51	1.4
@@ -71,15 +71,15 @@
                          'user10':'user10_password'}
 
 CONGA_USERS_SYSTEMS =   {'user1':'tng3-1.lab.msp.redhat.com', 
-                         'user2':'tng3-1.lab.msp.redhat.com', 
-                         'user3':'tng3-1.lab.msp.redhat.com', 
-                         'user4':'tng3-1.lab.msp.redhat.com', 
-                         'user5':'tng3-1.lab.msp.redhat.com', 
+                         'user2':'tng3-2.lab.msp.redhat.com', 
+                         'user3':'tng3-3.lab.msp.redhat.com', 
+                         'user4':'tng3-4.lab.msp.redhat.com', 
+                         'user5':'tng3-5.lab.msp.redhat.com', 
                          'user6':'tng3-1.lab.msp.redhat.com', 
-                         'user7':'tng3-1.lab.msp.redhat.com', 
-                         'user8':'tng3-1.lab.msp.redhat.com', 
-                         'user9':'tng3-1.lab.msp.redhat.com', 
-                         'user10':'tng3-1.lab.msp.redhat.com'}
+                         'user7':'tng3-2.lab.msp.redhat.com', 
+                         'user8':'tng3-3.lab.msp.redhat.com', 
+                         'user9':'tng3-4.lab.msp.redhat.com', 
+                         'user10':'tng3-5.lab.msp.redhat.com'}
 
 def createStorageSystem(sel, systemName, systemPassword):
     """Common code to create storage systems"""
--- conga/luci/test/conga_suite.py	2006/12/01 19:57:52	1.1
+++ conga/luci/test/conga_suite.py	2006/12/05 21:23:51	1.2
@@ -30,8 +30,9 @@
 # Import the test suites
 import unittest
 import congaDemoTests
+import CGA_0160_Add_User
 
-# Tests planned - not yet complete:   
+# Tests planned - all not yet complete:   
 #   CGA-0160_Add_User.py
 #   CGA-0170_Online_Documenation_Portlet.py
 #   CGA-0180_Event_Portlet.py
@@ -57,10 +58,12 @@
 
 # Define the suite elements
 congaDemoSuite = congaDemoTests.suite()
+CGA_0160_Add_UserSuite = CGA_0160_Add_User.suite()
 
 # Assemble the suite
 suite = unittest.TestSuite()
 suite.addTest(congaDemoSuite)
+suite.addTest(CGA_0160_Add_UserSuite)
 
 # Run the test suite
 unittest.TextTestRunner(verbosity=2).run(suite)



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Cluster-devel] conga/luci/test conga_Helpers.py conga_suite.p ...
@ 2006-12-07 20:56 ldimaggi
  0 siblings, 0 replies; 3+ messages in thread
From: ldimaggi @ 2006-12-07 20:56 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	ldimaggi at sourceware.org	2006-12-07 20:56:48

Modified files:
	luci/test      : conga_Helpers.py conga_suite.py 
Added files:
	luci/test      : CGA_0170_Online_Documenation_Portlet.py 

Log message:
	Added first version of test for use case CGA-170 - this is also a good regression test for https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=212991

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0170_Online_Documenation_Portlet.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=1.3&r2=1.4

/cvs/cluster/conga/luci/test/CGA_0170_Online_Documenation_Portlet.py,v  -->  standard output
revision 1.1
--- conga/luci/test/CGA_0170_Online_Documenation_Portlet.py
+++ -	2006-12-07 20:56:48.501065000 +0000
@@ -0,0 +1,62 @@
+#! /usr/bin/env python
+
+'''
+Script name:    GA_0170_Online_Documentation_Portlet.py
+Creation date:  Dec 2006
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0
+Summary:        Test for Conga use case CGA-0170 - verify the online user documentation
+                Regression test for: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=212991
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+from selenium import selenium
+import unittest, time, re
+from conga_Helpers import *
+import time
+
+class GA_0170_Online_Documentation_Portlet (unittest.TestCase):
+
+    def setUp(self):      
+        """Establish connection to selenium server, login to luci """
+        self.verificationErrors = []
+        self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+
+        """Test to create and delete storage systems"""
+        sel = self.selenium
+
+    def test_docs(self):
+        """Test to verify on-line Help docs"""
+        
+        sel = self.selenium
+        
+        # Access the on-line help
+        sel.click("link=help")
+        sel.wait_for_pop_up("Conga Help", "30000")        
+        sel.select_window('Conga Help')
+        
+        # Grab all the text       
+        theText = sel.get_html_source()
+
+        # Validation - check the offsets for the items in the HELP list             
+        for theItem in HELP_LIST:
+            print 'Verify offset of help text "' + theItem + '" = ' + str(theText.index(theItem))
+            self.assertEqual (theText.index(theItem), HELP_DICTIONARY[theItem])
+            
+        # Select the main window    
+        sel.select_window('null')
+
+    def tearDown(self):  
+        """Logout and stop Selenium session"""
+        logout(self.selenium)
+        self.assertEqual([], self.verificationErrors)
+
+def suite():
+        suite = unittest.TestSuite()
+        suite.addTest(GA_0170_Online_Documentation_Portlet('test_docs'))
+        return suite
+
+if __name__ == "__main__":
+    #unittest.main()
+    unittest.TextTestRunner( verbosity=2 ).run( suite() )
--- conga/luci/test/conga_Helpers.py	2006/12/05 21:23:51	1.4
+++ conga/luci/test/conga_Helpers.py	2006/12/07 20:56:48	1.5
@@ -80,6 +80,22 @@
                          'user8':'tng3-3.lab.msp.redhat.com', 
                          'user9':'tng3-4.lab.msp.redhat.com', 
                          'user10':'tng3-5.lab.msp.redhat.com'}
+   
+# Data used to verify the on-line help contents. The Dictionary contains
+# strings and offsets of the strings in the help as of 20061207   
+HELP_LIST = ['Conga User Manual',
+             'Introduction', 
+             'Conga Architecture', 
+             'Homebase Tab', 
+             'Cluster Tab', 
+             'Storage Tab']
+        
+HELP_DICTIONARY = {'Conga User Manual':77,
+                   'Introduction':200,
+                   'Conga Architecture':225,
+                   'Homebase Tab':4225,
+                   'Cluster Tab':10121,
+                   'Storage Tab':20452 }
 
 def createStorageSystem(sel, systemName, systemPassword):
     """Common code to create storage systems"""
--- conga/luci/test/conga_suite.py	2006/12/06 18:58:09	1.3
+++ conga/luci/test/conga_suite.py	2006/12/07 20:56:48	1.4
@@ -31,6 +31,7 @@
 import unittest
 import congaDemoTests
 import CGA_0160_Add_User
+import GA_0170_Online_Documentation_Portlet
 
 # Tests planned - all not yet complete:   
 #   CGA-0160_Add_User.py
@@ -59,11 +60,13 @@
 # Define the suite elements
 congaDemoSuite = congaDemoTests.suite()
 CGA_0160_Add_UserSuite = CGA_0160_Add_User.suite()
+CGA_0170_Online_Documentation_Portlet_Suite = GA_0170_Online_Documentation_Portlet.suite()
 
 # 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)
 
 # Run the test suite
 unittest.TextTestRunner(verbosity=2).run(suite)



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Cluster-devel] conga/luci/test conga_Helpers.py conga_suite.p ...
@ 2006-12-11 21:37 ldimaggi
  0 siblings, 0 replies; 3+ messages in thread
From: ldimaggi @ 2006-12-11 21:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	ldimaggi at sourceware.org	2006-12-11 21:37:22

Modified files:
	luci/test      : conga_Helpers.py conga_suite.py 
Added files:
	luci/test      : tests_README.txt 

Log message:
	Added first revision of tests_README.txt

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/tests_README.txt.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=1.4&r2=1.5

/cvs/cluster/conga/luci/test/tests_README.txt,v  -->  standard output
revision 1.1
--- conga/luci/test/tests_README.txt
+++ -	2006-12-11 21:37:22.873459000 +0000
@@ -0,0 +1,85 @@
+README for Running RHEL5 Conga Automated GUI Tests
+==================================================
+
+(Rev 1.0 - 20061211, ldimaggi at redhat.com)
+
+1) Install Selenium Core
+   a. wget http://release.openqa.org/selenium-core/0.8.1/selenium-core-0.8.1.zip
+   b. Unzip someplace - I used /opt
+
+2) Make sure Firefox 1.5 or newer is installed - I'm using 1.5.0.8
+
+3) Make sure Java 1.5 is installed - I'm using Sun 1.5.0_09
+
+4) Add Firefox bin dir to PATH
+   a. export PATH=/usr/lib/firefox-1.5.0.8:$PATH
+
+5) Start up Selenium server:
+   a. cd /opt/selenium/selenium-remote-control-0.9.0/server/
+   b. java -jar selenium-server.jar
+
+6) On the luci server, modify config to not use SSL, edit /var/lib/luci/etc/zope.conf:
+   a. Change this:
+
+           <cgi-environment> 
+           HTTPS ON
+           <cgi-environment> 
+
+      to this:
+
+           <cgi-environment> 
+           HTTPS OFF
+           <cgi-environment> 
+
+   b. Change this:
+
+      <http-server>                                              
+      # valid keys are "address" and "force-connection-close"    
+      #address 8080                                              
+      address localhost:25639                               
+      # force-connection-close on                           
+      </http-server>             
+
+     to this:
+
+      <http-server>       
+      address 8080                            
+      </http-server> 
+
+   c. Restart luci service
+
+7) Get a local copy of the tests.
+
+   a. mkdir sandbox; cd sandbox
+   b. cvs -d :ext:ldimaggi at sources.redhat.com:/cvs/cluster checkout conga
+   c. cd conga/luci/tests
+   
+8) Set up the test data to match your current test network node names
+   and passwords - edit conga_Helpers.py
+
+9) Run the tests individually:
+   a. python congaDemoTests.py
+   b. python CGA_0160_Add_User.py
+   c. python CGA_0170_Online_Documenation_Portlet.py
+   d. python CGA_0200_Create_cluster.py
+
+   Or, run all the tests as a suite:
+   a. python conga_suite.py
+
+   Look in the syslog and debug log on the luci server and in the selenium server log for errors if a test fails.
+
+Current Issues:
+===============
+
+   1) The tests that create a cluster (congaDemoTests.py,
+      CGA_0200_Create_cluster.py) don't yet fully cleanup after a test
+      run. The cluster is deleted in the luci database, but the
+      cluster.conf file and the service startup settings are not reset
+      on the cluster nodes.
+
+   2) The tests do not yet handle errors, other than expected failures. 
+
+
+
+
+
--- conga/luci/test/conga_Helpers.py	2006/12/08 16:17:23	1.6
+++ conga/luci/test/conga_Helpers.py	2006/12/11 21:37:22	1.7
@@ -41,16 +41,16 @@
 
 # 20061130 - Node tng3-1 isn't booting, node tng3-4 is having some problems too
 
-#CONGA_STORAGE_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', 
+CONGA_STORAGE_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',
-#                         'tng3-5.lab.msp.redhat.com':'password'}
-
-CONGA_STORAGE_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password', 
-                         'tng3-3.lab.msp.redhat.com':'password', 
+                         'tng3-3.lab.msp.redhat.com':'password',
+                         'tng3-4.lab.msp.redhat.com':'password',
                          'tng3-5.lab.msp.redhat.com':'password'}
 
+#CONGA_STORAGE_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password', 
+#                         'tng3-3.lab.msp.redhat.com':'password', 
+#                         'tng3-5.lab.msp.redhat.com':'password'}
+
 #CONGA_CLUSTER_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', 
 #                         'tng3-2.lab.msp.redhat.com':'password', 
 #                         'tng3-3.lab.msp.redhat.com':'password', 
--- conga/luci/test/conga_suite.py	2006/12/07 20:56:48	1.4
+++ conga/luci/test/conga_suite.py	2006/12/11 21:37:22	1.5
@@ -64,9 +64,9 @@
 
 # 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_0170_Online_Documentation_Portlet_Suite)
 
 # Run the test suite
 unittest.TextTestRunner(verbosity=2).run(suite)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-11 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-05 21:23 [Cluster-devel] conga/luci/test conga_Helpers.py conga_suite.p ldimaggi
  -- strict thread matches above, loose matches on Subject: below --
2006-12-07 20:56 ldimaggi
2006-12-11 21:37 ldimaggi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.