Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added property and assertions for currently signed in email address.

  • Loading branch information...
commit c02a13a2105c047d7bc770608d5197417e6d8ef7 1 parent 7480912
Dave Hunt authored
6  pages/rc/sign_in.py
@@ -9,6 +9,7 @@
9 9
 
10 10
 class SignIn(Base):
11 11
 
  12
+    _signed_in_email_locator = 'css=label[for=email_0]'
12 13
     _email_locator = 'id=email'
13 14
     _password_locator = 'id=password'
14 15
     _next_locator = 'css=button.start'
@@ -35,6 +36,11 @@ def close_window(self):
35 36
         self.selenium.close()
36 37
 
37 38
     @property
  39
+    def signed_in_email(self):
  40
+        """Get the value of the email that is currently signed in."""
  41
+        return self.selenium.get_text(self._signed_in_email_locator)
  42
+
  43
+    @property
38 44
     def email(self):
39 45
         """Get the value of the email field."""
40 46
         return self.selenium.get_text(self._email_locator)
6  pages/webdriver/sign_in.py
@@ -12,6 +12,7 @@
12 12
 
13 13
 class SignIn(Base):
14 14
 
  15
+    _signed_in_email_locator = (By.CSS_SELECTOR, 'label[for=email_0]')
15 16
     _email_locator = (By.ID, 'email')
16 17
     _password_locator = (By.ID, 'password')
17 18
     _next_locator = (By.CSS_SELECTOR, 'button.start')
@@ -43,6 +44,11 @@ def close_window(self):
43 44
         self.selenium.close()
44 45
 
45 46
     @property
  47
+    def signed_in_email(self):
  48
+        """Get the value of the email that is currently signed in."""
  49
+        return self.selenium.find_element(*self._signed_in_email_locator).text
  50
+
  51
+    @property
46 52
     def email(self):
47 53
         """Get the value of the email field."""
48 54
         return self.selenium.find_element(*self._email_locator).text
11  tests/rc/check_sign_in.py
@@ -73,7 +73,8 @@ def test_sign_in_returning_user_helper(self, mozwebqa):
73 73
         assert mozwebqa.selenium.is_visible(logout_locator)
74 74
 
75 75
     def test_sign_in_returning_user(self, mozwebqa):
76  
-        self.create_verified_user(mozwebqa.selenium, mozwebqa.timeout)
  76
+        (email, password) = self.create_verified_user(mozwebqa.selenium,
  77
+                                                      mozwebqa.timeout)
77 78
         mozwebqa.selenium.open('%s/' % mozwebqa.base_url)
78 79
         login_locator = 'css=#loggedout button'
79 80
         mozwebqa.wait_for_element_visible(mozwebqa, login_locator)
@@ -83,6 +84,7 @@ def test_sign_in_returning_user(self, mozwebqa):
83 84
         signin = SignIn(mozwebqa.selenium,
84 85
                         mozwebqa.timeout,
85 86
                         expect='returning')
  87
+        assert signin.signed_in_email == email
86 88
         signin.click_sign_in_returning_user()
87 89
         logout_locator = 'css=#loggedin a'
88 90
         mozwebqa.wait_for_element_visible(mozwebqa, logout_locator)
@@ -90,12 +92,15 @@ def test_sign_in_returning_user(self, mozwebqa):
90 92
 
91 93
     def create_verified_user(self, selenium, timeout):
92 94
         restmail_username = 'bidpom_%s' % uuid.uuid1()
  95
+        email = '%s@restmail.net' % restmail_username
  96
+        password = 'password'
93 97
         browser_id = BrowserID(selenium, timeout)
94  
-        browser_id.sign_in('%s@restmail.net' % restmail_username)
  98
+        browser_id.sign_in(email)
95 99
         mail = restmail.get_mail(restmail_username)
96 100
         verify_url = re.search(BrowserID.VERIFY_URL_REGEX,
97 101
                                mail[0]['text']).group(0)
98 102
         selenium.open(verify_url)
99 103
         from ...pages.rc.verify_email_address import VerifyEmailAddress
100 104
         verify_email_address = VerifyEmailAddress(selenium, timeout)
101  
-        verify_email_address.verify_email_address('password')
  105
+        verify_email_address.verify_email_address(password)
  106
+        return (email, password)
11  tests/webdriver/check_sign_in.py
@@ -71,7 +71,8 @@ def test_sign_in_returning_user_helper(self, mozwebqa):
71 71
             lambda s: s.find_element_by_id('loggedin').is_displayed())
72 72
 
73 73
     def test_sign_in_returning_user(self, mozwebqa):
74  
-        self.create_verified_user(mozwebqa.selenium, mozwebqa.timeout)
  74
+        (email, password) = self.create_verified_user(mozwebqa.selenium,
  75
+                                                      mozwebqa.timeout)
75 76
         mozwebqa.selenium.get('%s/' % mozwebqa.base_url)
76 77
         WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
77 78
             lambda s: s.find_element_by_id('loggedout').is_displayed())
@@ -82,18 +83,22 @@ def test_sign_in_returning_user(self, mozwebqa):
82 83
         signin = SignIn(mozwebqa.selenium,
83 84
                         mozwebqa.timeout,
84 85
                         expect='returning')
  86
+        assert signin.signed_in_email == email
85 87
         signin.click_sign_in_returning_user()
86 88
         WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
87 89
             lambda s: s.find_element_by_id('loggedin').is_displayed())
88 90
 
89 91
     def create_verified_user(self, selenium, timeout):
90 92
         restmail_username = 'bidpom_%s' % uuid.uuid1()
  93
+        email = '%s@restmail.net' % restmail_username
  94
+        password = 'password'
91 95
         browser_id = BrowserID(selenium, timeout)
92  
-        browser_id.sign_in('%s@restmail.net' % restmail_username)
  96
+        browser_id.sign_in(email)
93 97
         mail = restmail.get_mail(restmail_username)
94 98
         verify_url = re.search(BrowserID.VERIFY_URL_REGEX,
95 99
                                mail[0]['text']).group(0)
96 100
         selenium.get(verify_url)
97 101
         from ...pages.webdriver.verify_email_address import VerifyEmailAddress
98 102
         verify_email_address = VerifyEmailAddress(selenium, timeout)
99  
-        verify_email_address.verify_email_address('password')
  103
+        verify_email_address.verify_email_address(password)
  104
+        return (email, password)

0 notes on commit c02a13a

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