Skip to content
Snippets Groups Projects
Commit db54ae09 authored by Jared Hirsch's avatar Jared Hirsch
Browse files

Squashed 'automation-tests/browserid/' changes from f4063ba..4c10bb2

4c10bb2 Merge pull request #42 from zacc/add_is_this_your_computer
a490f28 Add methods and test for 'is this your computer'

git-subtree-dir: automation-tests/browserid
git-subtree-split: 4c10bb2b2c46b6b56d224f52945b55c4e1c256f1
parent 84425b83
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,9 @@ class SignIn(Base):
_add_another_email_locator = (By.ID, 'useNewEmail')
_new_email_locator = (By.ID, 'newEmail')
_add_new_email_locator = (By.ID, 'addNewEmail')
_your_computer_content_locator = (By.ID, 'your_computer_content')
_this_is_my_computer_locator = (By.ID, 'this_is_my_computer')
_this_is_not_my_computer_locator = (By.ID, 'this_is_not_my_computer')
def __init__(self, selenium, timeout, expect='new'):
Base.__init__(self, selenium, timeout)
......@@ -161,11 +164,19 @@ class SignIn(Base):
self.selenium.find_element(*self._sign_in_locator).click()
self.switch_to_main_window()
def click_sign_in_returning_user(self):
def click_sign_in_returning_user(self, expect='login'):
"""Clicks the 'sign in' button."""
self.selenium.find_element(
*self._sign_in_returning_user_locator).click()
self.switch_to_main_window()
if expect == 'login':
self.switch_to_main_window()
elif expect == 'remember':
WebDriverWait(self.selenium, self.timeout).until(
lambda s: s.find_element(
*self._your_computer_content_locator).is_displayed())
else:
raise Exception('Unknown expect value: %s' % expect)
def click_verify_email(self):
"""Clicks 'verify email' button."""
......@@ -202,6 +213,16 @@ class SignIn(Base):
lambda s: s.find_element(
*self._check_email_at_locator).is_displayed())
def click_i_trust_this_computer(self):
"""Clicks 'I trust this computer' and signs in """
self.selenium.find_element(*self._this_is_my_computer_locator).click()
self.switch_to_main_window()
def click_this_is_not_my_computer(self):
"""Clicks 'I trust this computer' and signs in for a public computer"""
self.selenium.find_element(*self._this_is_not_my_computer_locator).click()
self.switch_to_main_window()
def sign_in(self, email, password):
"""Signs in using the specified email address and password."""
self.email = email
......
......@@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
import time
from selenium.webdriver.support.ui import WebDriverWait
from .. import BrowserID
......@@ -72,3 +73,27 @@ class TestSignIn(BaseTest):
mozwebqa.selenium.get('%s/' % mozwebqa.base_url)
WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
lambda s: s.find_element_by_id('loggedin').is_displayed())
def test_sign_in_is_this_your_computer(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_by_id('loggedin').is_displayed())
login_time = time.time()
self.log_out(mozwebqa.selenium, mozwebqa.timeout)
while time.time() < (login_time + 60):
time.sleep(15)
mozwebqa.selenium.find_element_by_css_selector('#loggedout button')
mozwebqa.selenium.find_element_by_css_selector('#loggedout button').click()
from .. pages.sign_in import SignIn
signin = SignIn(mozwebqa.selenium, mozwebqa.timeout, expect='returning')
signin.click_sign_in_returning_user(expect='remember')
signin.click_i_trust_this_computer()
WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
lambda s: s.find_element_by_id('loggedin').is_displayed())
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