diff --git a/automation-tests/123done/tests/test_change_password.py b/automation-tests/123done/tests/test_change_password.py index 621e694b57ded8647fffcd31647ff45044973afa..43e13d454bd26b96d53909b781f4f4513bcc82b5 100644 --- a/automation-tests/123done/tests/test_change_password.py +++ b/automation-tests/123done/tests/test_change_password.py @@ -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, email.verify_user_link) mozwebqa.selenium.get(mozwebqa.server_base_url) from browserid.pages.account_manager import AccountManager diff --git a/automation-tests/123done/tests/test_new_user.py b/automation-tests/123done/tests/test_new_user.py index ed04e9c7e0be50d9f901a48fb50b212db948feab..1ac70a8f8fc890b488df5c700a06a28568b190bd 100644 --- a/automation-tests/123done/tests/test_new_user.py +++ b/automation-tests/123done/tests/test_new_user.py @@ -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, email.verify_user_link) home_pg.go_to_home_page() - Assert.equal(home_pg.logged_in_user_email, user['email']) diff --git a/automation-tests/browserid/pages/complete_registration.py b/automation-tests/browserid/pages/complete_registration.py index 141c1ea1fe33a2e89594cc6d625ab34d85423d83..be8c97efad722105c3615d447f1a588f9bf6a71b 100644 --- a/automation-tests/browserid/pages/complete_registration.py +++ b/automation-tests/browserid/pages/complete_registration.py @@ -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.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) diff --git a/automation-tests/run_saucelabs b/automation-tests/run_saucelabs index 68e34ebd9976613f6f2d9af643def86920845bab..d140319beb8661acdbe801ff3ad3c8c03bb373f0 100755 --- a/automation-tests/run_saucelabs +++ b/automation-tests/run_saucelabs @@ -42,6 +42,7 @@ var globalPythonArgs = { "--saucelabs": sauceYAMLPath, "--webqatimeout": 90, "--destructive": null, + "-n": 5, "-q": null, '--capabilities': JSON.stringify({ "avoid-proxy":"true"}) };