def test_login_missing_password(driver, browser, mode, device, username, password): """Test attempting to log in with a blank password.""" login_page = LoginPage(driver) login_page.perform_complete_login(username, password) assert login_page.error_message_exists() print(login_page.get_error_message_text()) print("test_login_missing_password finished successfully.")
def test_login_incorrect_credentials(driver, browser, mode, device, username, password): """Test attempting to log in with invalid credentials.""" login_page = LoginPage(driver) login_page.perform_complete_login(username, password) assert login_page.error_message_exists() print(login_page.get_error_message_text()) print("test_login_incorrect_credentials finished successfully.")
def test_login_valid_user(driver, browser, mode, device, username, password): """Test logging in with a valid username/password.""" login_page = LoginPage(driver) login_page.enter_username(username) login_page.enter_password(password) login_page.click_login() assert not login_page.error_message_exists() print("Test finished.")
def test_login_locked_out_user(driver, browser, mode, device, username, password): """Test logging in with a user who is locked out.""" login_page = LoginPage(driver) login_page.perform_complete_login(username, password) assert login_page.error_message_exists() print(login_page.get_error_message_text()) print("test_login_locked_out_user finished successfully.")
class TestLogin(BaseTest): def test_login_button_exist(self): """ test if login button exist """ self.login_page = LoginPage(self.driver) login_button = self.login_page.is_login_button_exist() assert login_button def test_login_page_title(self): """ test if page title is correct """ self.login_page = LoginPage(self.driver) title = self.login_page.get_login_page_title(TestData.LOGIN_PAGE_TITLE) assert title == TestData.LOGIN_PAGE_TITLE def test_login_standard_user(self): """ test login with a valid credentials """ self.login_page = LoginPage(self.driver) self.login_page.login(TestData.STANDARD_USER, TestData.PASSWORD) assert not self.login_page.error_message_exists() print("Test finished.") def test_login_problem_user(self): """ test login to online shop with bugs """ self.login_page = LoginPage(self.driver) self.login_page.login(TestData.PROBLEM_USER, TestData.PASSWORD) assert not self.login_page.error_message_exists() print("Test login_problem_user finished.") def test_login_locked_out_user(self): """ test login with credential locked user """ self.login_page = LoginPage(self.driver) self.login_page.login(TestData.LOCKED_OUT_USER, TestData.PASSWORD) assert self.login_page.error_message_exists() print(self.login_page.get_error_message_text()) print("Test_login_locked_out_user finished successfully.") def test_login_performance_glitch_user(self): """ test login locked user to online shop with bad performance """ self.login_page = LoginPage(self.driver) self.login_page.login(TestData.PERFORMANCE_GLITCH_USER, TestData.PASSWORD) assert not self.login_page.error_message_exists() print("Test performance_glitch_user finished.") def test_login_invalid_credentials(self): """ test login with an invalid credentials """ self.login_page = LoginPage(self.driver) self.login_page.login(TestData.INVALID_USER, TestData.INVALID_PASSWORD) assert self.login_page.error_message_exists() print(self.login_page.get_error_message_text()) print("Test login_incorrect_credentials finished successfully.")