Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2392 from mozilla/complete_registration_test_fix
Browse files Browse the repository at this point in the history
Complete registration test fix
  • Loading branch information
lloyd committed Aug 24, 2012
2 parents 8e5c1af + 1adbe2f commit 9780d79
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
3 changes: 1 addition & 2 deletions automation-tests/123done/tests/test_change_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ def test_can_change_user_password(self, mozwebqa):
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, email.verify_user_link)

mozwebqa.selenium.get(mozwebqa.server_base_url)
from browserid.pages.account_manager import AccountManager
Expand Down
7 changes: 1 addition & 6 deletions automation-tests/123done/tests/test_new_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ def test_can_create_new_user_account(self, mozwebqa):
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, email.verify_user_link)

home_pg.go_to_home_page()

Assert.equal(home_pg.logged_in_user_email, user['email'])
29 changes: 24 additions & 5 deletions automation-tests/browserid/pages/complete_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,39 @@

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.selenium, mozwebqa.timeout)
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)

Expand Down
1 change: 1 addition & 0 deletions automation-tests/run_saucelabs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var globalPythonArgs = {
"--saucelabs": sauceYAMLPath,
"--webqatimeout": 90,
"--destructive": null,
"-n": 5,
"-q": null,
'--capabilities': JSON.stringify({ "avoid-proxy":"true"})
};
Expand Down

0 comments on commit 9780d79

Please sign in to comment.