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 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)
def testImportPeopleValidation(self): self.testname="TestImportPeopleValidation" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) do = Helpers(self) do.setUtils(util) do.login() do.selectMenuInTopRight("Admin Dashboard") self.assertFalse(do.importFile("People", self.dupEmail, False, "Error"), "Fail negative test on duplicate email.") do.selectMenuInTopRight("Admin Dashboard") self.assertFalse(do.importFile("People", self.noEmail, False, "Error"), "Fail negative test with email field.") do.selectMenuInTopRight("Admin Dashboard") self.assertFalse(do.importFile("People", self.wrongType, False, "Error"), "Fail negative test where type is not people.") # THIS ONE FAILS BECAUSE THERE IS A AN ACTUAL BUG !!! 16463790 "Uncaught SecurityError" print ("THIS ONE FAILS BECAUSE THERE IS A AN ACTUAL BUG !!! 16463790 'Uncaught SecurityError.' ") print ("Need to uncomment when it's fixed.")
def testImportProcessesValidation(self): noRow = config.test_db + "PROCESSES_NO_ROW.csv" wrongType = config.test_db + "PROCESSES_WRONG_TYPE.csv" noTitle = config.test_db + "PROCESSES_NO_TITLE.csv" dupTitle = config.test_db + "PROCESSES_DUP_TITLE.csv" self.testname="TestImportProcessesValidation" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) do = Helpers(self) do.setUtils(util) do.login() do.selectMenuInTopRight("Admin Dashboard") self.assertFalse(do.importFile("Processes", noRow, False, "Warning: Missing column"), "Fail negative test on file with now data.") do.selectMenuInTopRight("Admin Dashboard") self.assertFalse(do.importFile("Processes", wrongType, False, "Warning: Type must be"), "Fail negative test on file with wrong data type.") self.assertEquals(do.getWrongTypeMessage(),"Type must be \"Processes\"", "Fail to display 'wrong type' message.") do.selectMenuInTopRight("Admin Dashboard") self.assertTrue(do.importFile("Processes", noTitle, True), "Fail negative test on file with no title.") self.assertEquals(do.getImportFailedMessage(), "Error!", "Fail to display 'Error' message. ")
def testImportExportPeople(self): self.testname="TestImportExportPeople" self.setup() util = WebdriverUtilities() util.setDriver(self.driver) do = Helpers(self) do.setUtils(util) do.login() # create a person number = str(do.getRandomNumber()) aEmail = "email" + number + "@gmail.com" aName = "name" + number aCompany = "company" + number do.createPersonLHN(aName, aEmail, aCompany) do.uncheckMyWorkBox() do.navigateToObjectWithSearch(aName, "Person") print "" print "On screen." print "User is displayed as : " + aName print "Email is displayed as : " + aEmail print "Company is displayed as : " + aCompany # export people filePath = config.test_db + "PEOPLE.csv" print filePath do.selectMenuInTopRight("Admin Dashboard") do.exportFile("people", filePath) # verify that information in file matched self.assertTrue(do.verifyPeopleExportFile(aName, aEmail, aCompany, filePath), "User not found in exported file.") # import people # create some data, add it to the import file and upload number = str(do.getRandomNumber()) aEmail = "emailImport" + number + "@gmail.com" aName = "nameImport" + number aCompany = "companyImport" + number print "" print "Add this new user info to the import file and upload." print "User name: " + aName print "Email: " + aEmail print "Company: " + aCompany userInfo = aName + "," + aEmail + "," + aCompany # proof: verify that this user never exist in the database do.navigateToObjectWithSearchWithNoAssertion(aName, "Person") count = do.countOfAnyObjectLHS("Person") self.assertEqual(0, count, "User " + aName + " is verified not existed.") do.appendToFile(userInfo, filePath) do.importFile("People", filePath) do.refresh() # after import, verify that user has been added to the database do.navigateToObjectWithSearch(aName, "Person") count = do.countOfAnyObjectLHS("Person") self.assertEqual(1, count, "User " + aName + " is verified not existed.") self.assertEqual(aName, do.getObjectNavWidgetInfo("username"), "User's name " + aName + " is not found in the database.") self.assertEqual(aEmail, do.getObjectNavWidgetInfo("email"), "User's email " + aEmail + " is not found in the database.") self.assertEqual(aCompany, do.getObjectNavWidgetInfo("company"), "User's company " + aCompany + " is not found in the database.") print "" print "User is imported successfully and found in the database." print aName + "," + aEmail + "," + aCompany