Skip to content
Snippets Groups Projects
Commit 75446f72 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

(automated tests) when completing email verification triggered via 123done,...

(automated tests) when completing email verification triggered via 123done, wait for the redirect rather than trying to test the contents of the landing page.
parent 8e5c1afc
No related branches found
No related tags found
No related merge requests found
......@@ -27,9 +27,8 @@ class TestChangePassword:
email = inbox.find_by_index(0)
# Load the BrowserID link from the email in the browser
mozwebqa.selenium.get(email.verify_user_link)
from browserid.pages.complete_registration import CompleteRegistration
CompleteRegistration(mozwebqa.selenium, mozwebqa.timeout)
CompleteRegistration(mozwebqa.selenium, email.verify_user_link)
mozwebqa.selenium.get(mozwebqa.server_base_url)
from browserid.pages.account_manager import AccountManager
......
......@@ -27,13 +27,8 @@ class TestNewAccount:
email = inbox.find_by_index(0)
# Load the BrowserID link from the email in the browser
mozwebqa.selenium.get(email.verify_user_link)
from browserid.pages.complete_registration import CompleteRegistration
complete_registration = CompleteRegistration(mozwebqa.selenium, mozwebqa.timeout)
# Check the message on the registration page reflects a successful registration!
Assert.contains("Thank you for signing up with Persona.", complete_registration.thank_you)
complete_registration = CompleteRegistration(mozwebqa.selenium, email.verify_user_link)
home_pg.go_to_home_page()
Assert.equal(home_pg.logged_in_user_email, user['email'])
......@@ -12,20 +12,39 @@ from selenium.webdriver.support.ui import WebDriverWait
class CompleteRegistration(Base):
_page_title = 'Mozilla Persona: Complete Registration'
_email_locator = (By.ID, 'email')
_password_locator = (By.ID, 'password')
_finish_locator = (By.CSS_SELECTOR, 'div.submit > button')
_thank_you_locator = (By.ID, 'congrats')
def __init__(self, selenium, timeout, expect='success'):
Base.__init__(self, selenium, timeout)
def __init__(self, mozwebqa, url, expect='redirect'):
"""
class init method
:Args:
- url - the confirmation url from the email
- expect - redirect/success/reset/verify (default redirect)
"""
Base.__init__(self, mozwebqa)
print "the url" + url
self.selenium.get(url)
if expect == 'success':
if expect == 'redirect':
WebDriverWait(self.selenium, self.timeout).until(
lambda s: s.find_element(*self._thank_you_locator).is_displayed())
lambda s: s.title != self._page_title,
"Complete Registration page did not redirect")
elif expect == 'success':
WebDriverWait(self.selenium, self.timeout).until(
lambda s: 'Thank you' in s.find_element(*self._thank_you_locator).text,
"Complete Registration did not succeed")
elif expect == 'reset':
WebDriverWait(self.selenium, self.timeout).until(
lambda s: 'verified' in s.find_element(*self._thank_you_locator).text,
"Complete Registration did not succeed")
elif expect == 'verify':
WebDriverWait(self.selenium, self.timeout).until(
lambda s: s.find_element(*self._password_locator).is_displayed())
lambda s: s.find_element(*self._password_locator).is_displayed(),
"password field did not become visible")
else:
raise Exception('Unknown expect value: %s' % expect)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment