def test_unsuccessful_login_invalid_password(self): """ Tests the login functionality of www.hudl.com considering the user pressed the enter key to perform the action. """ main_page = MainPage(self.driver) self.assertTrue( main_page.is_title_matches(), "The title of the Hudl main page was different from the expected. Found: {}, Expected: {}" .format(self.driver.title, main_page.MAIN_PAGE_TITLE)) # Clicks on the Login button to be redirected to the login page main_page.click_login_button() login_page = LoginPage(self.driver) self.assertTrue( login_page.is_title_matches(), "The title of the Hudl login page was different from the expected. Found: {}, Expected: {}" .format(self.driver.title, login_page.LOGIN_PAGE_TITLE)) # Sets the text of the email input to the user's email login_page.email_text_element = login_data.VALID_EMAIL # Sets the text of the password input to the user's password login_page.pwd_text_element = login_data.INVALID_PASSWORD login_page.click_login_button() # Verifies if the error container is visible self.assertTrue( login_page.is_error_container_visible(), "No error message was shown when trying to login with " "empty credential fields.") # Verify if the visible error message matches the expected self.assertTrue( login_page.is_error_message_matches(), "The error message displayed to the user was different " "from the expected.")
def test_unsuccessful_login_empty_fields(self): """ Tests the login functionality of www.hudl.com considering the user try to login with empty fields. """ main_page = MainPage(self.driver) self.assertTrue( main_page.is_title_matches(), "The title of the Hudl main page was different from the expected. Found: {}, Expected: {}" .format(self.driver.title, main_page.MAIN_PAGE_TITLE)) # Clicks on the Login button to be redirected to the login page main_page.click_login_button() login_page = LoginPage(self.driver) self.assertTrue( login_page.is_title_matches(), "The title of the Hudl login page was different from the expected. " "Found: {}, Expected: {}".format(self.driver.title, login_page.LOGIN_PAGE_TITLE)) login_page.clear_credential_fields() login_page.click_login_button() # Verifies if the error container is visible self.assertTrue( login_page.is_error_container_visible(), "No error message was shown when trying to login with " "empty credential fields.") # Verify if the visible error message matches the expected self.assertTrue( login_page.is_error_message_matches(), "The error message displayed to the user was different " "from the expected.")