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 testCreatePrivateProgramReader(self): self.testname="TestCreatePrivateProgramReader" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() email = config.reader1 password = config.same_password private_prgm_1 = do.createPrivateProgramPermission(email, "", "ProgramReader") print private_prgm_1 # map any object so that we can check if read can see it or not do.mapAObjectLHN("Contract") # now log out and then log in with the ProgramReader user do.selectMenuInTopRight("Logout") do.refresh() # Log in with new user do.login(email, password) print "Log in as : " + do.whoAmI() do.assertEquals("Reader", do.getRoleLabelInTopRight(), "Label does not says 'Reader'.") 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.") # map link and edit authorization link should not exist do.selectInnerNavTab("person") do.assertFalse(do.isMapLinkPresent("person"), "Expect map link not present since it's a ProgramReader role.") do.assertFalse(do.isEditAuthorizationPresent(), "Expect Edit Authorization link not present since it's a ProgramReader role.") # go to program info page do.selectInnerNavTab("program") do.assertFalse(do.isInfoPageEditLinkPresent(), "Expect Edit link not present since it's a ProgramReader role.") do.assertFalse(do.isSubmitForReviewPresent(), "Expect Submit For Review link not present since it's a ProgramReader role.")
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 testMapRegulationToSystem(self): self.testname="TestMapRegulationToSystem" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() titleReg = do.getUniqueString("regulation") titleSys = do.getUniqueString("system") do.createObject("Regulation", titleReg) do.createObject("System", titleSys) do.mapAObjectLHN("Regulation", titleReg)
def testFacilityMapLHN(self): self.testname="TestFacilityMapLHN" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Facility") do.login() system_name = "Facility for Auto Mapping from LHN" +do.getTimeId() last_created_object_link = do.createObject("Facility", system_name) for obj in grcobject.facility_map_to_lhn: do.mapAObjectLHN(obj) # test unmapping for obj in grcobject.facility_map_to_lhn: self.assertTrue(do.unmapAObjectFromWidget(obj))
def testMapSystemToPeople(self): self.testname="TestMapSystemToPeople" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() aEmail = "auto_email_" + str(do.getRandomNumber()) + "@gmail.com" aName = do.getUniqueString("name") aCompany = do.getUniqueString("company") titleSys = do.getUniqueString("system") do.createObject("System", titleSys) do.createPersonLHN(aName, aEmail, aCompany) do.mapAObjectLHN("System", titleSys)
def testObjectiveMapLHN(self): self.testname="TestObjectiveMapLHN" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Objective") do.login() program_name = "Objective for Auto Mapping from LHN" +do.getTimeId() last_created_object_link = do.createObject("Objective", program_name) for obj in grcobject.objective_map_to_lhn: do.mapAObjectLHN(obj) #util.refreshPage() # test unmapping for obj in grcobject.objective_map_to_lhn: self.assertTrue(do.unmapAObjectFromWidget(obj))
def testObjectMapsToItself(self): self.testname="TestObjectMapsToItself" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Contract") do.login() contract_name = "Contract for Auto Mapping from LHN" +do.getTimeId() contract_map_to_lhn2 = ["Contract", "Program"] for obj in grcobject.contract_map_to_lhn2: last_created_object_link = do.createObject(obj, contract_name) do.mapAObjectLHN(obj) #util.refreshPage() # test unmapping for obj in grcobject.contract_map_to_lhn: self.assertTrue(do.unmapAObjectFromWidget(obj))
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.")