Example #1
0
 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."
Example #2
0
 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."
Example #3
0
 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."