Esempio n. 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."
Esempio n. 2
0
 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()
Esempio n. 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."
Esempio n. 4
0
 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."
Esempio n. 5
0
 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."