class Test_001_Login: logger=LogGen.loggen() baseUrl=configure.getUrl() company=configure.getCompany() username=configure.getUsername() @pytest.mark.function def test_homePageTitle(self,setup): self.logger.info("**********Begin testcase: Test for good logging***********") self.driver=setup self.logger.info("Go to Treasury page") self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp=Login(self.driver) self.logger.info("Enter company name:") self.lp.setCompany(self.company) #time.sleep(2) self.logger.info("Enter username:"******"Click Login button:") self.lp.clickLogin() #time.sleep(1) if self.driver.title=="Trace & Treasury": self.logger.info("Goed loging") assert True,"Succesfully Login Tresury" self.driver.quit() else: self.logger.info("Wrong username or companyname") self.driver.quit() assert False,"Wrong CompanyName or UserName"
class Test_005_SearchCustomerByName: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getUserEmail() password = ReadConfig.getPassword() logger = LogGen.loggen() @pytest.mark.regression def test_searchCustomerByName(self, setup): self.logger.info("***** ***** TEST_005 Search Customer By Name ***** *****") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***** Login Successful *****") self.logger.info("***** Starting Search Customer By Name *****") self.adcust = AddCustomer(self.driver) self.adcust.clickOnCustomersMenu() self.adcust.clickOnCustomersMenuItem() searchcust = SearchCustomer(self.driver) searchcust.setFirstName("Victoria") searchcust.setLastName("Terces") searchcust.clickSearch() time.sleep(5) status = searchcust.searchCustomerByName("Victoria Terces") assert status == True self.logger.info("***** ***** TEST_005 Search Customer By Name Finished ***** *****") self.driver.close()
class Test_001_Login: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getUsername() password = ReadConfig.getPassword() def test_loginPageTitle(self, setup): self.driver = setup self.driver.get(self.baseURL) act_title = self.driver.title self.driver.close() if act_title == 'Flippers - Login': assert True else: assert False def test_login(self, setup): self.driver = setup self.driver.get(self.baseURL) self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setUserPassword(self.password) self.lp.clickLogin() act_title = self.driver.title self.driver.close() if act_title == 'Flippers': assert True else: assert False
class Test_002_DDT_Login: baseURL = ReadConfig.getApplicationURL() path = ".//testData/LoginData.xlsx" logger = LogGen.loggen() @pytest.mark.regression def test_login_ddt(self, setup): self.logger.info("**********Test_002_DDT_Login**********") self.logger.info("*****Verifying Login Test*****") self.driver = setup self.driver.get(self.baseURL) self.lp = Login(self.driver) self.rows = XLUtils.getRowCount(self.path, 'Sheet1') print("Number of rows in EXcel:", self.rows) lst_status = [] for row in range(2, self.rows + 1): self.user = XLUtils.readData(self.path, 'Sheet1', row, 1) self.password = XLUtils.readData(self.path, 'Sheet1', row, 2) self.exp = XLUtils.readData(self.path, 'Sheet1', row, 3) self.lp.setUserName(self.user) self.lp.setPassword(self.password) self.lp.clickLogin() time.sleep(5) act_title = self.driver.title exp_title = "Dashboard / nopCommerce administration" if act_title == exp_title: if self.exp == "Pass": self.logger.info("**Passed**") self.lp.clickLogout() lst_status.append("Pass") elif self.exp == "Fail": self.logger.info("**Failed**") self.lp.clickLogout() lst_status.append("fail") elif act_title != exp_title: if self.exp == "Pass": self.driver.save_screenshot(".\\screenshots\\" + "test_login_ddt.png") self.logger.info("**Failed**") lst_status.append("Fail") elif self.exp == "Fail": self.logger.info("**Passed**") lst_status.append("Pass") if "Fail" not in lst_status: self.logger.info("Login DDT test Passed.......") self.driver.close() assert True else: self.logger.error("Login DDT test Failed.......") self.driver.close() assert False self.logger.info("***** End of Login DDT Test *****") self.logger.info("***** ***** Completed TC_LoginDDT_002 ***** *****")
class Test_002_DDT_Login: loginURL = ReadConfig.getLoginURL() path = '.\\tests\\testData\\loginTestData.xlsx' def test_login_ddt(self,setup): self.driver = setup self.lp = Login(self.driver) self.rows = xlReader.rowCount(self.path,'Arkusz1') lst_status=[] for row in range(2, self.rows+1): self.driver.get(self.loginURL) self.user = xlReader.readData(self.path, 'Arkusz1', row, 1) self.password = xlReader.readData(self.path, 'Arkusz1', row, 2) self.exp = xlReader.readData(self.path, 'Arkusz1', row, 3) self.lp.setUserName(self.user) self.lp.setUserPassword(self.password) self.lp.clickLogin() sleep(2) act_title = self.driver.title exp_title = 'Flippers' if act_title==exp_title: if self.exp=='Pass': lst_status.append('Pass') else: lst_status.append('Fail') else: if self.exp=='Pass': lst_status.append('Fail') else: lst_status.append('Pass') try: self.lp.clickLogout() except: pass if 'Fail' not in lst_status: self.driver.close() assert True else: self.driver.close() assert False
class Test_003_AddCustomer: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getUserEmail() password = ReadConfig.getPassword() logger = LogGen.loggen() def random_generator(self, size=8, chars=string.ascii_lowercase + string.digits): return ''.join(random.choice(chars) for x in range(size)) @pytest.mark.sanity def test_addCustomer(self, setup): self.logger.info("***** ***** Test_003_AddCustomer ***** *****") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***** Login Successful *****") self.logger.info("***** Starting Add Customer Test *****") self.adcust = AddCustomer(self.driver) self.adcust.clickOnCustomersMenu() self.adcust.clickOnCustomersMenuItem() self.adcust.clickOnAddNew() self.logger.info("***** Providing Customer Details *****") self.email = self.random_generator() + "@gmail.com" self.adcust.setEmail(self.email) self.adcust.setPassword("test123") self.adcust.setCustomerRoles("Guests") self.adcust.setManagerOfVendor("Vendor 2") self.adcust.setGender("Male") self.adcust.setFirstName("John") self.adcust.setLastName("Doe") self.adcust.setDOB("7/05/1985") self.adcust.setCompanyName("CG") self.adcust.setAdminComment("This is for testing") self.adcust.clickOnSave() self.logger.info("***** Saving Customer Info *****") self.logger.info("***** Saved Customer Validation Started *****") self.msg = self.driver.find_element_by_tag_name("body").text if 'customer has been added successfully.' in self.msg: assert True == True self.logger.info("***** Add Customer Test Passed *****") else: self.driver.save_screenshot(".\\screenshots\\" + "test_addCustomer_scr.png") self.logger.error("***** Add Customer Test Failed *****") assert False == False self.driver.close() self.logger.info("***** Add Customer Test complete *****")
class Test_002_Leningen: baseUrl = configure.getUrl() company = configure.getCompany() username = configure.getUsername() logger = LogGen.loggen() @pytest.mark.regression def test_NoRealtie(self, setup): self.logger.info( "********************Testcase 002: Enter wrong relatie in the lening form****************" ) self.driver = setup self.logger.info("Go to Treasury page") self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.logger.info("Enter company name") self.lp.setCompany(self.company) # time.sleep(2) self.logger.info("Enter username") self.lp.setUsername(self.username) # time.sleep(1) self.logger.info("Click Login button") self.lp.clickLogin() time.sleep(1) self.len = Leningen(self.driver) self.logger.info("Click menu Financiële instrumenten") self.len.clickMenuFinanInstrumenten() time.sleep(3) self.logger.info("Choice Leningen item") self.len.clickMenuitemLeningen() time.sleep(2) self.logger.info("click Nieuws button to add a new leningen") self.len.clickNieuws() time.sleep(2) self.logger.info("Go to popup screen to choice a soort from leningen") self.logger.info("Click item leningen") self.len.clickItemDrop("leningen") time.sleep(2) self.logger.info("Click Ok button") self.len.clickOk() time.sleep(5) self.logger.info("Fulling lening screen") self.logger.info("Choice Leningen item") self.len.clickLeningItem("Leningen") self.logger.info("Generate number from lening") self.len.click_Geneer() self.logger.info("Enter amount") self.len.set_NominaleWaarde(10000) self.logger.info("Click dropdown list Relaties ") self.len.click_RealtieExpand() time.sleep(3) self.logger.info( "Search relatie 10, this number actually doesn't exists in database" ) number = self.len.set_RealatieNumber('10') # time.sleep(4) val = self.len.get_NoRelatie() self.logger.info("Validate fault message") if val == "Er zijn geen resultaten gevonden.": self.logger.info("There are no number in database") assert True self.driver.quit() else: self.logger.info("The number exists") self.driver.quit() assert False @pytest.mark.regression def test_CheckRelatie(self, setup): self.logger.info( "********************Testcase 003: Enter a goed relatie number in the lening form****************" ) self.driver = setup self.logger.info("Go to Treasury page") self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.logger.info("Enter company name") self.lp.setCompany(self.company) # time.sleep(2) self.logger.info("Enter username") self.lp.setUsername(self.username) # time.sleep(1) self.logger.info("Click Login button") self.lp.clickLogin() time.sleep(1) self.len = Leningen(self.driver) self.logger.info("Click menu Financiële instrumenten") self.len.clickMenuFinanInstrumenten() time.sleep(3) self.logger.info("Choice Leningen item") self.len.clickMenuitemLeningen() time.sleep(2) self.logger.info("click Nieuws button to add a new leningen") self.len.clickNieuws() time.sleep(2) self.logger.info("Go to popup screen to choice a soort from leningen") self.logger.info("Click item leningen") self.len.clickItemDrop("leningen") time.sleep(2) self.logger.info("Click Ok button") self.len.clickOk() time.sleep(5) self.logger.info("Fulling lening screen") self.logger.info("Choice Leningen item") self.len.clickLeningItem("Leningen") self.logger.info("Generate number from lening") self.len.click_Geneer() self.logger.info("Enter amount") self.len.set_NominaleWaarde(10000) self.logger.info("Click dropdown list Relaties ") self.len.click_RealtieExpand() time.sleep(3) self.logger.info("Search relatie") number = self.len.set_RealatieNumber('2') time.sleep(4) val = self.len.get_1stCel() self.logger.info( "Validate the information from relation in the first row") if number == val: self.logger.info( "The number exists, and the infomation in the first row") self.len.click_1stCel() assert True self.driver.quit() else: self.logger.info("There are no number in database") self.driver.quit() assert False @pytest.mark.function def test_AllGoodFulling(self, setup): self.logger.info( "********************Testcase 004: If all required velds are entered, validate message****************" ) self.driver = setup self.logger.info("Go to Treasury page") self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.logger.info("Enter company name") self.lp.setCompany(self.company) # time.sleep(2) self.logger.info("Enter username") self.lp.setUsername(self.username) # time.sleep(1) self.logger.info("Click Login button") self.lp.clickLogin() time.sleep(1) self.len = Leningen(self.driver) self.logger.info("Click menu Financiële instrumenten") self.len.clickMenuFinanInstrumenten() time.sleep(3) self.logger.info("Choice Leningen item") self.len.clickMenuitemLeningen() time.sleep(2) self.logger.info("click Nieuws button to add a new leningen") self.len.clickNieuws() time.sleep(2) self.logger.info("Go to popup screen to choice a soort from leningen") self.logger.info("Click item leningen") self.len.clickItemDrop("leningen") time.sleep(2) self.logger.info("Click Ok button") self.len.clickOk() # Fulling self.logger.info("Fulling lening screen") self.logger.info("Choice Leningen item") time.sleep(5) self.len.clickLeningItem("Leningen") self.logger.info("Generate number from lening") self.len.click_Geneer() self.logger.info("Enter amount") self.len.set_NominaleWaarde(10000) self.logger.info("Click dropdown list Relaties ") self.len.click_RealtieExpand() time.sleep(3) self.logger.info("Search relatie 2") number = self.len.set_RealatieNumber('2') time.sleep(4) self.logger.info("The number exists en click on 1st row") self.len.click_1stCel() self.logger.info("Enter start date") self.len.setStartDate('25-8-2020') self.len.clickSluiten() self.logger.info("Enter the Looptijd") self.len.set_Looptijd(10) self.len.click_Opslaan() time.sleep(20) self.logger.info( "Validate Eén of meerdere waarden zijn automatisch ingevuld. Controleer a.u.b. " ) self.logger.info( "deze waarden en indien deze waarden correct zijn klik nogmaals op opslaan." ) bol = self.len.get_WarningAutoIngevuld() if bol: self.logger.info("Good message is available") assert bol, 'Click Opslaan' self.driver.quit() # assert bolean,"Goed test" # if str=="Eén of meerdere waarden zijn automatisch ingevuld. Controleer a.u.b. deze waarden en indien deze waarden correct zijn klik nogmaals op opslaan.": # self.len.click_Opslaan() @pytest.mark.regression def test_WrongDateFormat(self, setup): self.driver = setup self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setCompany(self.company) # time.sleep(2) self.lp.setUsername(self.username) # time.sleep(1) self.lp.clickLogin() time.sleep(3) self.len = Leningen(self.driver) # self.len = Leningen(self.driver) self.len.clickMenuFinanInstrumenten() # time.sleep(3) self.len.clickMenuitemLeningen() # time.sleep(2) self.logger.info("click Nieuws button to add a new leningen") self.len.clickNieuws() self.logger.info("Go to popup screen to choice a soort from leningen") self.logger.info("Click item leningen") self.len.clickItemDrop("leningen") self.logger.info("Click Ok button") time.sleep(2) self.len.clickOk() path = "D:\Python Projects\TreasuryProject\TestData\LenWrongDateFormat.xlsx" workbook = openpyxl.load_workbook(path) sheet1 = workbook.get_sheet_by_name("Blad1") self.logger.info("Fulling lening screen") self.logger.info("Choice Leningen item") self.len.clickLeningItem(sheet1.cell(2, 1).value) self.logger.info("Generate number from lening") if sheet1.cell(2, 2).value == None: self.len.click_Geneer() self.logger.info("Enter amount") self.len.set_NominaleWaarde(sheet1.cell(2, 3).value) self.logger.info("Click dropdown list Relaties ") self.len.click_RealtieExpand() time.sleep(3) self.logger.info("Search relatie") number = self.len.set_RealatieNumber(sheet1.cell(2, 3).value) time.sleep(3) self.logger.info("The number exists en click on 1st row") self.len.click_1stCel() self.logger.info("Enter start date") self.len.setStartDate(sheet1.cell(2, 4).value) self.len.clickSluiten() self.logger.info("Enter the Looptijd") self.len.set_Looptijd(10) self.len.click_Opslaan() time.sleep(20) self.logger.info("Bevestig message") bol = self.len.get_WarningDateForm() if bol: assert bol, 'Niet goed ingangsdatum' self.driver.quit()
class Test_002_Leningen: baseUrl = configure.getUrl() company = configure.getCompany() username = configure.getUsername() def test_NoRealtie(self, setup): self.driver = setup self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setCompany(self.company) # time.sleep(2) self.lp.setUsername(self.username) # time.sleep(1) self.lp.clickLogin() time.sleep(1) self.len = Leningen(self.driver) self.len.clickMenuFinanInstrumenten() time.sleep(3) self.len.clickMenuitemLeningen() time.sleep(2) self.len.clickNieuws() time.sleep(2) self.len.clickItemDrop("leningen") time.sleep(2) self.len.clickOk() time.sleep(5) self.len.clickLeningItem("Leningen") self.len.click_Geneer() self.len.set_NominaleWaarde(10000) self.len.click_RealtieExpand() time.sleep(3) number = self.len.set_RealatieNumber('10') # time.sleep(4) val = self.len.get_NoRelatie() if val == "Er zijn geen resultaten gevonden.": # self.len.click_1stCel() assert True self.driver.quit() else: self.driver.quit() assert False def test_CheckRelatie(self, setup): self.driver = setup self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setCompany(self.company) # time.sleep(2) self.lp.setUsername(self.username) # time.sleep(1) self.lp.clickLogin() time.sleep(1) self.len = Leningen(self.driver) self.len.clickMenuFinanInstrumenten() time.sleep(3) self.len.clickMenuitemLeningen() time.sleep(2) self.len.clickNieuws() time.sleep(2) self.len.clickItemDrop("leningen") time.sleep(2) self.len.clickOk() time.sleep(5) self.len.clickLeningItem("Leningen") self.len.click_Geneer() self.len.set_NominaleWaarde(10000) self.len.click_RealtieExpand() time.sleep(3) number = self.len.set_RealatieNumber('2') time.sleep(4) val = self.len.get_1stCel() if number == val: self.len.click_1stCel() assert True self.driver.quit() else: # print(mes) self.driver.quit() assert False def test_AllGoodFulling(self, setup): self.driver = setup self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setCompany(self.company) # time.sleep(2) self.lp.setUsername(self.username) # time.sleep(1) self.lp.clickLogin() time.sleep(1) self.len = Leningen(self.driver) self.len.clickMenuFinanInstrumenten() time.sleep(3) self.len.clickMenuitemLeningen() time.sleep(2) self.len.clickNieuws() time.sleep(2) self.len.clickItemDrop("leningen") time.sleep(2) self.len.clickOk() # Fulling time.sleep(5) self.len.clickLeningItem("Leningen") self.len.click_Geneer() self.len.set_NominaleWaarde(10000) self.len.click_RealtieExpand() time.sleep(3) number = self.len.set_RealatieNumber('2') time.sleep(4) self.len.click_1stCel() self.len.setStartDate('25-8-2020') self.len.clickSluiten() self.len.set_Looptijd(10) self.len.click_Opslaan() time.sleep(20) bol = self.len.get_WarningAutoIngevuld() if bol: assert bol, 'Click Opslaan' self.driver.quit() # assert bolean,"Goed test" # if str=="Eén of meerdere waarden zijn automatisch ingevuld. Controleer a.u.b. deze waarden en indien deze waarden correct zijn klik nogmaals op opslaan.": # self.len.click_Opslaan() def test_WrongDateFormat(self, setup): self.driver = setup self.driver.get(self.baseUrl) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setCompany(self.company) # time.sleep(2) self.lp.setUsername(self.username) # time.sleep(1) self.lp.clickLogin() time.sleep(3) self.len = Leningen(self.driver) # self.len = Leningen(self.driver) self.len.clickMenuFinanInstrumenten() # time.sleep(3) self.len.clickMenuitemLeningen() # time.sleep(2) self.len.clickNieuws() self.len.clickItemDrop("leningen") time.sleep(2) self.len.clickOk() path = "D:\Python Projects\TreasuryProject\TestData\LenWrongDateFormat.xlsx" workbook = openpyxl.load_workbook(path) sheet1 = workbook.get_sheet_by_name("Blad1") self.len.clickLeningItem(sheet1.cell(2, 1).value) if sheet1.cell(2, 2).value == None: self.len.click_Geneer() self.len.set_NominaleWaarde(sheet1.cell(2, 3).value) self.len.click_RealtieExpand() time.sleep(3) number = self.len.set_RealatieNumber(sheet1.cell(2, 3).value) time.sleep(3) self.len.click_1stCel() self.len.setStartDate(sheet1.cell(2, 4).value) self.len.clickSluiten() self.len.set_Looptijd(10) self.len.click_Opslaan() time.sleep(20) bol = self.len.get_WarningDateForm() if bol: assert bol, 'Niet goed ingangsdatum' self.driver.quit()