Skip to content
Browse files

Merge branch 'master' into add_forgot_your_password

Conflicts:
	pages/webdriver/sign_in.py
  • Loading branch information...
2 parents 6430c05 + 23ac64d commit ad8f3095995f2f24848442493b5477727ecec468 @davehunt committed
View
2 .travis.yml
@@ -2,7 +2,7 @@ before_script:
- curl -k -L -o /tmp/selenium.jar http://selenium.googlecode.com/files/selenium-server-standalone-2.24.1.jar
- java -jar /tmp/selenium.jar > selenium.out &
- sh -e /etc/init.d/xvfb start
- - sleep 10
+ - sleep 30
language: python
python:
View
9 pages/rc/sign_in.py
@@ -17,7 +17,7 @@ class SignIn(Base):
_sign_in_locator = 'css=button.returning'
_sign_in_returning_user_locator = 'id=signInButton'
_verify_email_locator = 'id=verify_user'
- _use_another_email_address_locator = 'id=back'
+ _check_email_at_locator = 'css=#wait .contents h2 + p strong'
def __init__(self, selenium, timeout, expect='new'):
Base.__init__(self, selenium, timeout)
@@ -71,6 +71,11 @@ def verify_password(self, value):
"""Set the value of the verify password field."""
self.selenium.type(self._verify_password_locator, value)
+ @property
+ def check_email_at_address(self):
+ """Get the value of the email address for confirmation."""
+ return self.selenium.get_text(self._check_email_at_locator)
+
def click_next(self, expect='password'):
"""Clicks the 'next' button."""
self.selenium.click(self._next_locator)
@@ -94,7 +99,7 @@ def click_sign_in_returning_user(self):
def click_verify_email(self):
"""Clicks 'verify email' button."""
self.selenium.click(self._verify_email_locator)
- self.wait_for_element_visible(self._use_another_email_address_locator)
+ self.wait_for_element_visible(self._check_email_at_locator)
def sign_in(self, email, password):
"""Signs in using the specified email address and password."""
View
6 pages/webdriver/account_manager.py
@@ -27,6 +27,10 @@ def __init__(self, selenium, timeout):
lambda s: s.find_element(*self._emails_locator).is_displayed())
@property
+ def signed_in(self):
+ return 'not_authenticated' not in self.selenium.find_element(By.TAG_NAME, 'body').get_attribute('class')
+
+ @property
def emails(self):
return [element.text for element in self.selenium.find_elements(*self._emails_locator)]
@@ -69,4 +73,4 @@ def click_password_done(self):
def click_sign_out(self):
self.selenium.find_element(*self._sign_out_locator).click()
WebDriverWait(self.selenium, self.timeout).until(
- lambda s: s.find_element(*self._sign_in_locator).is_displayed())
+ lambda s: not self.signed_in)
View
9 pages/webdriver/sign_in.py
@@ -20,9 +20,9 @@ class SignIn(Base):
_sign_in_locator = (By.CSS_SELECTOR, 'button.returning')
_sign_in_returning_user_locator = (By.ID, 'signInButton')
_verify_email_locator = (By.ID, 'verify_user')
- _use_another_email_address_locator = (By.ID, 'back')
_forgot_password_locator = (By.ID, 'forgotPassword')
_reset_password_locator = (By.ID, 'password_reset')
+ _check_email_at_locator = (By.CSS_SELECTOR, '#wait .contents h2 + p strong')
def __init__(self, selenium, timeout, expect='new'):
Base.__init__(self, selenium, timeout)
@@ -90,6 +90,11 @@ def verify_password(self, value):
password.clear()
password.send_keys(value)
+ @property
+ def check_email_at_address(self):
+ """Get the value of the email address for confirmation."""
+ return self.selenium.find_element(*self._check_email_at_locator).text
+
def click_next(self, expect='password'):
"""Clicks the 'next' button."""
self.selenium.find_element(*self._next_locator).click()
@@ -120,7 +125,7 @@ def click_verify_email(self):
self.selenium.find_element(*self._verify_email_locator).click()
WebDriverWait(self.selenium, self.timeout).until(
lambda s: s.find_element(
- *self._use_another_email_address_locator).is_displayed())
+ *self._check_email_at_locator).is_displayed())
def click_forgot_password(self):
"""Clicks 'forgot password' link (visible after entering a valid email)"""
View
6 tests/rc/check_sign_in.py
@@ -47,7 +47,7 @@ def test_sign_in_new_user_helper(self, mozwebqa):
print 'signing in as %s' % email
signin.sign_in_new_user(email, 'password')
mail = restmail.get_mail(restmail_username)
- assert 'Thanks for verifying' in mail[0]['text']
+ assert 'Click to confirm this email address' in mail[0]['text']
@pytest.mark.travis
def test_sign_in_new_user(self, mozwebqa):
@@ -63,10 +63,12 @@ def test_sign_in_new_user(self, mozwebqa):
signin.password = password
signin.verify_password = password
signin.click_verify_email()
+ assert signin.check_email_at_address == email
+
signin.close_window()
signin.switch_to_main_window()
mail = restmail.get_mail(restmail_username)
- assert 'Thanks for verifying' in mail[0]['text']
+ assert 'Click to confirm this email address' in mail[0]['text']
@pytest.mark.travis
def test_sign_in_returning_user(self, mozwebqa):
View
6 tests/webdriver/check_sign_in.py
@@ -45,7 +45,7 @@ def test_sign_in_new_user_helper(self, mozwebqa):
print 'signing in as %s' % email
signin.sign_in_new_user(email, 'password')
mail = restmail.get_mail(restmail_username)
- assert 'Thanks for verifying' in mail[0]['text']
+ assert 'Click to confirm this email address' in mail[0]['text']
@pytest.mark.travis
def test_sign_in_new_user(self, mozwebqa):
@@ -61,10 +61,12 @@ def test_sign_in_new_user(self, mozwebqa):
signin.password = password
signin.verify_password = password
signin.click_verify_email()
+ assert signin.check_email_at_address == email
+
signin.close_window()
signin.switch_to_main_window()
mail = restmail.get_mail(restmail_username)
- assert 'Thanks for verifying' in mail[0]['text']
+ assert 'Click to confirm this email address' in mail[0]['text']
@pytest.mark.travis
def test_sign_in_returning_user(self, mozwebqa):
View
9 tests/webdriver/conftest.py
@@ -4,6 +4,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from selenium.webdriver.support.ui import WebDriverWait
+
def pytest_runtest_setup(item):
item.config.option.api = 'webdriver'
@@ -11,9 +13,8 @@ def pytest_runtest_setup(item):
def pytest_funcarg__mozwebqa(request):
mozwebqa = request.getfuncargvalue('mozwebqa')
- mozwebqa.selenium.implicitly_wait(10)
mozwebqa.selenium.get('%s/' % mozwebqa.base_url)
- mozwebqa.selenium.find_element_by_id('loggedout'). \
- find_element_by_tag_name('button').click()
- mozwebqa.selenium.implicitly_wait(0)
+ WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
+ lambda s: s.find_element_by_css_selector('#loggedout button').is_displayed())
+ mozwebqa.selenium.find_element_by_css_selector('#loggedout button').click()
return mozwebqa

0 comments on commit ad8f309

Please sign in to comment.
Something went wrong with that request. Please try again.