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 testHideOnProgramModal(self): self.testname="TestHideOnProgramModal" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() list_all = "all" list_items = "description, private, note, owner, contact, url, reference_url, code, effective_date, end_date, state" a_few_items = "owner, note" print "TEST THAT YOU CAN SHOW OR HIDE FIELDS/ELEMENTS ON PROGRAM MODAL." # fill in mandatory fields only do.openCreateNewObjectWindowFromLhn("Program") # hide_all, show_all, then hide individual do.hideInProgramNewModal(True, list_all) do.hideInProgramNewModal(False, list_all) do.hideInProgramNewModal(True, list_items) # show all again, hide a few will cause show_all to display, now reshow_all do.hideInProgramNewModal(False, list_all) do.hideInProgramNewModal(True, a_few_items) do.hideInProgramNewModal(False, list_all) # hide all again do.hideInProgramNewModal(True, list_all)
def testFourLevelsMapping(self): self.testname="TestFourLevelsMapping" 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->Regulation->Section->Object titlePol = do.getUniqueString("policy") titlePrgm = do.getUniqueString("program") titleSec = do.getUniqueString("section") titleMkt = do.getUniqueString("policy") do.createObject("Policy", titlePol) do.createObject("Program", titlePrgm) do.mapAObjectWidget("Policy", titlePol) do.createObject("Market", titleMkt) do.createObject("Section", titleSec) do.mapAObjectWidget("Market", titleMkt) do.mapAObjectWidget("Section", titleSec)
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."
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 testHideShowNewModalPeople(self): self.testname="TestHideShowNewModalPeople" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() list_all = "all" list_items = "enabled_user, company" a_few_items = "company" print "TEST THAT YOU CAN SHOW OR HIDE FIELDS/ELEMENTS IN CREATE NEW OBJECT MODAL." # fill in mandatory fields only do.openCreateNewObjectWindowFromLhn("Person") # hide_all, show_all, then hide individual do.hideInNewModal(list_all, True, "person") do.hideInNewModal(list_all, False, "person") # hide individually do.hideInNewModal(list_items, True, "person") # show all again, hide a few will cause show_all to display, now reshow_all do.hideInNewModal(list_all, False, "person") do.hideInNewModal(a_few_items, True, "person") do.hideInNewModal(list_all, False, "person") do.populateNewObjectData(do.generateNameForTheObject("person")) do.saveNewObjectAndWait()
def testAllTabsIntegrity(self): self.testname="TestAllTabsIntegrity" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() directive_xpath = '//a[(@class="governance list-toggle" and @data-object-singular="OBJECT")]' self.assertEqual("PROGRAMS", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Program")))) self.assertEqual("AUDITS", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Audit")))) temp = do.util.getTextFromXpathString('//a[(@class="governance list-toggle" and @data-object-singular="Regulation")]') self.assertEqual("REGULATIONS", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(self.directive_xpath.replace("OBJECT", "Regulation")))) self.assertEqual("POLICIES", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Policy"))) self.assertEqual("STANDARDS", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Standard"))) self.assertEqual("CONTRACTS", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Contract"))) self.assertEqual("CLAUSES", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Clause"))) self.assertEqual("Sections", self._returnStringUpToFirstSpace(directive_xpath.replace("OBJECT", "Section"))) self.assertEqual("Objectives", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Objective")))) self.assertEqual("Controls", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Control")))) self.assertEqual("People", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Person")))) self.assertEqual("Org Groups", do.util.getTextFromXpathString(element.left_nav_org_group_link)[0:10]) self.assertEqual("Systems", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "System")))) self.assertEqual("Processes", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Process")))) self.assertEqual("Data Assets", do.util.getTextFromXpathString(element.left_nav_data_asset_link)[0:11]) self.assertEqual("Products", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Product")))) self.assertEqual("Projects", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Project")))) self.assertEqual("Facilities", self._returnStringUpToFirstSpace(do.util.getTextFromXpathString(element.left_nav_expand_object_section_link.replace("OBJECT", "Facility")))) self.assertEqual("Markets", do.util.getTextFromXpathString(element.left_nav_market_link)[0:7])
def testCreatePersonProgramCreatorLogInOut(self): self.testname="TestCreatePersonProgramCreatorLogInOut" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() aEmail = "auto_email_" + str(do.getRandomNumber(65535)) + "@gmail.com" aName = do.getUniqueString("name") aCompany = do.getUniqueString("company") do.selectMenuInTopRight("Admin Dashboard") do.selectMenuItemInnerNavDashBoard("People") do.addPersonInAdminDB(aName, aEmail, aCompany) self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.") # edit person authorization do.selectMenuItemInnerNavDashBoard("People") # on the roles selection do.clickOnEditAuthorization(aName) do.assignUserRole("ProgramCreator") # now log out and then log in with the new account and try to create a program oldEmail = "*****@*****.**" oldName = "Example User" absFilePath = expanduser("~") + "/ggrc-core/src/ggrc/login/noop.py" do.changeUsernameEmail(oldName, aName, oldEmail, aEmail, absFilePath) do.selectMenuInTopRight("Logout") # Refresh the page do.refresh() # Log in with new user do.login() print "Log in as : " + do.whoAmI() object_list = ["Program", "Workflow", "Audit", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset", "Product", "Project", "Facility", "Market"] for object in object_list: # cannot create audit; it requires other non-system wide role if object == "Audit": do.assertFalse(do.doesCreateNewExist(object), "Create New button exists for " + str(object)) else: do.assertTrue(do.doesCreateNewExist(object), "Create New button does not exist for " + str(object)) # should be able to create a program object last_created_object_link = do.createObject("Program") object_name = str(do.util.getTextFromXpathString(last_created_object_link)).strip() self.assertTrue(do.partialMatch("program-auto-test", object_name), "Fail to match program name.") # Restore old login information do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath) do.selectMenuInTopRight("Logout")
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.")
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 testImportExportSystem(self): self.testname="TestImportExportSystem" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) do = Helpers(self) do.setUtils(util) do.login() # create a system systemObject =do.createObject("System") systemObject = str(util.getTextFromXpathString(systemObject)) #it's name, not xpath print "" print "On screen." print "System object is displayed as : " + systemObject # export system filePath = config.test_db + "SYSTEMS.csv" do.selectMenuInTopRight("Admin Dashboard") do.exportFile("systems", filePath) # verify that information in file matched self.assertTrue(do.verifyDataInExportFile(systemObject, filePath), "System object not found in exported file.") # import system # create some data, add it to the import file and upload number = str(do.getRandomNumber()) systemObject = "systemImport" + number print "" print "Add this new system object to the import file and upload." print "System object: " + systemObject # proof: verify that this user never exist in the database do.navigateToObjectWithSearchWithNoAssertion(systemObject, "System") count = do.countOfAnyObjectLHS("System") self.assertEqual(0, count, "System " + systemObject + " is verified not existed.") # make it complete conformingText = "SYSTEM-" + number + "," + systemObject + ",,,,,,[email protected],,,,,,2014-7-16,2014-7-16,,Draft" do.appendToFile(conformingText, filePath) do.importFile("Systems", filePath) do.refresh() # after import, verify that user has been added to the database do.navigateToObjectWithSearch(systemObject, "System") count = do.countOfAnyObjectLHS("System") self.assertEqual(1, count, "System " + systemObject + " is not added successfully.") self.assertEqual(systemObject, do.getObjectNavWidgetInfo("username"), "System object " + systemObject + " is not found in the database.") print "" print "System object is imported successfully and found in the database." print systemObject
def testLogin(self): self.testname="TestLogin" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() self.assertTrue(util.isElementPresent(element.dashboard_title), "no dashboard page found")
def testReindex(self): self.testname="deleteObject" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) do = Helpers(self) do.setUtils(util) do.login() util.driver.execute_script(REINDEX_SCRIPT) time.sleep(90)
def testDeleteObject(self): self.testname="TestDeleteObject" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() do.clickActiveTab()
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 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 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 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 testCreatePersonNoAccessLogInOut(self): self.testname="TestCreatePersonNoAccessLogInOut" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() aEmail = "auto_email_" + str(do.getRandomNumber(65535)) + "@gmail.com" aName = do.getUniqueString("name") aCompany = do.getUniqueString("company") do.selectMenuInTopRight("Admin Dashboard") do.selectMenuItemInnerNavDashBoard("People") do.addPersonInAdminDB(aName, aEmail, aCompany) self.assertTrue(do.searchPersonInAdminDB(aName), "Fail searching for newly created person in Admin Dashboard.") # edit person authorization do.selectMenuItemInnerNavDashBoard("People") # on the roles selection do.clickOnEditAuthorization(aName) do.assignUserRole("No access") # now log out and then log in with the new account and try to create a program oldEmail = "*****@*****.**" oldName = "Example User" absFilePath = expanduser("~") + "/ggrc-core/src/ggrc/login/noop.py" do.changeUsernameEmail(oldName, aName, oldEmail, aEmail, absFilePath) do.selectMenuInTopRight("Logout") # Refresh the page do.refresh() # Log in with new user do.login() print "Log in as : " + do.whoAmI() object_list = ["Program", "Task", "Audit", "Regulation", "Policy", "Standard", "Contract", "Clause", "Section", "Objective", "Control", "Person", "OrgGroup", "System","Process", "DataAsset", "Product", "Project", "Facility", "Market"] # no Create New occurs for object in object_list: do.navigateLHSMenu4NoAccess(object) do.assertFalse(do.doesThisElementExist(str(Elements.left_nav_object_section_add_button).replace("OBJECT", object), 8)) # Restore old login information do.changeUsernameEmail(aName, oldName, aEmail, oldEmail, absFilePath) do.selectMenuInTopRight("Logout")
def testAllRolesPresent(self): self.testname="TestAllRolesPresent" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util) do.login() do.selectMenuInTopRight("Admin Dashboard") do.selectMenuItemInnerNavDashBoard("Roles") do.verifyDifferentRolesExist()
def testOrgGroupMapWidget(self): self.testname="TestOrgGroupMapWidget" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "OrgGroup") do.login() org_group_name = "OrgGroup for Auto Mapping from Widget" +do.getTimeId() last_created_object_link = do.createObject("OrgGroup",org_group_name) for obj in grcobject.org_group_map_to_widget: do.mapAObjectWidget(obj)
def testProgramMapWidget(self): self.testname="TestProgramMapWidget" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Program") do.login() program_name = "Program for Auto Mapping from Widget" + do.getTimeId() last_created_object_link = do.createObject("Program", program_name) for obj in grcobject.program_map_to_widget: do.mapAObjectWidget(obj, "", True, ("Control", "Objective", "System"))
def testPolicyMapWidget(self): self.testname="TestPolicyMapWidget" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Policy") do.login() policy_name = "Policy for Auto Mapping from Widget" +do.getTimeId() last_created_object_link = do.createObject("Policy", policy_name) for obj in grcobject.policy_map_to_widget: do.mapAObjectWidget(obj, policy_name, False, ("Section", "Objective", "Control"))
def testVendorMapWidget(self): self.testname="TestVendorMapWidget" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Vendor") do.login() vendor_name = "Vendor for Auto Mapping from Widget" + do.getTimeId() last_created_object_link = do.createObject("Vendor", vendor_name) for obj in grcobject.vendor_map_to_widget: do.mapAObjectWidget(obj, "")
def testDataAssetMapWidget(self): self.testname="TestDataAssetMapWidget" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "DataAsset") do.login() data_asset_name = "DataAsset for Auto Mapping from Widget" +do.getTimeId() last_created_object_link = do.createObject("DataAsset",data_asset_name) for obj in grcobject.data_asset_map_to_widget: do.mapAObjectWidget(obj)
def testControlMapWidget(self): self.testname="TestControlMapWidget" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() grcobject = GRCObject() do = Helpers(self) do.setUtils(util, "Control") do.login() control_name = "Control for Auto Mapping from Widget" + do.getTimeId() last_created_object_link = do.createObject("Control", control_name) for obj in grcobject.control_map_to_widget: do.mapAObjectWidget(obj)
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 testPersonCreate(self): self.testname="TestPersonCreate" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() print "Log in as : " + do.whoAmI() number = str(do.getRandomNumber()) aEmail = "auto_email_" + number + "@gmail.com" aName = do.getUniqueString("name") aCompany = do.getUniqueString("company") do.createPersonLHN(aName, aEmail, aCompany)
def testImportExportHelp(self): self.testname="TestImportExportHelp" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) do = Helpers(self) do.setUtils(util) do.login() # export help filePath = config.test_db + "HELP.csv" do.selectMenuInTopRight("Admin Dashboard") do.exportFile("help", filePath) # import help do.importFile("Processes", filePath)