Example #1
0
 def test_login_link(self):
     """ Test LogInLink checks 'Log in' link functionality """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_signup_link()
     main_page.click_login_link()
     assert main_page.is_element_present(*MainPageLocators.SIGNIN_EMAIL_FIELD)
     assert main_page.is_element_present(*MainPageLocators.SIGNIN_PASSWORD_FIELD)
     assert main_page.is_element_present(*MainPageLocators.SIGNIN_BUTTON)
Example #2
0
 def test_cancel_signin(self):
     """ Test CancelSignIN checks Cancel button """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.set_email('*****@*****.**')
     main_page.set_password('555555')
     main_page.click_cancel_button()
     text = main_page.return_message_text(*MainPageLocators.SIGNIN_LINK)
     self.assertEquals(text, 'Sign in with email', 'The messages are different!')
    def test_sidebar_links(self):
        sidebar = MainPage(self.driver)

        sidebar.wait_for_element(10, SidebarAny.SIDEBAR_ONE)

        # SIDEBAR_LIST is in locators.py
        for item in Sidebar.SIDEBAR_LIST:
            current_item = self.driver.find_element(By.XPATH, item)
            current_item.click()
        else:
            print("---- Test result: All links in sidebar are working ----")
Example #4
0
 def test_empty_reset_password(self):
     """ Test ResetPassEmpty checks that user can't use empty password during resetting """
     main_page = MainPage(self.driver)
     main_page.set_credential('', *MainPageLocators.NEW_PASSWORD)
     main_page.set_credential('', *MainPageLocators.CONFIRM_PASSWORD)
     main_page.click_confirm_button()
     text = main_page.return_message_value(*MainPageLocators.EMAIL_PARSING_ERROR)
     self.assertEquals(text, 'This value is required.', 'The messages are different!')
     text = main_page.return_message_value(*MainPageLocators.PASSWORD_CONFIRM_ERROR)
     self.assertEquals(text, 'This value is required.', 'The messages are different!') # Message parametrization will be required for localized site
Example #5
0
 def test_reset_password_short(self):
     """ Test ResetPassShort checks that passwords provided by user should be long enough """
     main_page = MainPage(self.driver)
     main_page.set_credential('555', *MainPageLocators.NEW_PASSWORD)
     main_page.set_credential('555', *MainPageLocators.CONFIRM_PASSWORD)
     main_page.click_confirm_button()
     text = main_page.return_message_value(*MainPageLocators.SHORT_PASS_MESSAGE)
     self.assertEquals(text, 'This value is too short. It should have 6 characters or more.', 'The messages are different!')  # Message parametrization will be required for localized site
Example #6
0
 def test_reset_password_equal(self):
     """ Test ResetPassEqual checks that passwords provided by user should be equal """
     main_page = MainPage(self.driver)
     main_page.set_credential('555555', *MainPageLocators.NEW_PASSWORD)
     main_page.set_credential('666666', *MainPageLocators.CONFIRM_PASSWORD)
     main_page.click_confirm_button()
     text = main_page.return_message_value(*MainPageLocators.NON_EQUAL_MESSAGE)
     self.assertEquals(text, 'This value should be the same.', 'The messages are different!')  # Message parametrization will be required for localized site
    def test_item_in_category(self):
        category = MainPage(self.driver)

        # Click the "Nonfood" category in sidebar
        category.click_category_non_food()

        # Wait for element to appear and click on first item on list
        item = Items(self.driver)
        item.wait_for_element(30, ItemInCategory.FIRST_ITEM)
        assert item.is_element_present(*ItemInCategory.FIRST_ITEM)
        item.click_first_item()

        self.driver.back()

        # driver.back() is going to previous page and now selenium clicks on second item if present
        item.wait_for_element(30, ItemInCategory.SECOND_ITEM)
        assert item.is_element_present(*ItemInCategory.SECOND_ITEM)
        item.click_second_item()

        print(
            "---- Test result: Test successful! Items are present on page ----"
        )
Example #8
0
 def test_empty_signup(self):
     """ Test SignUpEmpty checks empty password processing during sign up """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_signup_link()
     email = main_page.get_random_email()
     main_page.set_credential(email, *MainPageLocators.SIGNUP_EMAIL_FIELD)
     main_page.set_credential('', *MainPageLocators.SIGNUP_PASSWORD_FIELD)
     main_page.set_credential('', *MainPageLocators.SIGNUP_PASSWORD_CONFIRM)
     main_page.click_signup_button()
     text = main_page.return_message_value(*MainPageLocators.EMAIL_PARSING_ERROR)
     self.assertEquals(text, "This value is required.", 'The messages are different!')
     text = main_page.return_message_value(*MainPageLocators.PASSWORD_CONFIRM_ERROR)
     self.assertEquals(text, "This value is required.", 'The messages are different!')
 def test_invalid_email_signup(self):
     """ Test SignUpInvalidEmail checks incorrect email processing during sign up """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_signup_link()
     main_page.set_credential('asdcxvb.com', *MainPageLocators.SIGNUP_EMAIL_FIELD)
     main_page.set_credential('555555', *MainPageLocators.SIGNUP_PASSWORD_FIELD)
     main_page.set_credential('555555', *MainPageLocators.SIGNUP_PASSWORD_CONFIRM)
     main_page.click_signup_button()
     text = main_page.return_message_value(*MainPageLocators.INVALID_CREDENTIALS_MESSAGE)
     self.assertEquals(text, "Invalid login or password", 'The messages are different!')  # Completely optional check
    def test_registration(self):

        register = True  # Set to True if you want the test to register an account, leave to False if you want the
                         # test to fill all items but not register an account in the end

        # Setting registration variable to be equal to the MainPage functions in test_support/pages.py
        registration = MainPage(self.driver)

        # Click "register link"
        registration.click_register_link()

        # Fill information details
        registration.set_first_name("John")
        registration.set_last_name("Smith")
        registration.set_phone("+49 (2343) 5352 5523")
        registration.set_city("Con")
        registration.set_zip("10616")
        registration.set_street("Tedre")
        registration.click_calendar_button()

        # Open calendar, select year and date
        element = self.driver.find_element(By.XPATH, "//button/i")
        actions = ActionChains(self.driver)
        actions.move_to_element(element).perform()
        self.driver.find_element(By.XPATH, "//select[2]").click() # Click "year" option in calendar
        dropdown = self.driver.find_element(By.CSS_SELECTOR, ".custom-select:nth-child(2)")
        dropdown.find_element(By.XPATH, "//option[. = '1989']").click() # Choosing year in list
        self.driver.find_element(By.XPATH, "//div[3]/div[5]/div").click() # Choosing date

        # Select residence
        registration.click_residence_drop()
        registration.click_residence_drop_inside()

        # Select nationality
        registration.click_nationality_drop()
        registration.click_nationality_drop_inside()

        # Get a random email and input email
        email = registration.get_random_email()
        registration.set_email(email)

        # Set password and confirm password
        registration.set_password("TestLOGIN300")
        registration.set_password_confirm("TestLOGIN300")

        # Set company name
        registration.set_company_name("MB")

        self.driver.find_element(By.ID, "formly_2_file_businessLicense_12").send_keys(os.path.join(my_path, "img/devolon.png")) # change the path to your own path

        # Select company type
        registration.click_company_type()
        registration.click_company_type_inside()

        # Set Iban number
        registration.set_iban("DE89500105172843131546")

        # checkbox will be checked with Javascript because html-span obscures it so selenium cannot click the box
        elem = self.driver.find_element(By.XPATH, "//ngb-modal-window[@role='dialog']/div[@role='document']//app-registration-modal/app-modal/div[@class='modal-body']/div/div[2]/div/formly-form/formly-field[20]/app-formly-wrapper-form-field//app-formly-field-checkbox//input[@type='checkbox']")
        self.driver.execute_script("arguments[0].click();", elem)

        # This is the logic to register an account or not
        if register == False:
            print("All element filled but did not register. Set 'register' to 'True' if you want the test to register an actual account")
            sys.exit()
        else:
            print("continuing...")

        # Click register button
        registration.click_register_button()
        print("---- Test result: Test successful! Registration is done. ----")
        time.sleep(6)

        """ Optional check with assertEquals
Example #11
0
 def test_signup_normal(self):
     """ Test SignUpNormal checks sign up with valid credentials """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_signup_link()
     email = main_page.get_random_email()
     main_page.set_credential(email, *MainPageLocators.SIGNUP_EMAIL_FIELD)
     main_page.set_credential('555555', *MainPageLocators.SIGNUP_PASSWORD_FIELD)
     main_page.set_credential('555555', *MainPageLocators.SIGNUP_PASSWORD_CONFIRM)
     main_page.click_signup_button()
     main_page.wait_for_element(30, DashboardLocators.GREETING_TEXT)
     text = main_page.return_message_value(*DashboardLocators.GREETING_TEXT)
     self.assertEquals(text, "To begin, select a few topics you're interested in", 'The messages are different!')  # Completely optional check
 def test_forgot_pass_link(self):
     """ Test ForgotPasswordLink checks 'Forgot your password' link UI """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_forgot_pass_link()
     assert main_page.is_element_present(*MainPageLocators.RESET_PASSWORD_BUTTON)
     main_page.set_credential('*****@*****.**', *MainPageLocators.RESET_EMAIL_FIELD)
     main_page.click_reset_button()
     main_page.wait_for_element(30, MainPageLocators.SUCCESSFULL_RESET_MESSAGE)
     text = main_page.return_message_value(*MainPageLocators.SUCCESSFULL_RESET_MESSAGE)
     self.assertEquals(text, 'We emailed you a link to reset your password', 'The messages are different!')  # Message parametrization will be required for localized site
Example #13
0
 def test_password_signup_equal(self):
     """ Test SignUpEqual checks password confirmation mechanism during sign up """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_signup_link()
     main_page.set_credential('*****@*****.**', *MainPageLocators.SIGNUP_EMAIL_FIELD)
     main_page.set_credential('555555', *MainPageLocators.SIGNUP_PASSWORD_FIELD)
     main_page.set_credential('5555555', *MainPageLocators.SIGNUP_PASSWORD_CONFIRM)
     main_page.click_signup_button()
     text = main_page.return_message_value(*MainPageLocators.NON_EQUAL_MESSAGE)
     self.assertEquals(text, "This value should be the same.", 'The messages are different!')
Example #14
0
 def test_short_password_signup(self):
     """ Test SignUpShort checks that user can't sign up with not long enough password """
     main_page = MainPage(self.driver)
     main_page.click_signin_link()
     main_page.click_signup_link()
     main_page.set_credential("*****@*****.**", *MainPageLocators.SIGNUP_EMAIL_FIELD)
     main_page.set_credential("555", *MainPageLocators.SIGNUP_PASSWORD_FIELD)
     main_page.set_credential("555", *MainPageLocators.SIGNUP_PASSWORD_CONFIRM)
     main_page.click_signup_button()
     text = main_page.return_message_value(*MainPageLocators.SHORT_PASS_MESSAGE)
     self.assertEquals(
         text, "This value is too short. It should have 6 characters or more.", "The messages are different!"
     )