def test_login_11_ninja(self): wait = WebDriverWait(self.driver, 10) login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Enter valid email login.set_email(self.email_address) # Enter valid password login.set_password(self.password) # Click "Login" button login.click_login_button() # Click "Back Arrow" on browser button (2 times) login.windows_back_page() login.windows_back_page() # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Check if user is logged in, if not -> error (check if Logout link is present) element = wait.until( EC.presence_of_element_located( (By.XPATH, LoginNinja.logout_link))).is_displayed() assert element, "ERROR. The user was logged out."
def test_login_22_ninja(self): login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Click "Forgotten Password" link login.click_forgotten_password_link() # Enter a valid email login.set_email(self.email_address) # Click "Continue" button login.click_login_button() # Check if a confirmation message appeared element = self.driver.find_element_by_xpath(LoginNinja.confirm_message).is_displayed() assert element, "ERROR. An email with a confirmation link was not sent to the user's email address."
def test_login_16_ninja(self): login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Enter valid email login.set_email(self.email_address) # Enter the old password login.set_password(self.password) # Click "Continue" button login.click_login_button() # Check if user is not login, if user logged in => error element = self.driver.find_element_by_xpath(LoginNinja.warning_message).is_displayed() assert element, "ERROR. User can login with his old password."
def test_login_07_ninja(self): login = LoginNinja(self.driver) # Click on "My Account" link login.click_my_account_link() # Click on "Login" link login.click_login_link() # Enter a valid email in email field login.set_email(self.email) # Enter a invalid password in password field login.set_password(self.password) # Click on "Login" button login.click_login_button() # Verify if user cannot login with valid email/pass element = self.driver.find_element_by_xpath( LoginNinja.warning_message).is_displayed() assert element, "ERROR. User can login with invalid password."
def test_login_15_ninja(self): login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Enter valid email login.set_email(self.email_address) # Enter valid password login.set_password(self.password) # Click "Login" button login.click_login_button() # Click "Password" link login.click_password_link() # Enter new password login.set_new_password(self.new_password) # Confirm new password login.set_password_confirm(self.password_confirm) # Click "Continue" button login.click_login_button() # User is logging out login.click_logout() # User is logging in the second time with the same e-mail and with the new password login.click_my_account_link() login.click_login_link() login.set_email(self.email_address) login.set_new_password(self.new_password) login.click_login_button() # User is changing the new password to the old one (It's vital to change the pass to initial one, because the next test cases are using the initial password) login.click_password_link() login.set_new_password(self.old_password) login.set_password_confirm(self.old_pass_confirm) login.click_login_button() # User is logging out login.click_my_account_link() login.click_logout() # User is logging in to verify if the password was changed to the initial one login.click_my_account_link() login.click_login_link() login.set_email(self.email_address) login.set_password(self.password) login.click_login_button() # Check if user signed in with the new password, if not => error element = self.driver.find_element_by_xpath( LoginNinja.logout_link).is_displayed() assert element, "ERROR. User didn't change his password successfully."
def test_login_14_ninja(self): wait = WebDriverWait(self.driver, 10) login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Enter valid email login.set_email(self.email_address) # Enter valid password login.set_password(self.password) # Copy password (ctrl+c), than delete password, than paste password (ctrl+v) login.verify_password() # Click "Login" button login.click_login_button() # An warning should appear: "No match for E-Mail Address and/or Password." element = wait.until( EC.presence_of_element_located( (By.XPATH, LoginNinja.warning_message))).is_displayed() assert element, "ERROR. User can copy/paste the password with asterisks."
def test_login_19_ninja(self): login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Enter valid email login.set_email(self.email_address) # Enter valid password login.set_password(self.password) # Click "Login" button login.click_login_button() # Click "My Account" link login.click_my_account_link() # Click "Logout" link login.click_logout() # Check if user was signed out, if not => error element = self.driver.find_element_by_xpath( LoginNinja.check_sign_out).is_displayed() assert element, "ERROR. The user didn't sign out."
def test_login_12_ninja(self): login = LoginNinja(self.driver) # Click "My Account" link login.click_my_account_link() # Click "Login" link login.click_login_link() # Enter valid email login.set_email(self.email_address) # Enter valid password login.set_password(self.password) # Click "Login" button login.click_login_button() # Click "My Account" link login.click_my_account_link() # Click "Logout" link login.click_logout() # Click "Back Arrow" button (browser) login.windows_back_page() # Click "Edit Account" link login.click_edit_account() # Verify if user is logged out (must be logged out, else => error) element = self.driver.find_element_by_xpath( LoginNinja.new_customer_text).is_displayed() assert element, "ERROR. The user was logged out."