class Test_005_searchCustomerByName: baseurl = ReadConfig.getApplicationUrl() username = ReadConfig.getUseremail() password = ReadConfig.getPassword() logger = LogGen.logGeneration() # Logger @pytest.mark.regression def test_searchCustomerByName(self, setup): self.logger.info('******* Test_005_searchcustomerByName ******') self.driver = setup self.driver.get(self.baseurl) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setUserPassword(self.password) self.lp.clickLogin() self.logger.info('*********** login sucessfull *********') self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.logger.info('******** searching by Name *********') searchName = SearchCustomer(self.driver) searchName.setFirstName('Victoria') searchName.setLastName('Terces') searchName.clickSearch() time.sleep(3) status = searchName.searchCustomerByName('Victoria Terces') assert True == status self.logger.info( '********* test_005_searchCustomerByNameis fnished *********') self.driver.close()
class Test_004_SearchCustomerByEmail: baseurl = ReadConfig.getApplicationUrl() username = ReadConfig.getUseremail() password = ReadConfig.getPassword() logger = LogGen.logGeneration() # Logger @pytest.mark.regression def test_searchCustomerByEmail(self, setup): self.logger.info('******** test_004-searchCustomer ********') self.driver = setup self.driver.get(self.baseurl) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setUserPassword(self.password) self.lp.clickLogin() self.logger.info('******* login sucesssfulll **********') 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(3) status = searchcust.searchCustomerByEmail( '*****@*****.**') assert True == status self.logger.info('****** test searchcustomer is finished **********') self.driver.close()
class Test_003_AddCustomer: baseurl = ReadConfig.getApplicationUrl() username = ReadConfig.getUseremail() password = ReadConfig.getPassword() logger = LogGen.logGeneration() #Logger @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 = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setUserPassword(self.password) self.lp.clickLogin() self.logger.info('*********** Login succesfull *********') self.addcust=AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.addcust.clickOnAddnew() self.logger.info('********* provinding customer details *********') self.email = random_generator() + '@gmail.com' self.addcust.setEmail(self.email) self.addcust.setPassword('test123') self.addcust.setNewsletter('Test store 2') self.addcust.setCustomerRoles('Guests') self.addcust.setManagerOfVendor('Vendor 2') self.addcust.setGender('Male') self.addcust.setFirstName('Siva') self.addcust.setLastName('Ram') self.addcust.setDob('7/05/1992') 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 == 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 True == False self.driver.close() self.logger.info('****** Ending AddCustomer_test ***********')
class Test_001_Login: baseurl = rc.getApplicationUrl() username = rc.getUseremail() password = rc.getPassword() logger = LogGen.logGeneration() @pytest.mark.regression def test_homePageTitle(self, setup): self.logger.info('********** Test_001_Login **********') self.logger.info('********** Verifying homepage Title **********') 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( '*********** homepage title test is passed *******') else: self.driver.save_screenshot( '.\\Screenshots\\' + 'test_homePageTitle.png') #(.\\-------\\) is current directory self.driver.close() self.logger.error( '********* homepage title test is failed *************') assert False @pytest.mark.sanity @pytest.mark.regression def test_login(self, setup): self.logger.info('********* Test_001_Login *******') self.logger.info('********* Verifying Login Test *******') self.driver = setup self.driver.get(self.baseurl) self.lp = LoginPage(self.driver) self.lp.setUserName(self.username) self.lp.setUserPassword(self.password) self.lp.clickLogin() act_title = self.driver.title if act_title == 'Dashboard / nopCommerce administration': assert True self.driver.close() self.logger.info('********* Login test is passed *********') else: self.driver.save_screenshot('.\\Screenshots\\' + 'test_login.png') self.driver.close() self.logger.error('********* Login test is failed ********') assert False
class Test_002_DDT_Login: baseurl = rc.getApplicationUrl() path = './/TestData/DataDrive.xlsx' logger = LogGen.logGeneration() @pytest.mark.regression def test_login(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 = LoginPage(self.driver) self.rows = XLUtils.getRowCount(self.path, 'Sheet1') print('number of Rows:', self.rows) status_list = [] for r in range(2, self.rows + 1): self.user = 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.user) self.lp.setUserPassword(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 == 'test passed': self.logger.info('********* passed ********') self.lp.clickLogout() status_list.append('pass') elif self.exp == 'test fail': self.logger.info('******* failed ********') self.lp.clickLogout() status_list.append('fail') elif act_title != exp_title: if self.exp == 'test passed': self.logger.info('******* failed ********') status_list.append('fail') elif self.exp == 'test fail': self.logger.info('****** pass ******') status_list.append('pass') if 'fail' not in status_list: self.logger.info('############## login DDT test pass ############') self.driver.close() assert True else: self.logger.info('############ login DDT test fail ############') self.driver.close() assert False self.logger.info('------------- end of login DDT test ----------') self.logger.info('------------- Complete login DDT test ----------')