def test_searchCustomerByEmailID(self, setup): logger.info( "*****************Test_004_SearchCustomerByEmail **************") self.driver = setup self.driver.get(self.baseurl) self.driver.maximize.window() lp = LoginPage(self.driver) lp.setUserName(self.username) lp.setPassword(self.password) lp.clickLogin() logger.info( "**************************LOgin Successfull ******************") logger.info( "**********************Starting Search by Email test *******************" ) add = AddCustomer(self.driver) add.clickonCustomerMenu() add.clickOnCustomersSubMenu() logger.info( "**********************Searching customer by email id ********************" ) search = SearchCustomer(self.driver) search.enterEmail("*****@*****.**") search.clickSearch() time.sleep(4) status = search.searchCustomerByEmail( "*****@*****.**") assert True == status logger.info( "******************** TC_004_Search customer by email id Finished***************" ) self.driver.close()
class Test_005_SearchCustomerByName: baseURL = readConfig.getApplicationURL() username = readConfig.getUsername() password = readConfig.getPassword() logger = LogGen.loggen() @pytest.mark.regression def test_SearchCustomerByName(self, setup): self.logger.info("***********Search customer by email*************") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***********login succesful*************") self.logger.info( "***********Starting Search Customer by name test ************") self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() searchcust = SearchCustomer(self.driver) searchcust.setFirstName("Victoria") searchcust.setLastName("Terces") searchcust.clickOnSearch() status = searchcust.SearchCustomerByName("Victoria Terces") assert True == status self.driver.quit()
def test_searchCustomerByEmailID(self,setup): logger.info("*****************Test_005_SearchCustomerByName **************") self.driver = setup self.driver.get(self.baseurl) self.driver.maximize_window() lp = LoginPage(self.driver) lp.setUserName(self.username) lp.setPassword(self.password) lp.clickLogin() logger.info("**************************LOgin Successfull ******************") logger.info("**********************Starting Search by name test *******************") add = AddCustomer(self.driver) time.sleep(2) add.clickonCustomerMenu() time.sleep(2) add.clickOnCustomersSubMenu() logger.info("**********************Searching customer by name ********************") search = SearchCustomer(self.driver) search.enterFirstName("Victoria") search.enterLastName("Terces") search.clickSearch() time.sleep(4) status = search.searchCustomerByName("Victoria Terces") assert True == status logger.info("******************** TC_005_Search customer by name Finished***************") self.driver.close()
class Test_no_login_ddt(): baseURL = ReadConfig.getApplicationURL() path = ".//TestData/LoginData.xlsx" logger = LogGen.loggen() def test_login_ddt(self, setup): self.logger.info("*********test no. 1***********") self.logger.info("*********verifying Login DDT test***********") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.rows = ExcelUtils.getRowCount(self.path, 'sheet1') print("Number of Row: ", self.rows) lst_status = [] #empty list vars for row in range(2, self.rows + 1): self.username = ExcelUtils.readData(self.path, 'sheet1', row, 1) self.password = ExcelUtils.readData(self.path, 'sheet1', row, 2) self.exp = ExcelUtils.readData(self.path, 'sheet1', row, 3) self.lp.setUserName(self.username) 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.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 has passed***") self.driver.close() assert True else: self.logger.info("***Login DDT test has failed***") self.driver.close() assert False self.logger.info(lst_status) self.logger.info("end of test")
class Test_002_DDT_Login: baseURl = ReadConfig.getAppUrl() path = ".//testData/login_data_DDT.xlsx" logger = LogGen.logGen() def test_DDT_login(self): self.driver = webdriver.Chrome( executable_path=".\\venv\\chromedriver_win32\\chromedriver") self.driver.get(self.baseURl) self.driver.implicitly_wait(5) self.lp = LoginPage(self.driver) self.rows = XLUtils.getRowCount(self.path, 'Sheet1') list_status = [] for r in range(2, self.rows + 1): self.userName = XLUtils.readData(self.path, 'Sheet1', r, 1) self.password = XLUtils.readData(self.path, 'Sheet1', r, 2) self.exp = XLUtils.readData(self.path, 'Sheet1', r, 3) self.lp.setUserName(self.userName) 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() list_status.append('pass') elif self.exp == 'fail': self.logger.info("***********Failed**********") self.lp.clickLogout() list_status.append('fail') elif act_title != exp_title: if self.exp == 'fail': self.logger.info("********Passed********") list_status.append('pass') elif self.exp == 'pass': self.logger.info("***********Failed**********") list_status.append('fail') if 'fail' not in list_status: self.logger.info("Login_DDT_test Passed") self.driver.close() assert True else: self.logger.error("Login_DDT_Test is failed") self.driver.close() assert False self.logger.info("**********End of TC_002_DDT_login**********")
def test_login(self): lp = LoginPage(self.driver) lp.setUserName(self.username) lp.setPassword(self.password) lp.clickLogin() time.sleep(5) self.assertEqual("Dashboard / nopCommerce administration", self.driver.title, "webpage titile is not match")
def test_addCustomer(self, setup): logger.info("************Test_003_AddCustomer************") self.driver = setup self.driver.get(self.baseurl) self.driver.maximize_window() lp = LoginPage(self.driver) lp.setUserName(self.username) lp.setPassword(self.password) lp.clickLogin() logger.info("**************** LOgin SuccessFull **************") logger.info( "******************** Started Add customer test *************") add = AddCustomer(self.driver) time.sleep(2) add.clickonCustomerMenu() time.sleep(2) add.clickOnCustomersSubMenu() add.clickAddNew() logger.info( "***************** Started adding Customer Info***************") email = random_generator() + '@gamail.com' add.enterEmail(email) add.enerPassword("test1234") add.setCustomerRole('Guests') add.setManagerofVendor('Vendor 2') add.setGender('Male') add.setFirstName('Rambabu') add.setLastName('Vuyyuri') add.setDOB('7/08/1996') add.setCompanyName('TechM') add.setAdmincontent('This is practice testing') add.clickSaveButton() logger.info("********************Saving Customer Info***************") logger.info( "***********************Add customer Validation Started************" ) msg = self.driver.find_element_by_tag_name('body').text #print(msg) if 'customer has been added successfully.' in msg: assert True == True logger.info( "***************Add Customer test passed ***************") else: self.driver.save_screenshot(".\\Screenshots\\addCustomer.png") logger.error( "***************Add customer test failed**************") assert True == False self.driver.close() logger.info("***************Ending Home page title text*************")
class Test_no_1_Login(): baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getApplicationUsername() password = ReadConfig.getApplicationPassword() logger = LogGen.loggen() #testing the home page def test_homePageTitle(self, setup): self.logger.info("*************test login no. 1**************") self.logger.info( "*************verifying Home Page Title**************") self.driver = setup self.driver.get(self.baseURL) #actional title comparing act_title = self.driver.title if act_title == "Your store. Login": time.sleep(2) self.driver.close() self.logger.info("*************The Test has passed**************") assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "test_homePageTitle.png") self.driver.close() self.logger.error("*************The Test has failed**************") assert False @pytest.mark.functionality #testing login with valid username and password def test_login(self, setup): self.logger.info("*********test no. 2***********") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() #actional title comparing act_title = self.driver.title if act_title == "Dashboard / nopCommerce administration": #n self.driver.close() self.logger.info("**************test has passed**************") assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "test_homePageTitle.png") self.driver.close() self.logger.error( "****************test has failed****************") assert False
class Test_003_AddCustomer: baseURL = readConfig.getApplicationURL() username = readConfig.getUsername() password = readConfig.getPassword() logger = LogGen.loggen() @pytest.mark.sanity def test_AddCustomer(self, setup): self.logger.info("***********Test_001_Login*************") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***********login succesful*************") self.logger.info("***********Starting Add Customer test ************") self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.addcust.clickOnAddnew() self.logger.info("***********Providing Customer Info ************") self.email = random_generator() + "@gmail.com" self.addcust.setEmail(self.email) self.addcust.setPassword("test123") self.addcust.setFirstName("Pooja") self.addcust.setLastName("Gupta") self.addcust.setGender("Female") self.addcust.setDob("09/16/1997") self.addcust.setCompanyName("BusyQA") self.addcust.setAdminContent("This s for testing") self.addcust.setMgrOfVendor("Not a vendor") self.addcust.setCustomerRole("Registered") self.addcust.clickOnSave() self.logger.info("***********Saving Customer Info ************") self.logger.info( "***********Add Customer validation started************") self.msg = self.driver.find_element_by_tag_name("body").text print(self.msg) 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.info("******Add customer Test failed*************") assert True == False self.driver.close() self.logger.info("**********Ending Add Customer Test*********")
class Test_001_Login: baseURL = readConfig.getApplicationURL() username = readConfig.getUsername() password = readConfig.getPassword() logger = LogGen.loggen() @pytest.mark.regression def test_homepageTitle(self, setup): self.logger.info("***********Test_001_Login*************") self.logger.info("***********Verify homepageTitle*************") self.driver = setup self.driver.get(self.baseURL) act_title = self.driver.title if act_title == "Your store. Login": assert True self.driver.close() self.logger.info( "***********home page title is passed*************") else: self.driver.save_screenshot(".\\Screenshots\\" + "test_homepageTitle.png") self.driver.close() self.logger.error( "***********home page title is failed*************") assert False @pytest.mark.sanity @pytest.mark.regression def test_login(self, setup): self.logger.info("**********verify login test*************") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() act_title = self.driver.title if act_title == "Dashboard / nopCommerce administration": assert True self.logger.info( "***********home page title is passed*************") self.driver.close() else: self.driver.save_screenshot(".\\Screenshots\\" + "test_login.png") self.driver.close() self.logger.error( "***********home page title is failed*************") assert False
def testLogin(self, setUp): self.driver = setUp self.driver.get(ReadConfig.getLoginPageURL()) loginp = LoginPage(self.driver) loginp.setUserName(self.email) loginp.setPassword(self.password) loginp.clickLogin() time.sleep(5) currentUrl = self.driver.current_url if currentUrl == ReadConfig.getHomePageURL(): self.driver.close() assert True else: allure.attach(self.driver.get_screenshot_as_png(), name="Failed Login After Registration", attachment_type=AttachmentType.PNG) self.driver.close() assert False
def test_login(self,setup): logger.info("************************* Verifying Login Test ******************") self.driver = setup self.driver.get(self.baseurl) lp=LoginPage(self.driver) lp.setUserName(self.username) lp.setPassword(self.password) lp.clickLogin() actual_title = self.driver.title lp.clickLogout() if actual_title == "Dashboard / nopCommerce administration": assert True self.driver.close() logger.info("********************** Login Home page passed ***************") else: self.driver.save_screenshot(".\\Screenshots\\test_login.png") self.driver.close() assert False logger.info("*************************** LOgin test failed and captured SS: ****************")
class Test_001_Login: baseURl = ReadConfig.getAppUrl() userName = ReadConfig.getUsername() password = ReadConfig.getPassword() logger = LogGen.logGen() def test_HomePageTitle(self): self.logger.info("****Test_001_Login****") self.driver = webdriver.Chrome( executable_path=".\\venv\\chromedriver_win32\\chromedriver") self.driver.get(self.baseURl) act_title = self.driver.title if act_title == "Your store. Login": assert True self.driver.close() self.logger.info("*****Test is passed******") else: self.driver.save_screenshot(".\screenshots\page.png") self.driver.close() self.logger.error("*****Test is Failed******") assert False def test_login(self): self.driver = webdriver.Chrome( executable_path="C:\Drivers\chromedriver_win32\chromedriver") self.driver.get(self.baseURl) self.lp = LoginPage(self.driver) self.lp.setUserName(self.userName) self.lp.setPassword(self.password) self.lp.clickLogin() actual_title = self.driver.title if actual_title == "Dashboard / nopCommerce administration": self.driver.close() self.logger.info("*****Test is passed******") assert True else: self.driver.save_screenshot(".\screenshots\loginPage.png") self.driver.close() self.logger.error("*****Test is Failed******") assert False
class Test_SearchCustomerByEmail_004: baseURl = ReadConfig.getAppUrl() userName = ReadConfig.getUsername() password = ReadConfig.getPassword() logger = LogGen.logGen() def test_searchCustomerByEmail(self): self.logger.info("************* SearchCustomerByEmail_004 **********") self.driver = webdriver.Chrome( executable_path=".\\venv\\chromedriver_win32\\chromedriver") self.driver.get(self.baseURl) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.setUserName(self.userName) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("************* Login succesful **********") self.logger.info( "******* Starting Search Customer By Email **********") self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.logger.info( "************* searching customer by emailID **********") searchcust = SearchCustomer(self.driver) searchcust.setEmail("*****@*****.**") searchcust.clickSearch() time.sleep(5) status = searchcust.searchCustomerByEmail( "*****@*****.**") self.driver.close() assert True == status self.logger.info( "*************** TC_SearchCustomerByEmail_004 Finished *********** " )
class Test_003_AddCustomer: baseURL = readConfig.getApplicationURL() username = readConfig.getUsername() password = readConfig.getPassword() logger = LogGen.loggen() def test_AddCustomer(self, setup): self.logger.info("***********Test_001_Login*************") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***********login succesful*************") self.logger.info("***********Starting Add Customer test ************") self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.addcust.clickOnAddnew() self.logger.info("***********Providing Customer Info ************")
class Test_002_DDT_Login: baseURL = readConfig.getApplicationURL() path = ".//Testdata/xltestdata.xlsx" logger = LogGen.loggen() @pytest.mark.regression def test_login_ddt(self, setup): self.logger.info("****Test_002_DDT_Login") self.logger.info("**********verify login_ddt test*************") self.driver = setup self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.rows = ExcelUtils.getRowCount(self.path, 'Sheet1') print("no.of rows in excel", self.rows) lst_status = [] #empty list variable for r in range(2, self.rows + 1): self.user = ExcelUtils.readdata(self.path, 'Sheet1', r, 1) self.password = ExcelUtils.readdata(self.path, 'Sheet1', r, 2) self.exp = ExcelUtils.readdata(self.path, 'Sheet1', r, 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.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.info("**********login ddt test failed****") self.driver.close() assert False self.logger.info("end of login ddt test") self.logger.info("completed test_002_login_ddt")
class Test_002_login_ddt(): global logger baseurl = ReadConfig.getApplicationUrl() path = ".//TestData/LoginData.xlsx" logger = getCustomerLogger(logging.INFO) @pytest.mark.regression def test_login_ddt(self, setup): logger.info( "***********************Test_02_login_DDT***************************" ) logger.info( "*********************** Verifying login test ddt ******************" ) self.driver = setup self.driver.get(self.baseurl) self.lp = LoginPage(self.driver) self.rows = XLUtils.getRowCount(file=self.path, sheetname='Sheet1') print("the number of row count is :", self.rows) lst_status = [] for i in range(2, self.rows + 1): print("iterating rown number ", i) user = XLUtils.readData(self.path, 'Sheet1', i, 1) print("username:"******"password:"******"exp:", exp) self.lp.setUserName(user) self.lp.setPassword(password) self.lp.clickLogin() time.sleep(5) actual_text = self.driver.title exp_title = "Dashboard / nopCommerce administration" if actual_text == exp_title: if exp == 'Pass': logger.info("*******Passed*********") self.lp.clickLogout() lst_status.append('Pass') elif exp == 'Fail': logger.info("********** Failed ********") self.lp.clickLogout() lst_status.append('Fail') elif actual_text != exp_title: if exp == 'Pass': logger.info("************ failed***********") lst_status.append('Fail') elif exp == 'Fail': logger.info("**************** Passed **********") lst_status.append('Pass') print("LIst value after appended", lst_status) if 'Fail' not in lst_status: logger.info( "****************Login DDT test Passed*****************") self.driver.close() assert True else: logger.info("**************** Failed *************") self.driver.close() assert False logger.info( "***************** End of the DDT test case****************") logger.info( "********************** End of the Test_002_login_DDt test ****************" )
class Test_003_AddCustomer: baseURl = ReadConfig.getAppUrl() userName = ReadConfig.getUsername() password = ReadConfig.getPassword() logger = LogGen.logGen() def test_addCustomer(self): self.logger.info("************* Test_003_AddCustomer **********") self.driver = webdriver.Chrome( executable_path=".\\venv\\chromedriver_win32\\chromedriver") self.driver.get(self.baseURl) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.setUserName(self.userName) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("************* Login succesful **********") self.logger.info("******* Starting Add Customer Test **********") self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.addcust.clickOnAddnew() self.logger.info("************* Providing customer info **********") self.email = random_generator() + "@gmail.com" self.addcust.setEmail(self.email) self.addcust.setPassword("test123") self.addcust.setCustomerRoles("Guests") self.addcust.setManagerOfVendor("Vendor 2") self.addcust.setGender("Male") self.addcust.setFirstName("Pavan") self.addcust.setLastName("Kumar") self.addcust.setDob("7/05/1985") # Format: D / MM / YYY self.addcust.setCompanyName("busyQA") self.addcust.setAdminContent("This is for testing.........") self.addcust.clickOnSave() self.logger.info("************* Saving customer info **********") self.logger.info( "********* Add customer validation started *****************") self.msg = self.driver.find_element_by_tag_name("body").text # print(self.msg) if 'The new customer has been added successfully.' in self.msg: assert True self.logger.info("********* Add customer Test Passed *********") else: self.driver.save_screenshot( ".\\Screenshots\\" + "test_addCustomer_scr.png") # Screenshot self.logger.error( "********* Add customer Test Failed ************") assert False self.driver.close() self.logger.info("******* Ending Add customer test **********")