class Test_SearchCustomerByName_005: baseUrl = Readconfig.getApplicationURL() Username = Readconfig.getUserName() password = Readconfig.getPassword() logger = LogGen.loggen() def test_SearchCustomerbyName(self, setup): self.logger.info("************Test_004_Login*******************") 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.Click_Login() self.logger.info("**************Login succesfully*****************") self.Addcust = AddCustomer(self.driver) self.Addcust.clickOnCustomerMenu() self.Addcust.clickOnCustomerMenu_item() self.logger.info( "********searching for customer by Name***************") searchcust = SearchCustomer(self.driver) searchcust.setFirstName("John") searchcust.setLastName("Smith") searchcust.clickSearch() status = searchcust.searchCustomerByName("John Smith") assert True == status self.logger.info( "********Tc_ searchCustomerByName_005 passed***************")
class Test_ExportExcel_006: baseUrl = Readconfig.getApplicationURL() Username = Readconfig.getUserName() password = Readconfig.getPassword() logger = LogGen.loggen() @pytest.mark.sanity def test_ExportExcel(self,setup): self.logger.info("************Test_006_Login*******************") 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.Click_Login() self.logger.info("**************Login succesfully*****************") self.Addcust = AddCustomer(self.driver) self.Addcust.clickOnCustomerMenu() self.Addcust.clickOnCustomerMenu_item() self.logger.info("**************Test_Export the file to excel*****************") self.excelEx=ExportFile(self.driver) self.excelEx.excelPathDownload() self.excelEx.exportExcel()
class Test_SearchCustomerByEmail_004: baseUrl = Readconfig.getApplicationURL() Username = Readconfig.getUserName() password = Readconfig.getPassword() logger = LogGen.loggen() def test_SearchCustomerbyEmail(self,setup): self.logger.info("************Test_004_Login*******************") 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.Click_Login() self.logger.info("**************Login succesfully*****************") self.Addcust = AddCustomer(self.driver) self.Addcust.clickOnCustomerMenu() self.Addcust.clickOnCustomerMenu_item() self.logger.info("********searching for customer by emailId***************") searchcust=SearchCustomer(self.driver) searchcust.setEmail("*****@*****.**") searchcust.clickSearch() #time.sleep(5) status=searchcust.searchCustomerByEmail("*****@*****.**") assert True==status self.logger.info("********Tc_ searchCustomerByemailId_004 passed***************")
class Test_001_Login: baseUrl = Readconfig.getApplicationURL() Username = Readconfig.getUserName() password = Readconfig.getPassword() logger=LogGen.loggen() @pytest.mark.sanity @pytest.mark.regression def test_homePage(self, setup): self.logger.info("************Test_001_Login*************") self.logger.info("************verifiying homepage************") self.driver = setup self.driver.get(self.baseUrl) act_title = self.driver.title print(act_title) self.driver.close() if act_title == "Your store. Login": assert True self.logger.info("************homepage test passed*************") else: self.driver.save_screenshot(".\\Screenshots\\" + "test_homePage1.png") assert False self.driver.close() self.logger.info("************homepage test failed*************") def test_Loginpage(self,setup): #self.driver = webdriver.Chrome(ChromeDriverManager().install()) self.driver = setup self.driver.get(self.baseUrl) self.lp = Login(self.driver) self.lp.setUserName(self.Username) self.lp.setPassword(self.password) self.lp.Click_Login() act_title = self.driver.title self.driver.close() if act_title == "Dashboard / nopCommerce administration": assert True self.logger.info("************test_Loginpage passed*************") else: #self.driver.save_screenshot(".\\Screenshots\\" + "test_Loginpage.png") self.driver.save_screenshot(".\\Screenshots\\" + "test_Loginpage1.png") assert False self.driver.close() self.logger.info("************test_Loginpage failed***************")
class Test_003_Login: baseUrl = Readconfig.getApplicationURL() Username = Readconfig.getUserName() password = Readconfig.getPassword() logger = LogGen.loggen() @pytest.mark.sanity @pytest.mark.regression def test_addCustomer(self, setup): self.logger.info("************Test_003_Login*******************") 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.Click_Login() self.logger.info("**************Login succesfully*****************") self.logger.info( "*******************Starting Add Customer Test***************************" ) self.Addcust = AddCustomer(self.driver) self.Addcust.clickOnCustomerMenu() self.Addcust.clickOnCustomerMenu_item() self.Addcust.click_ADDnew() self.logger.info("********Providing customer info***************") self.email = random_generator() + "@gmail.com" self.Addcust.set_email(self.email) self.Addcust.set_Password(self.password) #self.Addcust.setcustomerRoles("Guests") self.Addcust.setManagerofVendor_xpath("Vendor 2") self.Addcust.setGender("Female") self.Addcust.setFirstName("Lavanya") self.Addcust.setlastName("P") self.Addcust.setDOB("10/08/1995") #Format :DD/MM/YYYY self.Addcust.setCompanyName("Capgemini") self.Addcust.SetAdminContent("This is for testing data...............") 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_addCustoer_scr.png") self.logger.info( "*************Add customer failed*******************") assert False == False time.sleep(5) self.driver.quit() self.logger.info( "***********End of Homepage title test****************")