def test_my_account_07_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Click on "Address Book" link myacc.click_address_book_link() # Click on "New Address" button myacc.click_new_address_button() # Complete all the mandatory fields myacc.set_new_address_first_name(self.new_first_name) myacc.set_new_address_last_name(self.new_last_name) myacc.set_new_address(self.new_address) myacc.set_new_address_city(self.new_city) myacc.set_new_address_zip(self.new_zip) time.sleep(1) myacc.set_country_usa() time.sleep(1) myacc.set_state_texas() # Click on "Continue" button myacc.click_continue_button() time.sleep(1) # Verify if the new address was added element = self.driver.find_element_by_xpath(MyAccountNinja.verify_new_address) check = "Jacky Nicholsons\n123 Main St.\nDallas, Texas 55555\nUnited States" assert check == element.text, "ERROR. The new address wasn't added."
def test_my_account_02_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Check if all links under "My Orders" text are displayed element = self.driver.find_element_by_xpath(MyAccountNinja.order_history_link).is_displayed() assert element, "ERROR. 'Order History' link is not displayed." element = self.driver.find_element_by_xpath(MyAccountNinja.downloads_link).is_displayed() assert element, "ERROR. 'Downloads' link is not displayed." element = self.driver.find_element_by_xpath(MyAccountNinja.reward_points_link).is_displayed() assert element, "ERROR. 'Reward Points' link is not displayed." element = self.driver.find_element_by_xpath(MyAccountNinja.returns_link).is_displayed() assert element,"ERROR. 'Returns' link is not displayed." element = self.driver.find_element_by_xpath(MyAccountNinja.transactions_link).is_displayed() assert element, "ERROR. 'Transactions' link is not displayed." element = self.driver.find_element_by_xpath(MyAccountNinja.payment_profile_link).is_displayed() assert element, "ERROR. 'Payment Profile' link is not displayed." # Click order history link myacc.click_order_history_link() element = self.driver.find_element_by_xpath(MyAccountNinja.verify_order_history).is_displayed() assert element, "ERROR. 'Order History' link is broken." myacc.click_my_account_link() myacc.click_my_account_link_2() # Click downloads link myacc.click_downloads_link() # Verify if download link is working element = self.driver.find_element_by_xpath(MyAccountNinja.verify_downloads).is_displayed() assert element, "ERROR. 'Downloads' link is broken." myacc.click_my_account_link() myacc.click_my_account_link_2() # Click on reward points link myacc.click_reward_points_link() # Verify if reward points link is working element = self.driver.find_element_by_xpath(MyAccountNinja.verify_reward_points).is_displayed() assert element, "ERROR. 'Reward Points' link is broken." myacc.click_my_account_link() myacc.click_my_account_link_2() # Click on verify transaction link myacc.click_transactions_link() # Verify if verify transaction link is working element = self.driver.find_element_by_xpath(MyAccountNinja.verify_transactions).is_displayed() assert element, "ERROR. ''Transactions' link is broken." myacc.click_my_account_link() myacc.click_my_account_link_2() # Click on payment profile link myacc.click_payment_profile_link() # Verify if payment profile link is working element = self.driver.find_element_by_xpath(MyAccountNinja.verify_payment_profile).is_displayed() assert element, "ERROR. ''Payment Profile' link is broken."
def test_my_account_06_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Click on "Edit Account" link myacc.click_edit_account_link() # Enter new "First Name" myacc.set_first_name(self.first_name) # Enter new "Last Name" myacc.set_last_name(self.last_name) # Enter new "E-Mail" myacc.set_new_email(self.new_email) # Enter new "Telephone" myacc.set_telephone(self.telephone) # Click on "Continue" button myacc.click_continue_button() # Click "Edit Account" myacc.click_edit_account_link() # Verify if all the field changed with new data new_first_name = "Jacky" new_last_name = "Boy" new_email_address = "*****@*****.**" new_telephone = "+121233344455" elem = self.driver.find_element_by_xpath( MyAccountNinja.first_name_field) element = elem.get_attribute("value") time.sleep(2) # assert element == new_first_name, "ERROR. First name hasn't been changed." elem = self.driver.find_element_by_xpath( MyAccountNinja.last_name_field) element = elem.get_attribute("value") assert element == new_last_name, "ERROR. Last name hasn't been changed." elem = self.driver.find_element_by_xpath(MyAccountNinja.email_field) element = elem.get_attribute("value") assert element == new_email_address, "ERROR. E-Mail hasn't been changed." elem = self.driver.find_element_by_xpath( MyAccountNinja.telephone_field) element = elem.get_attribute("value") assert element == new_telephone, "ERROR. Telephone hasn't been changed." myacc.set_new_email(self.email_address) myacc.click_continue_button()
def test_my_account_01_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Check if all links under "My Account" text are displayed element = self.driver.find_element_by_xpath(MyAccountNinja.edit_account_link).is_displayed() assert element, "ERROR. 'Edit Account' link is not displayed." # Check if password link is displayed element = self.driver.find_element_by_xpath(MyAccountNinja.password_link).is_displayed() assert element, "ERROR. 'Password' link is not displayed." # Check if address book link is displayed element = self.driver.find_element_by_xpath(MyAccountNinja.address_book_link).is_displayed() assert element, "ERROR. 'Address book' link is not displayed." # Check if wish list link is displayed element = self.driver.find_element_by_xpath(MyAccountNinja.wish_list_link).is_displayed() assert element, "ERROR. 'Wish List' link is not displayed." myacc.click_edit_account_link() element = self.driver.find_element_by_xpath(MyAccountNinja.verify_edit_account).is_displayed() assert element, "ERROR. 'Edit Account' link is broken." # Click back button myacc.click_back_button() # Click password link myacc.click_password_link() # Verify if password link is working element = self.driver.find_element_by_xpath(MyAccountNinja.verify_password_link).is_displayed() assert element, "ERROR. 'Password' link is broken." myacc.click_back_button() # Click address book link myacc.click_address_book_link() # Verify if address book link is displayed element = self.driver.find_element_by_xpath(MyAccountNinja.verify_address_book).is_displayed() assert element, "ERROR. 'Address book' link is broken." # Click back button myacc.click_back_button() # Click with list link myacc.click_wish_list_link() # Verify if wish list link is working element = self.driver.find_element_by_xpath(MyAccountNinja.verify_wish_list).is_displayed() assert element, "ERROR. ''Wish List' link is broken."
def test_my_account_11_ninja(self): wait = WebDriverWait(self.driver, 10) myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Click on "Address Book" link myacc.click_address_book_link() # Click on "New Address" button myacc.click_new_address_button() # Complete all the mandatory fields myacc.set_new_address_first_name(self.new_first_name) myacc.set_new_address_last_name(self.new_last_name) myacc.set_new_address(self.new_address) myacc.set_new_address_city(self.new_city) myacc.set_new_address_zip(self.new_zip) time.sleep(1) myacc.set_country_usa() time.sleep(1) myacc.set_state_texas() # Select "Yes" at "Default Address" myacc.select_yes_radio_button() # Click on "Continue" button myacc.click_continue_button() time.sleep(1) # Verify if the new address was added element = self.driver.find_element_by_xpath( MyAccountNinja.verify_new_address) check = "Jacky Nicholsons\n123 Main St.\nDallas, Texas 55555\nUnited States" assert check == element.text, "ERROR. The new address wasn't added." # Click on "Delete" button myacc.click_new_address_delete_button() # Verify if a warning message popped out element = wait.until( EC.presence_of_element_located( (By.XPATH, MyAccountNinja.warning_delete_address))) assert element.is_displayed( ), "ERROR. The user can delete his default address."
def test_my_account_04_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Check if the link under "Newsletter" text is displayed element = self.driver.find_element_by_xpath(MyAccountNinja.newsletter_link).is_displayed() assert element, "ERROR. 'Newsletter' link is not displayed." # Click on newsletter link myacc.click_newsletter_link() element = self.driver.find_element_by_xpath(MyAccountNinja.verify_newsletter).is_displayed() assert element, "ERROR. 'Newsletter' link is broken."
def test_my_account_12_ninja(self): wait = WebDriverWait(self.driver, 10) myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Click on "Edit Account" link myacc.click_edit_account_link() # Enter more than 32 characters in "First Name" field myacc.set_first_name(self.first_name) # Enter more than 32 characters in "Last Name" field myacc.set_last_name(self.last_name) # Enter an invalid email in "E-Mail" field myacc.set_email(self.email_empty) # Enter more than 32 characters in "Telephone" field myacc.set_telephone(self.telephone) # Click "Continue" button myacc.click_continue_button() # Verify if error messages are present for every field element = wait.until( EC.presence_of_element_located( (By.XPATH, MyAccountNinja.warning_first_name))).is_displayed() assert element, "ERROR. 'First Name' warning text is not displayed." element = self.driver.find_element_by_xpath( MyAccountNinja.warning_last_name).is_displayed() assert element, "ERROR. 'Last Name' warning text is not displayed." element = self.driver.find_element_by_xpath( MyAccountNinja.warning_email).is_displayed() assert element, "ERROR. 'E-mail' warning text is not displayed." element = self.driver.find_element_by_xpath( MyAccountNinja.warning_telephone).is_displayed() assert element, "ERROR. 'Telephone' warning text is not displayed."
def test_my_account_03_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Check if the link under "My Affiliate Account" text is displayed element = self.driver.find_element_by_xpath( MyAccountNinja.reg_aff_acc_link).is_displayed() assert element, "ERROR. 'Register for an affiliate account' link is not displayed." # Click on registration affiliate account link myacc.click_reg_aff_acc_link() # Verify if registration affiliate account link is working element = self.driver.find_element_by_xpath( MyAccountNinja.verify_reg_aff_acc).is_displayed() assert element, "ERROR. 'Register for an affiliate account' link is broken."
def test_my_account_05_ninja(self): myacc = MyAccountNinja(self.driver) # Click on "My Account" link myacc.click_my_account_link() # Click on "Login" link myacc.click_login_link() # Enter a valid email address myacc.set_email(self.email_address) # Enter a valid password myacc.set_password(self.password) # Click on "Login" button myacc.click_login_button() # Click on "Edit Account" link myacc.click_edit_account_link() # Enter an empty text in "First Name" field myacc.set_first_name(self.first_name) # Enter an empty text in "Last Name" field myacc.set_last_name(self.last_name) # Enter an empty text in "E-Mail" field myacc.set_email(self.email_empty) # Enter an empty text in "Telephone" field myacc.set_telephone(self.telephone) # Click "Continue" button myacc.click_continue_button() # Verify if error messages are present for every field element = self.driver.find_element_by_xpath( MyAccountNinja.warning_first_name).is_displayed() assert element, "ERROR. 'First Name' warning text is not displayed." element = self.driver.find_element_by_xpath( MyAccountNinja.warning_last_name).is_displayed() assert element, "ERROR. 'Last Name' warning text is not displayed." element = self.driver.find_element_by_xpath( MyAccountNinja.warning_email).is_displayed() assert element, "ERROR. 'E-mail' warning text is not displayed." element = self.driver.find_element_by_xpath( MyAccountNinja.warning_telephone).is_displayed() assert element, "ERROR. 'Telephone' warning text is not displayed."