class Test_searchCustBY_email: baseURL = Readconfig.getAppURL() username = Readconfig.getUseName() password = Readconfig.getPassWord() logger_object = LoG.log_gen() @pytest.mark.Regression def test_searchCustby_Email(self, setup): self.logger_object.info("***search customer by_email") self.driver = setup self.driver.get(self.baseURL) self.logger_object.info("******Login the application****") self.LP = Loginpage(self.driver) self.LP.setUserName(self.username) self.LP.setPassword(self.password) self.LP.clickLogin() time.sleep(3) self.addCust = addCustomer(self.driver) self.addCust.clickOnCustomerMenu() self.addCust.clickOnCustomerSubMenu() self.SEmail = search_customer(self.driver) self.SEmail.setEmail("*****@*****.**") self.SEmail.clickSearch() time.sleep(10) status = self.SEmail.searchCustbyEmail( "*****@*****.**") time.sleep(5) self.driver.implicitly_wait(5) assert True == status self.logger_object.info("****search customer test caseis passed***") self.driver.close()
class Test_searchCustBY_Fname: baseURL = Readconfig.getAppURL() username = Readconfig.getUseName() password = Readconfig.getPassWord() logger_object = LoG.log_gen() def test_searchCustby_Fname(self,setup): self.logger_object.info("***search customer by_first Name") self.driver =setup self.driver.get(self.baseURL) self.logger_object.info("******Login the application****") self.LP =Loginpage(self.driver) self.LP.setUserName(self.username) self.LP.setPassword(self.password) self.LP.clickLogin() time.sleep(3) self.addCust =addCustomer(self.driver) self.addCust.clickOnCustomerMenu() self.addCust.clickOnCustomerSubMenu() self.SFN=search_customer(self.driver) self.SFN.setFname("James") self.SFN.setLName("Pan") self.SFN.clickSearch() time.sleep(10) status = self.SFN.searchCustbyname("James Pan") time.sleep(5) assert True ==status self.logger_object.info("****search customer by fname test caseis passed***")
class Test_003_addCustomer: baseURL = Readconfig.getAppURL() username = Readconfig.getUseName() password = Readconfig.getPassWord() logger_object = LoG.log_gen() @pytest.mark.sanity @pytest.mark.Regression def test_addCustomer(self, setup): 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() actual_title = self.driver.title expected_title = "Dashboard / nopCommerce administration" if actual_title == expected_title: assert True self.logger_object.info("****Loggin test is passed*****") else: self.driver.get_screenshot_as_file( filename="/Screenshots\\test_003_addCustomer.png") self.driver.close() self.logger_object.info("****Loggin test is failed*****") assert False self.logger_object.info("****start AddCustomer Test*****") self.addCust = addCustomer(self.driver) self.addCust.clickOnCustomerMenu() self.addCust.clickOnCustomerSubMenu() self.addCust.clickOnAddNew() self.logger_object.info("***Provide Customer information****") self.email = random_generator() + "@gmail.com" self.addCust.setEmail(self.email) self.addCust.setpassword("test123") self.addCust.setFirstName("sairam") self.addCust.setLastName("Hari") time.sleep(6) self.addCust.setGender("Male") time.sleep(6) self.addCust.setDOB("01/01/1870") self.addCust.setCompanyName("shiridiIndia") time.sleep(15) # self.addCust.setNewsletter("HELLO") #self.addCust.setCustomerroles("") self.addCust.setCustomerroles("Guests") self.addCust.setCustomerroles("Forum Moderators") time.sleep(15) self.addCust.setManagerOfVendor("Vendor 1") time.sleep(10) self.addCust.setAdminComment("This is for Testing purpose1") self.addCust.click_save() self.logger_object.info("****saving customer informatiion****") self.logger_object.info("***starting add customer validation***") self.msg = self.driver.find_element_by_tag_name("body").text print(self.msg)
class Test_001_login: baseURL= Readconfig.getAppURL() username = Readconfig.getUseName() password =Readconfig.getPassWord() logger_object =LoG.log_gen() def test_homepageTitle(self, setup): self.logger_object.info("****Test_001_Login*****") self.logger_object.info("****verify_homePage*****") self.driver = setup self.driver.get(self.baseURL) actual_title = self.driver.title expected_title = "Your store. Login" if actual_title == expected_title: assert True self.driver.close() self.logger_object.info("****Home Page title test is passed*****") else: self.driver.close() self.logger_object.info("****Home Page title test is failed*****") assert False @pytest.mark.sanity def test_login(self, setup): self.logger_object.info("****Verify Login Page *****") 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() actual_title = self.driver.title expected_title = "Dashboard / nopCommerce administration" if actual_title == expected_title: assert True self.logger_object.info("****Loggin test is passed*****") else: self.driver.get_screenshot_as_file(filename ="/Screenshots\\test_login_001.png") self.driver.close() self.logger_object.info("****Loggin test is failed*****") assert False self.logger_object.info("****Test complete*****") self.logger_object.info("****Thanks*****") self.LP.clicklogout()