コード例 #1
0
 def testSaveAndAddAnotherProject(self):
     self.testname="TestSaveAndAddAnotherProject"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     do = Helpers(self)
     do.setUtils(util)
     do.login()
     
     object_1_name = do.generateNameForTheObject("Project")
     do.delay(10) # count number does not appear right away, weird
     object_2_name = "Project_" + str(do.getRandomNumber())
     
     do.ensureLHNSectionExpanded("Project")
     count_before = do.countOfAnyObjectLHS("Project")
     do.createObjectSaveAddAnother("Project", object_1_name, "unchecked", True, "", False)
     do.createObjectSaveAddAnother("Project", object_2_name, "unchecked", False, "", True)
     do.clearSearchBoxOnLHS() #clear any text so total count displays
     do.ensureLHNSectionExpanded("Project")
     count_after = do.countOfAnyObjectLHS("Project")
           
     do.assertEqual(count_after, count_before+2, "Count has not incremented by 1 as expected.") 
            
     print "Object 1: "
     object_1_link = do.verifyObjectIsCreatedinLHN("Project", object_1_name)
     do.navigateToObjectAndOpenObjectEditWindow("Project",object_1_link)
     do.deleteObject()
     
     print "Object 2: "
     object_2_link = do.verifyObjectIsCreatedinLHN("Project", object_2_name)
     do.navigateToObjectAndOpenObjectEditWindow("Project",object_2_link)
     do.deleteObject()        
コード例 #2
0
ファイル: TestNoAccessRole.py プロジェクト: amrishs/ggrc-test
    def testNoAccessRole(self):
        self.testname="TestNoAccessRole"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        email = config.reader1
        reader = config.reader2
        password = config.same_password
        title = "Auto_Private_" + do.getTimeId() + str(do.getRandomNumber())

        do.createObject("Program", title, "checked")
        do.verifyObjectIsCreatedinLHN("Program", title)
        do.assertEqual(1, do.countOfAnyObjectLHS("Program"), "Expect count to be 1 but don't see it.")

        # now log out and then log in with the new account and try to create a program
        do.selectMenuInTopRight("Logout")
          
        # Refresh the page
        do.refresh()
          
        # Log in with new user
        do.login(reader, password)
        print "Log in as : " + do.whoAmI()
        do.uncheckMyWorkBox()
        
        try:
            do.verifyObjectIsCreatedinLHN("Program", title)
        except:
            do.assertEqual(0, do.countOfAnyObjectLHS("Program"), "Expect count to be 0 but don't see it.")
            print "Good...private program should not be visible to reader role unless permitted."
コード例 #3
0
    def testRelevantStress(self):
        self.testname="TestRelevantStress"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        titleContract = do.getUniqueString("contract")
        titleClause = do.getUniqueString("clause")
          
        print "Contract: " + titleContract
        print "Clause: " + titleClause
                       
        # SETUP        
        do.checkMyWorkBox() # show my objects only
        # Make sure we have at least 20 data assets already if not create them
        count = do.countOfAnyObjectLHS("Data")
        diff = 20 - count
        while diff > 0:
            id = do.getRandomNumber()            
            do.createObject("Data", "data_" + str(id))
            diff = diff - 1
            do.delay(5)
           
        # Map 20 data assets to Clause
        do.createObject("Clause", titleClause)   
        expandables = []   
        do.mapAObjectWidget("Data_Asset", "data_", False, expandables, 20)
           
        # Map a clause to contract
        do.createObject("Contract", titleContract)
         
        do.mapAObjectWidget("Clause", titleClause, False, ("Clause"), 1)         
        # expand it

        do.expandItemWidget("Clause", titleClause)
         
        # check the MakeAllRelevant checkbox
        do.makeAllRelevant(True)
        do.delay(120) 
        # switch to Data Asset tab
        do.selectInnerNavTab("data_asset")
        do.assertEqual(20, do.countOfAnyObjectInWidget("data_asset"), "Count is not 20 in Data Asset Widget.")
       
        # just select because it will maintain its expanded mode
        do.selectInnerNavTab("clause")  
        
        do.makeAllRelevant(False)
        do.delay(120) # takes time for the unmapping to complete
        
        # switch to Data Asset tab again
        do.selectInnerNavTab("data_asset")
        
        # if MAKE ALL RELEVANT checkbox is deselected, no data asset tab is shown and thus no count is shown either
        print "Continue to fail until CORE-890 is fixed."
        do.assertEqual(0, do.countOfAnyObjectInWidget("data_asset"), "Count is not 0 in Data Asset Widget.")
コード例 #4
0
    def testMyWorkPageGeneral(self):
        self.testname="TestMyWorkPageGeneral"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        item_input = ['Program', 'Workflow', 'Audit', 'Regulation', 'Policy', 'Standard', 'Contract', 'Clause', 'Section', \
                     'Objective', 'Control', 'Person', 
                     'OrgGroup', 'Vendor', 'System', 'Process', 'DataAsset', 'Product', \
                     'Project', 'Facility', 'Market']


        # open menu
        do.showLHMenu(True)

        # All and my object radio buttons exist?
        do.assertTrue(do.isMyObjectsOnlyPresent(), "My objects only radio button does not exist")
        do.assertTrue(do.isMyObjectsOnlyChecked(), "My objects only is not checked by default")
        
        # get counts for each type of object
        my_list = []
        for object in item_input:
            count_my = do.countOfAnyObjectLHS(object)
            my_list.append(count_my)

        
        do.assertTrue(do.isAllObjectsPresent(), "All objects radio button does not exist")        
        do.assertFalse(do.isAllObjectsChecked(), "All objects is checked by default which is wrong")
        do.uncheckMyWorkBox() # select all radio
          
        # program, workflows, audits with count in the parenthesis should update and should be different than in the above
        # get counts for each type of object
        all_list = []
        for object in item_input:
            count_all = do.countOfAnyObjectLHS(object)
            all_list.append(count_all)
        
        # counts are not updating; it's likely that there is a difference

        count_updated = False
        total_items = len(item_input)
        for object_count in my_list:
            my_count = my_list.pop()
            all_count = all_list.pop()
            total_items = total_items - 1
            
            if not my_count == all_count:
                count_updated = True
                break # good, it updates
            else:
                if total_items == 0:
                    do.assertTrue(count_updated, "Count of objects do not update.  Error.")
                    
            
        
        # verify that objects created by different users show up; repeat for all different object type
        # PRE-REQUISITES:  There are at least 2 objects created by 2 different users for each object type
        print ("WARNING !!!")
        print ("PRE-REQUISITES:  There are at least 2 objects created by 2 different users for each object type")
        for object in item_input:
            do.verifyAllUsersObjectsShown(object)
        
         
        # verify to each items in the LHS exist and labels are correct
        expected   = ['Programs', 'Workflows', 'Audits', 'Regulations', 'Policies', 'Standards', 'Contracts', 'Clauses', 'Sections', \
                     'Objectives', 'Controls', 'People', 
                     'Org Groups', 'Vendors', 'Systems', 'Processes', 'Data Assets', 'Products', \
                     'Projects', 'Facilities', 'Markets']
         
        dictionary = dict(zip(item_input, expected))
        for object in item_input:
            raw = do.getItemLabelInLHS(object)
             
            if object == 'OrgGroup' or \
               object == 'DataAsset':
                Nth = 2
            else:
                Nth = 1
             
            filtered = do.getTextUpToNthSpace(raw, Nth)
            expected_text = dictionary.get(object)
            do.assertTrue(do.compareText(filtered, expected_text), "Mismatch text for object: " + filtered)
        
        # add help content and verify
        do.addHelpTitleContent("Help Me", "I will help you.")
        do.clickHelpTopRightCorner()
        do.assertEqual(do.getHelpTitle(), "Help Me", "Fail to get Help title.")
        #do.assertEqual(do.getHelpContent(), "I will help you.", "Fail to get Help content.")
        do.clickHelpDone()
        
        # click help icon, then click outside of modal
        do.clickHelpIcon()
        do.clickMyTasksIcon()
コード例 #5
0
    def testRelevantMapping(self):
        self.testname="TestRelevantMapping"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        do.setUtils(util)
        do.login()

        # mapping and un-mapping up to 3 levels: 
        # Program->Policy->Section->Object
        titlePol = do.getUniqueString("policy") #regulation
        titlePrgm = do.getUniqueString("program")
        titleSec = do.getUniqueString("section")
        titleMkt = do.getUniqueString("market")
       
        print "Policy: " + titlePol
        print "Program: " + titlePrgm
        print "Section: " + titleSec
        print "Market: " + titleMkt
                    
        # SETUP
        do.createObject("Market", titleMkt) 
        do.createObject("Policy", titlePol)  
        last_created_object_link = do.createObject("Program", titlePrgm)
        do.mapAObjectLHN("Policy", titlePol)  # maps to a Policy object
        do.expandItemWidget("Policy", titlePol)  # expand the item so that "+ Section" link is displayed
        do.createSectionFromInnerNavLink(titleSec)
        do.mapObjectToSectionFromInnerNav(titleSec)
        do.mapObjectFormFilling("Market", titleMkt)
        do.expandWidget4thTier(titleMkt)
        
        # Policy page
        do.navigateToObjectWithSearch(titlePol, "Policy")
        do.navigateToInnerNavSection("Market")
        do.assertEqual(0, do.countOfAnyObjectInWidget("market"), "Count is not 0 in Widget.")
        do.assertEqual(0, do.countOfAnyObjectInnerNav("market"), "Count is not 0 in InnerNav.")
         
        # Verification: you don't see person object from Program page
        # 1 because the creator is automatically mapped to the program
        do.navigateToObjectWithSearch(titlePrgm, "Program")
        do.navigateToInnerNavSection("Market")
        do.assertEqual(1, do.countOfAnyObjectInWidget("market"), "Count is not 1 in Widget.")
        do.assertEqual(1, do.countOfAnyObjectInnerNav("market"), "Count is not 1 in InnerNav.")  
    
        # Verification: you see Market object in Section page
        do.navigateToObjectWithSearch(titleSec, "Section")
        do.navigateToInnerNavSection("Market")
        do.assertEqual(titleMkt, do.getTitleFromWidgetList(1, "Section"))
        do.assertEqual(1, do.countOfAnyObjectInWidget("market"), "Count is not 1 in Widget.")
        do.assertEqual(1, do.countOfAnyObjectInnerNav("market"), "Count is not 1 in InnerNav.") 
         
        # Verification: you see section object from People page
        do.uncheckMyWorkBox()        
        do.navigateToObjectWithSearch(titleMkt, "Market")
        do.navigateToInnerNavSection("Section")
        do.assertEqual(titleSec, do.getTitleFromWidgetList(1, "Market")) #STOP HERE
        do.assertEqual(1, do.countOfAnyObjectInWidget("section"), "Count is not 1 in Widget.")
        do.assertEqual(1, do.countOfAnyObjectInnerNav("section"), "Count is not 1 in InnerNav.") 

        # **** Test making person object relevant and verify its effect **************************
        do.navigateToObjectWithSearch(titlePol, "Regulation")
        
        # Before making it relevant
        do.navigateToInnerNavSection("Person")
        do.assertEqual(0, do.countOfAnyObjectInWidget("person"), "Count is not 0 in Widget.")
        do.assertEqual(0, do.countOfAnyObjectInnerNav("person"), "Count is not 0 in InnerNav.")
        
        do.navigateToInnerNavSection("Section")
        do.expandItemWidget("Section", titleSec)  # expand the item so that "+ Section" link is displayed
        do._searchObjectIn3rdLevelAndClickOnIt(titleMkt, True)
        do.expandWidget4thTier(titleMkt, True)

        # Verification: you now see person object from Regulation page
        do.navigateToInnerNavSection("Person")
        do.assertEqual(1, do.countOfAnyObjectInWidget("person"), "Count is not 1 in Widget.")
        do.assertEqual(1, do.countOfAnyObjectInnerNav("person"), "Count is not 1 in InnerNav.")

        # Verification: you don't see person object from Program page
        # 1 because the creator is automatically mapped to the program
        do.navigateToObjectWithSearch(titlePrgm, "Program")
        do.navigateToInnerNavSection("Person")
        do.assertEqual(1, do.countOfAnyObjectInWidget("person"), "Count is not 1 in Widget.")
        do.assertEqual(1, do.countOfAnyObjectInnerNav("person"), "Count is not 1 in InnerNav.")  

        # Verification: regulation object appears in the widget on People page
        do.navigateToObjectWithSearch(titleMkt, "Person")
        do.navigateToInnerNavSection("regulation")
        
        title_fr_widget = do.getTitleFromWidgetList(1, "Person")
        do.assertEqual(titlePol, title_fr_widget, "Titles do match.")