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