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 testAdminDBGeneral(self): # testrecip@gmail exists in the database the_email = '*****@*****.**' roles = 9 # nine types of roles self.testname="TestAdminDBGeneral" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() do.selectMenuInTopRight("Admin Dashboard") # verify people table do.selectMenuItemInnerNavDashBoard("People") self.assertTrue(do.searchPersonInAdminDB(the_email), "Cannot find it in the People table.") people_count = do._countOfObjectsFromAdminDB("people") self.assertEquals(1, people_count, "Expect count equals to 1, but it's " + str(people_count)) # verify Roles table do.selectMenuItemInnerNavDashBoard("Roles") roles_count = do._countOfObjectsFromAdminDB("roles") self.assertEquals(roles, roles_count, "Expect count equals to" + str(roles) + ", but it's " + str(roles_count)) # verify events table # There are more than 22 thousands entries so can't count every entries. Work-around is to verify that it # increments by 1 when you create an object for example do.selectMenuItemInnerNavDashBoard("Events") events_count_before = do._countOfObjectsFromAdminDB("events") #events_count_from_label = do._countOfObjectsFromAdminDBLabel("events") #self.assertEquals(events_count_before, events_count_from_label, "Events count is not in sync.") xpath = do.createObject("Contract") title = util.getTextFromXpathString(xpath) do.selectMenuInTopRight("Admin Dashboard") do.selectMenuItemInnerNavDashBoard("Events") do.delay(20) #events table takes time to load events_count_after = do._countOfObjectsFromAdminDB("events") #self.assertEquals(events_count_before, events_count_from_label, "Events count is not in sync.") self.assertLess(events_count_before, events_count_after, "Count before=" + str(events_count_before) + "; Count after=" + str(events_count_after))
def testHideShowNewModalWorkflow(self): self.testname="TestHideShowNewModalWorkflow" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) element = Elements() do = Helpers(self) do.setUtils(util) do.login() list_all = "all" list_items = "description, owner, frequency, email_preferences, first_task_groups_title, custom_email_message" a_few_items = "frequency, custom_email_message" print "TEST THAT YOU CAN SHOW OR HIDE FIELDS/ELEMENTS IN CREATE NEW OBJECT MODAL." # fill in mandatory fields only do.openCreateNewObjectWindowFromLhn("Workflow") # hide_all, show_all, then hide individual do.hideInNewModal(list_all, True, "workflow") do.hideInNewModal(list_all, False, "workflow") # hide individually do.hideInNewModal(list_items, True) # show all again, hide a few will cause show_all to display, now reshow_all do.hideInNewModal(list_all, False, "workflow") do.hideInNewModal(a_few_items, True, "workflow") do.hideInNewModal(list_all, False, "workflow") do.populateNewObjectData(do.generateNameForTheObject("workflow")) do.saveNewObjectAndWait() do.delay(15) # 15 seconds more do.selectInnerNavTab("info") do.clickInfoPageEditLink() # now start testing hide/show after clicking on the Edit link do.hideInNewModal(list_all, True, "workflow", "", "edit") do.hideInNewModal(list_all, False, "workflow", "", "edit") do.hideInNewModal(a_few_items, True, "workflow", "", "edit") do.hideInNewModal(list_all, False, "workflow", "", "edit")
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.")