class Test_004_searchCust: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getApplicationusername() password = ReadConfig.getApplicationpassword() logger = logGen.loggen() @pytest.mark.sanity #@pytest.mark.regression def test_searchCustomer(self, setup): self.logger.info("*************Test_001_Login***********") self.driver = setup self.driver.get("https://admin-demo.nopcommerce.com/admin/") self.login = LoginPage(self.driver) self.login.set_username(self.username) self.login.set_password(self.password) self.login.clickLogin() time.sleep(8) self.srchcust = SearchCustomerPage(self.driver) self.srchcust.click_CustomersMenu() time.sleep(3) self.srchcust.click_CustomersMenuItem() time.sleep(3) self.srchcust.set_mail("*****@*****.**") self.srchcust.click_search() time.sleep(5) print(self.srchcust.get_no_of_rows()) status = self.srchcust.search_Customer_by_Email( "*****@*****.**") time.sleep(5) assert status == True
class Test_001_Login: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getApplicationusername() password = ReadConfig.getApplicationpassword() logger = logGen.loggen() @pytest.mark.regression @pytest.mark.sanity def test_homePgeTitle(self, setup): self.logger.info("*************Test_001_Login**************") self.logger.info("*************test_homePgeTitle**************") self.driver = setup self.driver.get("https://admin-demo.nopcommerce.com/admin/") act_title = self.driver.title if act_title == "Your store. Login": assert True self.logger.info( "*************test_homePgeTitle Passed**************") self.driver.close() else: self.driver.save_screenshot(".\\Screenshots\\" + "test_homePgeTitle.png") self.driver.close() self.logger.error( "*************test_homePgeTitle Failed**************") assert False def test_Login(self, setup): self.logger.info("*************test_Login**************") self.driver = setup self.driver.get(self.baseURL) self.login = LoginPage(self.driver) self.login.set_username(self.username) self.login.set_password(self.password) self.login.clickLogin() act_title = self.driver.title if act_title == "Dashboard / nopCommerce administration": assert True self.logger.info("*************test_Login Passed**************") self.driver.close() else: assert False self.logger.error("*************test_Login Failed**************") self.driver.close()
class Test_003_add_Customer: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getApplicationusername() password = ReadConfig.getApplicationpassword() def test_add_Customer(self, setup): self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.set_username(self.username) self.lp.set_password(self.password) self.lp.clickLogin() self.addcust = AddCustomerPage(self.driver) self.addcust.click_CustomersMenu() self.addcust.click_CustomersMenuItem() self.addcust.click_AddNewwButton() self.addcust.click_PlusButton() self.email = random_generator() + "@gmail.com" self.addcust.set_EmailId(self.email) act_title = self.driver.title if act_title == "Your store. Login": assert True self.logger.info( "*************test_homePgeTitle Passed**************") self.driver.close() else: self.driver.save_screenshot(".\\Screenshots\\" + "test_homePgeTitle.png") self.driver.close() self.logger.error( "*************test_homePgeTitle Failed**************") assert False