def test_02f_normal_login_success(self): driver=Visit_Login_Page(self) with allure.step('Input Username and Pass'): inputLogin=driver.find_element_by_name("inputLogin") inputLogin.send_keys('*****@*****.**') inputPass=driver.find_element_by_name("inputPass") inputPass.send_keys('123456') driver.save_screenshot(normaluser_images+"/test_02f_normal_login_fill.png") normalLoginButton=driver.find_element_by_name("normalLoginButton") normalLoginButton.click() time.sleep(2) self.assertTrue(driver.find_elements_by_name("accountDetail")) driver.save_screenshot(normaluser_images+"/test_02f_normal_login_success.png")
def test_02a_normal_login_without_user_and_pass(self): driver = Visit_Login_Page(self) with allure.step('Click Button Đăng nhập'): driver.find_element_by_name("normalLoginButton").click() time.sleep(0.5) bodyText = driver.find_element_by_tag_name('body').text self.assertTrue("Vui lòng nhập email vào ô văn bản" in bodyText) self.assertTrue("Vui lòng nhập mật khẩu!" in bodyText) driver.save_screenshot( normaluser_images+"/test_02a_normal_login_without_user_and_pass.png")
def test_02e_normal_login_failed(self): driver=Visit_Login_Page(self) with allure.step('Input Username and Pass'): inputLogin=driver.find_element_by_name("inputLogin") inputLogin.send_keys('*****@*****.**') inputPass=driver.find_element_by_name("inputPass") inputPass.send_keys('123') with allure.step('Click Button Đăng Nhập'): normalLoginButton=driver.find_element_by_name("normalLoginButton") normalLoginButton.click() time.sleep(0.5) self.assertFalse(len(driver.find_elements_by_name("accountDetail")) != 0 ) driver.save_screenshot(normaluser_images+"/test_02e_normal_login_failed.png")
def test_02d_normal_login_without_pass_and_right_format_email(self): driver=Visit_Login_Page(self) with allure.step('Input Username'): inputLogin=driver.find_element_by_name("inputLogin") inputLogin.send_keys('*****@*****.**') with allure.step('Click Button Đăng Nhập'): normalLoginButton=driver.find_element_by_name("normalLoginButton") normalLoginButton.click() time.sleep(0.5) bodyText = self.driver.find_element_by_tag_name('body').text self.assertFalse("Văn bản không đúng định dạng email" in bodyText) self.assertTrue("Vui lòng nhập mật khẩu!" in bodyText) driver.save_screenshot(normaluser_images+"/test_02d_normal_login_without_pass_and_right_format_email.png")
def test_02b_normal_login_without_user(self): driver=Visit_Login_Page(self) with allure.step('Input Pass'): inputPass=driver.find_element_by_name("inputPass") inputPass.send_keys('123') with allure.step('Click Button Đăng nhập'): normalLoginButton=driver.find_element_by_name("normalLoginButton") normalLoginButton.click() time.sleep(0.5) bodyText = self.driver.find_element_by_tag_name('body').text self.assertTrue("Vui lòng nhập email vào ô văn bản" in bodyText) self.assertFalse("Vui lòng nhập mật khẩu!" in bodyText) driver.save_screenshot(normaluser_images+"/test_02b_normal_login_without_user.png")
def test_02g_google_login_success(self): driver=Visit_Login_Page(self) with allure.step('Login With Google Account'): GGButton = driver.find_element_by_name("googleLoginButton") time.sleep(1) GGButton.click() time.sleep(2) driver.switch_to.window(driver.window_handles[1]) driver.find_element_by_id('identifierId').send_keys( '*****@*****.**') driver.find_element_by_id('identifierNext').click() time.sleep(2) driver.find_element_by_name('password').send_keys('Hoangtuhappy193') driver.find_element_by_id("passwordNext").click() time.sleep(6) driver.switch_to.window(driver.window_handles[0]) self.assertTrue(driver.find_elements_by_name("accountDetail")) driver.save_screenshot(normaluser_images+"/test_02g_google_login_success.png")