def test_addNewCustomer(self, setup): self.logger.info("**************test_login**************") self.logger.info("**************Verify test_login Page**************") self.driver = setup self.driver.get(self.URL) self.lp = loginPage(self.driver) self.lp.Usrname(self.username) self.lp.Password(self.password) self.lp.Login() loginTitle = self.driver.title # if loginTitle =="Dashboard / nopCommerce administration": if "Dashboard" in loginTitle: assert True # self.driver.save_screenshot(".\\screenshots\\titleLogin1.png") # self.driver.close() else: # self.driver.save_screenshot(".\\screenshots\\titleLogin1.png") # self.driver.close() assert False self.logger.info( "**************Test_fullAutomation_001_login**************") self.logger.info( "**************Verify test_addNewCustomer Page**************") self.fa = fullAutomation(self.driver) self.fa.getCustomerlink() self.fa.getCustomermenulink() self.fa.getAddNew() self.fa.EmailID = self.fa.getEmail("*****@*****.**") self.fa.getPassword("test112_1234") self.fa.getFirstName("fname1") self.fa.getLastName("lname1") self.fa.getGender("Male") self.fa.getDOB("05/20/21") self.fa.getNewsletter() time.sleep(2) self.fa.getNewsletterStore2() self.fa.getCustomerRoles() time.sleep(1) self.fa.getUnselectRoleRegistered() # self.fa.getRoleAdministrator() # self.fa.getUnselectRoleRegistered() self.fa.saveAddBtn() self.logger.info( "**************Test_searchAutomation_001_login**************") self.logger.info( "**************Verify searchAutomationuser details page**************" ) self.sa = searchAutomation(self.driver) self.sa.getCustomerlink self.sa.getCustomermenulink() self.sa.getEmail("*****@*****.**") self.sa.clickSearchBtn() self.sa.getSearchEmail("*****@*****.**") self.logger.info( "**************Verify searchAutomationuser completed page**************" )
def test_loginpage(self, get_data): # Test Case for login function logIn = loginPage(self.driver) try: logIn.get_loginButton().click() logIn.get_username().send_keys(get_data["username"]) logIn.get_password().send_keys(get_data["password"]) logIn.get_submit().click() except Exception as e: print(e) finally: now = datetime.now() current_time = now.strftime("%H-%M-%S") self.driver.save_screenshot('..\\screenshots\\loginTest' + current_time + '.png')
def test_loginCheck(self, setup): self.logger.info("**************test_loginCheck_testCase**************") self.logger.info("**************Verify Login Page**************") self.driver =setup self.driver.get(self.URL) self.lp = loginPage(self.driver) self.lp.Usrname(self.username) self.lp.Password(self.password) self.lp.Login() loginTitle = self.driver.title #if loginTitle =="Dashboard / nopCommerce administration": if "Dashboard" in loginTitle: assert True self.driver.save_screenshot(".\\screenshots\\titleLogin1.png") self.driver.close() else: self.driver.save_screenshot(".\\screenshots\\titleLogin1.png") self.driver.close() assert False
def test_loginCheck_ddt(self, setup): self.logger.info("**************test_002DDT_testCase**************") self.logger.info("**************Verify Login Page**************") self.driver = setup self.driver.get(self.URL) self.lp = loginPage(self.driver) self.rows = XLUtilities.getRowCount(self.path, "Sheet1") print(self.rows) self.cols = XLUtilities.getColCount(self.path, "Sheet1") print(self.cols) lst_sts = [] for i in range(2, self.rows + 1): self.User = XLUtilities.readXL(self.path, 'Sheet1', i, 1) self.Pass = XLUtilities.readXL(self.path, 'Sheet1', i, 2) self.exp = XLUtilities.readXL(self.path, 'Sheet1', i, 3) self.lp.Usrname(self.User) self.lp.Password(self.Pass) self.lp.Login() time.sleep(5) act_Title = self.driver.title exp_Title = "Dashboard / nopCommerce administration" if act_Title == "Dashboard / nopCommerce administration": output = 'Pass' XLUtilities.writeXL(self.path, 'Sheet1', i, 4, output) time.sleep(5) self.lp.Logout() else: output = 'Fail' XLUtilities.writeXL(self.path, 'Sheet1', i, 4, output)