def test_reset_password(self, mozwebqa):
        user = self.create_verified_user(mozwebqa.selenium, mozwebqa.timeout)
        mozwebqa.selenium.get('%s/' % mozwebqa.base_url)
        self.log_out(mozwebqa.selenium, mozwebqa.timeout)
        mozwebqa.selenium.find_element(*self._persona_login_button_locator).click()

        from browserid.pages.sign_in import SignIn
        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        signin.click_this_is_not_me()
        signin.email = user.primary_email
        signin.click_next()
        signin.click_forgot_password()
        mail = restmail.get_mail(user.primary_email,
                                 message_count=2,
                                 timeout=mozwebqa.timeout)
        assert 'Click to reset your password' in mail[1]['text']
        reset_url = re.search(BrowserID.RESET_URL_REGEX,
                              mail[1]['text']).group(0)
        signin.switch_to_main_window()
        mozwebqa.selenium.get(reset_url)

        from browserid.pages.reset_password import ResetPassword

        reset_password = ResetPassword(mozwebqa.selenium)
        user.password += '_new'
        reset_password.new_password = user.password
        reset_password.verify_password = user.password
        reset_password.click_finish()

        assert '%s has been verified!' % user.primary_email in reset_password.thank_you
Beispiel #2
0
    def login_with_user_from_other_pages(self, user="******"):
        self.find_element(*self._login_register_locator).click()
        from browserid.pages.sign_in import SignIn
        bid_login = SignIn(self.selenium, self.timeout)
        self.selenium.execute_script('localStorage.clear()')
        credentials = self.testsetup.credentials[user]
        bid_login.sign_in(credentials['email'], credentials['password'])

        self.wait_for_login_not_present()
Beispiel #3
0
    def test_sign_in_new_user_helper(self, mozwebqa):
        user = MockUser()
        from browserid.pages.sign_in import SignIn
        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        print 'signing in as %s' % user.primary_email
        signin.sign_in_new_user(user.primary_email, 'password')
        mail = restmail.get_mail(user.primary_email, timeout=mozwebqa.timeout)

        # Check that the email appears to be valid
        self.email_appears_valid(mail[0]['text'])
Beispiel #4
0
    def create_verified_user(self, selenium, timeout):
        user = MockUser()
        from browserid.pages.sign_in import SignIn
        signin = SignIn(selenium, timeout)
        signin.sign_in_new_user(user.primary_email, user.password)
        mail = restmail.get_mail(user.primary_email, timeout=timeout)
        verify_url = re.search(BrowserID.VERIFY_URL_REGEX,
                               mail[0]['text']).group(0)

        selenium.get(verify_url)
        from browserid.pages.complete_registration import CompleteRegistration
        complete_registration = CompleteRegistration(selenium,
                                                     timeout,
                                                     expect='success')
        assert user['primary_email'] in complete_registration.user_loggedin
        return user
Beispiel #5
0
    def click_sign_in_to_register(self, expect='new'):
        self.selenium.find_element(*self._sign_in_locator).click()

        from browserid.pages.sign_in import SignIn
        return SignIn(self.selenium, self.timeout, expect=expect)
        WebDriverWait(self.selenium, self.timeout).until(lambda s:
                                                         self.is_element_visible(self._create_new_profile_button))
Beispiel #6
0
    def test_sign_in_is_this_your_computer_immediately(self, mozwebqa):
        browser_id = BrowserID(mozwebqa.selenium, mozwebqa.timeout)
        browser_id.sign_in(mozwebqa.email, mozwebqa.password)

        WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
            lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed())

        self.log_out(mozwebqa.selenium, mozwebqa.timeout)

        mozwebqa.selenium.find_element(*self._persona_login_button_locator).click()

        from browserid.pages.sign_in import SignIn
        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        signin.click_sign_in_returning_user()

        WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
            lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed())
Beispiel #7
0
    def click_login_register(self, expect='new'):
        """Click the 'Log in/Register' button.

        Keyword arguments:
        expect -- the expected resulting page
        'new' for user that is not currently signed in (default)
        'returning' for users already signed in or recently verified
        """
        self.selenium.find_element(*self._login_locator).click()
        from browserid.pages.sign_in import SignIn
        return SignIn(self.selenium, self.timeout, expect=expect)
Beispiel #8
0
    def click_sign_in_to_register(self, expect='new'):
        hover_element = self.selenium.find_element(*self._sign_in_with_locator)
        ActionChains(self.selenium).\
            move_to_element(hover_element).\
            perform()
        WebDriverWait(self.selenium, self.timeout).until(
            EC.element_to_be_clickable(self._persona_login_locator))
        self.selenium.find_element(*self._persona_login_locator).click()

        from browserid.pages.sign_in import SignIn
        return SignIn(self.selenium, self.timeout, expect=expect)
Beispiel #9
0
    def test_sign_in(self, mozwebqa):
        from browserid.pages.sign_in import SignIn
        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        signin.email = mozwebqa.email
        assert signin.email == mozwebqa.email, "email getter failed"
        signin.click_next(expect='password')
        signin.login_password = mozwebqa.password
        assert signin.login_password == mozwebqa.password, "password getter failed"
        signin.click_sign_in()

        WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
            lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed())
Beispiel #10
0
 def login_with_user_from_other_pages(self, user="******"):
     from browserid.pages.sign_in import SignIn
     bid_login = SignIn(self.selenium, self.timeout)
     self.selenium.execute_script('localStorage.clear()')
     credentials = self.testsetup.credentials[user]
     bid_login.sign_in(credentials['email'], credentials['password'])
Beispiel #11
0
 def login_with_user_from_other_pages(self, user="******"):
     from browserid.pages.sign_in import SignIn
     bid_login = SignIn(self.selenium, self.timeout)
     self.selenium.execute_script('localStorage.clear()')
     credentials = self.testsetup.credentials[user]
     bid_login.sign_in(credentials['email'], credentials['password'])
Beispiel #12
0
    def test_sign_in_new_user(self, mozwebqa):
        user = MockUser()
        from browserid.pages.sign_in import SignIn
        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        print 'signing in as %s' % user.primary_email
        signin.email = user.primary_email
        signin.click_next(expect='verify')
        signin.register_password = user.password
        signin.verify_password = user.password
        assert signin.verify_password == user.password, 'verify password getter failed'
        signin.click_verify_email()
        assert signin.check_email_at_address == user.primary_email

        signin.close_window()
        signin.switch_to_main_window()
        mail = restmail.get_mail(user.primary_email, timeout=mozwebqa.timeout)

        # Check that the email appears to be valid
        self.email_appears_valid(mail[0]['text'])
Beispiel #13
0
    def test_add_email(self, mozwebqa):
        user = self.create_verified_user(mozwebqa.selenium, mozwebqa.timeout)
        user.additional_emails.append('*****@*****.**' % user.id)

        mozwebqa.selenium.get('%s/' % mozwebqa.base_url)
        self.log_out(mozwebqa.selenium, mozwebqa.timeout)
        mozwebqa.selenium.find_element(*self._persona_login_button_locator).click()

        from browserid.pages.sign_in import SignIn
        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        signin.click_add_another_email_address()
        signin.new_email = user.additional_emails[0]
        assert signin.new_email == user.additional_emails[0], "new email getter failed"
        signin.click_add_new_email()
        signin.close_window()
        signin.switch_to_main_window()

        mail = restmail.get_mail(user.additional_emails[0],
                                 timeout=mozwebqa.timeout)

        # Check that the email appears to be valid
        self.email_appears_valid(mail[0]['text'])

        confirm_url = re.search(
            BrowserID.CONFIRM_URL_REGEX, mail[0]['text']).group(0)

        mozwebqa.selenium.get(confirm_url)
        from browserid.pages.complete_registration import CompleteRegistration
        complete_registration = CompleteRegistration(mozwebqa.selenium,
                                                     mozwebqa.timeout,
                                                     expect='success')
        assert user.additional_emails[0] in complete_registration.user_loggedin

        mozwebqa.selenium.get('%s/' % mozwebqa.base_url)
        self.log_out(mozwebqa.selenium, mozwebqa.timeout)
        mozwebqa.selenium.find_element(*self._persona_login_button_locator).click()

        signin = SignIn(mozwebqa.selenium, mozwebqa.timeout)
        assert user.additional_emails[0] in signin.emails
        assert signin.selected_email == user.additional_emails[0]