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 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()
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()
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()