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()        
    def testCreatePrivateProgramOwner(self):
        self.testname="TestCreatePrivateProgramOwner"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        do = Helpers(self)
        grcobject = GRCObject()
        do.setUtils(util)
        do.login()

        email = config.creator1
        password = config.same_password

        private_prgm_1 = do.createPrivateProgramPermission(email, "", "ProgramOwner")       
        print private_prgm_1
        # map any object so that we can check that reader can see
        do.mapAObjectLHN("Contract")
 
        # now log out and then log in with the ProgramEditor user
        do.selectMenuInTopRight("Logout")          
        do.refresh()          
        # Log in with new user
        do.login(email, password)
        print "Log in as : " + do.whoAmI()      
 
        do.assertEquals("ProgramCreator", do.getRoleLabelInTopRight(), "Label does not says 'ProgramCreator'.")
        do.selectMenuInTopRight("My Work")
         
        # verify that user can see program tab and some programs; by seeing counts 
        do.selectInnerNavTab("program")
        count = do.countOfAnyObjectInWidget("Program")
        do.assertGreater(count, 0, "Fail because count is expected to be non-zero if programs indeed exist.")
         
        # and being able to navigate to the expanded program row
        index = do.expandItemWidget("program", private_prgm_1)
        do.clickViewProgram("program", index)
         
        # can see mapped objects
        do.selectInnerNavTab("contract")
        count = do.countOfAnyObjectInWidget("Contract")
        do.assertGreater(count, 0, "Fail because count is expected to be non-zero if programs indeed exist.")         

        # can map an object to program
        do.mapAObjectWidget("Product", "", True, ("Control", "Objective", "System"))

        # map link and edit authorization link should not exist
        do.selectInnerNavTab("person")
        do.assertTrue(do.isMapLinkPresent("Person"), "Expect map link present since it's a ProgramOwner role.")
        do.expandItemWidget("Person", email)
        do.assertTrue(do.isEditAuthorizationPresent(), "Expect Edit Authorization link present since it's a ProgramOwner role.")
        
        # can edit info page
        do.selectInnerNavTab("info")
        do.assertTrue(do.isSubmitForReviewPresent(), "Expect Submit For Review link not present since it's a ProgramOwner role.") 
        do.clickOnInfoPageEditLink()
        do.populateObjectInEditWindow(private_prgm_1 , grcobject.program_elements, grcobject.program_values)
        do.openObjectEditWindow()
        do.verifyObjectValues(grcobject.program_elements, grcobject.program_values)   
        do.deleteObject()
    def testDeleteObjects(self):
        self.testname="TestDeleteObjects"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        grcobject = GRCObject()
        do = Helpers(self)
        do.setUtils(util)
        do.login()
        for section in ["Regulation",
                        "Objective",
                        "Program",                        
                        "Contract",
                        "Policy",
                        "Control",
                        "System",
                        "Process",
                        "Data",
                        "Product",
                        "Project",
                        "Facility",
                        "Market",
                        "Group"
                           ]:
            print "Starting Deletion of Objects for " + section
            deleted_objects=0
            do.ensureLHNSectionExpanded(section)
            do.checkMyWorkBox()
            
            object_left_nav_section_object_link = element.left_nav_expand_object_section_link.replace("OBJECT", section)
            
            # enter term to search
            util.inputTextIntoField("Auto", element.left_nav_search_input_textfield)
            util.pressEnterKey(element.left_nav_search_input_textfield)
            
            left_nav_first_link = element.left_nav_first_object_link_in_the_section.replace("SECTION",section)
            util.waitForElementToBePresent(left_nav_first_link)
            lef_nav_objects_for_deletion_in_section = element.left_nav_objects_candidate_for_deletion.replace("SECTION",section )
            number_of_auto_objects = do.countOfAnyObjectLHS(section)
                
            deleted_objects = number_of_auto_objects - 2     # leave 2 behind                        

            while (deleted_objects > 0):
                            
                do.navigateToObjectAndOpenObjectEditWindow(section,lef_nav_objects_for_deletion_in_section, refresh_page=False)
                do.deleteObject()
                deleted_objects = deleted_objects - 1 #LHN collapse after this
                
                do.showLHMenu(True) # reopen it
            
                object_left_nav_section_object_link = element.left_nav_expand_object_section_link.replace("OBJECT", section)
                left_nav_first_link = element.left_nav_first_object_link_in_the_section.replace("SECTION",section)
                util.waitForElementToBePresent(left_nav_first_link)
                lef_nav_objects_for_deletion_in_section = element.left_nav_objects_candidate_for_deletion.replace("SECTION",section )
                
            print "Finished deletion of objects for " + section + ". " + str(deleted_objects) + " object is left to be deleted."
 def testProgramCreate(self):
     self.testname="TestProgramCreate"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     do = Helpers(self)
     do.setUtils(util)
     do.login()
     last_created_object_link =do.createObject("Program")
     do.navigateToObjectAndOpenObjectEditWindow("Program",last_created_object_link)
     do.deleteObject()
 def testSectionCreate(self):
     self.testname="TestSectionCreate"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     do = Helpers(self)
     do.setUtils(util)
     do.login()
     last_created_object_link =do.createObjectSaveAddAnother("Section", "", "unchecked")
     do.navigateToObjectAndOpenObjectEditWindow("Section",last_created_object_link)
     do.deleteObject()
 def testSystemCreate(self):
     self.testname="TestSystemCreate"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     do = Helpers(self)
     do.setUtils(util)
     do.login()
     last_created_object_link =do.createObject("System")
     #object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
     do.navigateToObjectAndOpenObjectEditWindow("System",last_created_object_link)
     do.deleteObject()
Exemple #7
0
    def testEventLog(self):
        self.testname="TestEventLog"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        grcobject = GRCObject()
        do = Helpers(self)
        do.setUtils(util)
        do.login()

      # CREATE PROGRAM
        program_name = "Program_created_from_LHN"  + do.getTimeId()
        object_list = ["Regulation", "Contract", "Policy", "Standard"]
              
        last_created_object_link = do.createObject("Program", program_name)
      
        # MAP SOME OBJECTS
        for obj in object_list: 
            do.mapAObjectLHN(obj, program_name)      
              
        #do.selectInnerTabWhichAlreadyPresent("info")  
        do.selectInnerNavTab("info")      
        do.openObjectEditWindow()
        do.deleteObject()
                    
        do.selectMenuInTopRight("Admin Dashboard")
        do.selectMenuItemInnerNavDashBoard("Events")
            
        # when delete an object that has mapping, it automatically unmap and then delete
        self.assertTrue(do.verifyInfoInEventLogTable("unmapped from", 1), "Cannot find 'unmapped from Program' in the Event Log table.")
           
        # 4 times
        # 4 lines of "mapped to" because there are 4 mappings from the top
        self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 2), "Cannot find 'map to:row2' in the Event Log table.")
        self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 3), "Cannot find 'map to:row3' in the Event Log table.")
        self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 4), "Cannot find 'map to:row4' in the Event Log table.")
        self.assertTrue(do.verifyInfoInEventLogTable("mapped to", 5), "Cannot find 'map to:row5' in the Event Log table.")
           
        # tests the "by whom" and "when at" fields
        self.assertTrue(do.verifyInfoInEventLogTable("whom", 2), "Cannot find 'whom' in the Event Log table.")
        self.assertTrue(do.verifyInfoInEventLogTable("when", 2), "Cannot find 'when' in the Event Log table.")
           
        # the program created should be logged
        self.assertTrue(do.verifyInfoInEventLogTable(program_name, 6), "Cannot find 'create program' in the Event Log table.")
        
        # verify that Prev and Next buttons work
        self.assertTrue(do.verifyPrevNextOperation(), "Fail verifying Prev and Next buttons.")
        
        
        # CORE-727
        print "CORE-727 is still open which causes this failure."
 def testRegulationEdit(self):
     self.testname="TestRegulationEdit"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     do = Helpers(self)
     grcobject = GRCObject()
     do.setUtils(util)
     do.login()
     last_created_object_link = do.createObject("Regulation")
     object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
     do.navigateToObjectAndOpenObjectEditWindow("Regulation",last_created_object_link)
     do.populateObjectInEditWindow( object_name , grcobject.regulation_elements, grcobject.regulation_values)
     do.openObjectEditWindow()
     do.verifyObjectValues(grcobject.regulation_elements, grcobject.regulation_values)
     do.deleteObject()
Exemple #9
0
 def testSectionEdit(self):
     self.testname="TestSectionEdit"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     do = Helpers(self)
     grcobject = GRCObject()
     do.setUtils(util)
     do.login()
     object_name = "Auto_Section_" + do.getTimeId() + str(do.getRandomNumber())
     last_created_object_link = do.createObjectSaveAddAnother("Section", object_name, "unchecked")
     #object_name = str(util.getTextFromXpathString(last_created_object_link)).strip()
     do.navigateToObjectAndOpenObjectEditWindow("Section",last_created_object_link)
     do.populateObjectInEditWindow( object_name , grcobject.section_elements, grcobject.section_values)
     do.openObjectEditWindow()
     do.verifyObjectValues(grcobject.section_elements, grcobject.section_values)
     do.deleteObject()
 def testCreateUpdateDeleteSystem(self):
     self.testname="TestCreateUpdateDeleteSystem"
     self.setup()
     util = WebdriverUtilities()
     util.setDriver(self.driver)
     element = Elements()
     grcobject = GRCObject()
     do = Helpers(self)
     do.setUtils(util)
     myUtil = do.getUtils()
     do.login()
     
     aEmail = "*****@*****.**" #already exists in the database
     
     last_created_object_link = do.createObject("System")
     object_name = str(do.util.getTextFromXpathString(last_created_object_link)).strip()
     do.navigateToObjectAndOpenObjectEditWindow("System", last_created_object_link)
     do.populateObjectInEditWindow(object_name , grcobject.system_elements, grcobject.system_values, aEmail)
     do.openObjectEditWindow()
     do.verifyObjectValues(grcobject.system_elements, grcobject.system_values)
     do.deleteObject()
Exemple #11
0
    def testProgramAudit(self):
        self.testname="TestProgramAudit"
        self.setup()
        util = WebdriverUtilities()
        util.setDriver(self.driver)
        element = Elements()
        grcobject = GRCObject()
        do = Helpers(self)
        do.setUtils(util)
        do.login()
        # Read audit_setup_data to retrieve program name and the IDs of the 3 objectives
        #
        objectiveID={}
        # default to using setup file for TEST server
        setup_file = SETUP_FILE_PREFIX + TARGET_SERVER_DICT.get(config.url, "test")
        f = open(os.path.join(SETUP_DIR, setup_file), "r")
        program_name=f.readline().strip("\n")
        # 1.  Navigate to the Program page created in Audit Part 1
        #print first_program_in_lhn
        do.navigateToObjectWithSearch(program_name,"Program")
        util.max_screen()
        
        # 2.  Choose Audit from Object page nav to bring up the Audit widget
        do.navigateToAuditSectionViaInnerNavSection("Audit")

        # 3.  Click on blue +Audit link in widget
        util.clickOn(element.audit_area_plus_audit_link)
                     
        # 4.  New Audit (modal)
        do.authorizeGAPI()  # Another place GAPI dialog could pop up
        new_audit_title = do.createAudit(program_name)
        
        # 5.  Confirm the audit appear in the widget
        newly_created_audit = element.audit_area_by_title.replace("AUDIT_TITLE", new_audit_title)
        print newly_created_audit
        util.waitForElementToBePresent(newly_created_audit)
        self.assertTrue(util.isElementPresent(newly_created_audit), "do not see the newly created audit " +new_audit_title )
        
        # 6. Click on it to open the 2nd tier info.  confirm there are 3 requests in the PBC Requests section. 
        # GAPI could pop up here
        do.authorizeGAPI()
        util.scrollIntoView(newly_created_audit)
        util.clickOn(newly_created_audit + element.first_link_within)
        #util.switch_to_active_element()
        util.max_screen()
        util.scrollIntoView(newly_created_audit)
        #verifying the 3 objectives
        
        do.dismissFlashMessages()
        for objective_title in grcobject.objective_title:
            objective_title_element = element.audit_pbc_request.replace("TITLE", objective_title)
            print objective_title_element
            util.waitForElementToBePresent(objective_title_element)
            self.assertTrue(util.isElementPresent(objective_title_element), "do not see the pbc request " + objective_title_element )
            util.scrollIntoView(objective_title_element)
        
        #do.waitForAlertSuccessMessages()
        
        ####7. Change Objective 2 for Auto test of Audit - Type: Interview
        ###print "Change Objective 2 for Auto test of Audit - Type: Interview"
        #### navigate into PBC edit modal
        ####click on "Objective 2 for Auto test of Audit" to open 2nd tier info
        ###print "click on Objective 2 for Auto test of Audit to open 2nd tier info"
        ###do.expandCollapseRequest(grcobject.objective_title[1])
        ####click on Edit PBC Request
        ###util.waitForElementToBePresent(element.audit_pbc_request_expanded_content_edit_link)
        ###self.assertTrue(util.isElementPresent(element.audit_pbc_request_expanded_content_edit_link), "do not see the Edit link in the expanded request  "  )
        ###util.clickOn(element.audit_pbc_request_expanded_content_edit_link)
        ###objective2_selected_option = element.audit_pbc_request_modal_type_select_selected_option
        ###util.waitForElementToBePresent(element.audit_pbc_request_modal_type_select)
        ###util.selectFromDropdownUntilSelected(element.audit_pbc_request_modal_type_select,  "Interview")
        ####verifying the selected option
        ###
        ###util.waitForElementToBePresent(objective2_selected_option)
        ###do.saveObjectData()
        ###util.clickOn(element.audit_pbc_request_expanded_content_edit_link)
        ###new_value = util.getTextFromXpathString(objective2_selected_option)
        ###self.assertTrue(new_value =="Interview" , "the selected option is not Interview" )

        ####Delete
        ###print "deleting Request"
        ###do.deleteObject()
        ### #8. Change Objective 3 for Auto test of Audit - Type: Population Sample
        ###objective3_select = element.audit_pbc_request_type_select.replace("TITLE", grcobject.objective_title[2] )
        ###do.expandCollapseRequest(grcobject.objective_title[2])
        ####click on Edit PBC Request
        ###util.waitForElementToBePresent(element.audit_pbc_request_expanded_content_edit_link)
        ###self.assertTrue(util.isElementPresent(element.audit_pbc_request_expanded_content_edit_link), "do not see the Edit link in the expanded request  "  )
        ###util.clickOn(element.audit_pbc_request_expanded_content_edit_link)
        ###objective3_selected_option = element.audit_pbc_request_modal_type_select_selected_option
        ###util.waitForElementToBePresent(element.audit_pbc_request_modal_type_select)
        ###util.selectFromDropdownUntilSelected(element.audit_pbc_request_modal_type_select,  "Population Sample")
        ####verifying the selected option
        ###
        ###util.waitForElementToBePresent(objective3_selected_option)
        ###do.saveObjectData()
        ###util.clickOn(element.audit_pbc_request_expanded_content_edit_link)
        ###new_value = util.getTextFromXpathString(objective2_selected_option)
        ###self.assertTrue(new_value == "Population Sample" , "the selected option is not Population Sample" )



        ####Delete
        ###print "deleting Response"
        ###do.deleteObject()
        
        #9.    Click on Objective 1 for Auto Test of Audit to open 2nd tier info (Documentation Response)
        #util.scrollIntoView(newly_created_audit_open_link)
        do.expandCollapseRequest(grcobject.objective_title[0])
        do.setRequestToRespondable(grcobject.objective_title[0])
        # open the response model and fill it out
        new_response_button = element.audit_pbc_request_response_create.replace("TITLE", grcobject.objective_title[0])
        util.waitForElementToBePresent(new_response_button)
        util.clickOn(new_response_button)
        new_response_title = "Response to " + grcobject.objective_title[0]
        do.NewResponseCreate(new_response_title)

        response_element = element.audit_pbc_request_response2.replace("TITLE", grcobject.objective_title[0]).replace("RESPONSE", new_response_title)
        print "response element " + response_element
        util.waitForElementToBePresent(response_element)
        util.scrollIntoView(response_element)  
        time.sleep(20)
        self.assertTrue(util.isElementPresent(response_element), "can't see the new Response for the request link") 

        # look for edit button
        new_response_edit_link = element.audit_pbc_request_expanded_response_edit_link2.replace("TITLE", grcobject.objective_title[0]).replace("RESPONSE", new_response_title)
        util.waitForElementToBePresent(new_response_edit_link)
        util.clickOn(new_response_edit_link)
        # need to re-open
        # verify assignee is the same as audit lead ([email protected])
        pbc_response_elements = {
            # name is description, but functions more like a title in
            # the context of the verifyObjectValues helper
            "description": element.response_title,
            "owner": element.response_assignee,
        }

        pbc_response_values = {
            "description": new_response_title,
            "owner": do.current_user_email(),
        }
        do.verifyObjectValues(pbc_response_elements, pbc_response_values, "Audit")
        do.saveObjectData()
        audit_edit_button = newly_created_audit + element.audit_edit
        util.scrollIntoView(audit_edit_button)
        util.clickOn(audit_edit_button)
        do.deleteObject()