Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
fix getters
Browse files Browse the repository at this point in the history
* change getters from .text to .get_attribute('value')
* add tests for getters
* change test class names to match file names
* add some notes about running the tests to README
  • Loading branch information
klrmn committed Aug 17, 2012
1 parent 4c10bb2 commit cbc4fe0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -6,6 +6,12 @@ Documentation
-------------
See the project's [wiki](https://github.com/mozilla/bidpom/wiki).

Running BIDPOM's Tests
----------------------
* two tests in check_sign_in.py require --email and --password flags. they can be skipped by using the "-m travis" flag
* if running against a remote selenium server, add --capabilities={"avoid-proxy":true} to the command line
* if experiencing TimeoutErrors from WebDriverWait, add the --webqatimeout=90 to the command line

License
-------
This software is licensed under the [MPL](http://www.mozilla.org/MPL/2.0/) 2.0:
Expand Down
4 changes: 2 additions & 2 deletions pages/account_manager.py
Expand Up @@ -43,7 +43,7 @@ def click_edit_password(self):
@property
def old_password(self):
"""Get the value of the old password field."""
return self.selenium.find_element(*self._old_password_field_locator).text
return self.selenium.find_element(*self._old_password_field_locator).get_attribute('value')

@old_password.setter
def old_password(self, value):
Expand All @@ -55,7 +55,7 @@ def old_password(self, value):
@property
def new_password(self):
"""Get the value of the new password field."""
return self.selenium.find_element(*self._new_password_field_locator).text
return self.selenium.find_element(*self._new_password_field_locator).get_attribute('value')

@new_password.setter
def new_password(self, value):
Expand Down
10 changes: 5 additions & 5 deletions pages/sign_in.py
Expand Up @@ -62,7 +62,7 @@ def close_window(self):
@property
def signed_in_email(self):
"""Get the value of the email that is currently signed in."""
return self.selenium.find_element(*self._signed_in_email_locator).text
return self.selenium.find_element(*self._signed_in_email_locator).get_attribute('value')

def click_this_is_not_me(self):
"""Clicks the 'This is not me' button."""
Expand All @@ -79,7 +79,7 @@ def emails(self):
@property
def email(self):
"""Get the value of the email field."""
return self.selenium.find_element(*self._email_locator).text
return self.selenium.find_element(*self._email_locator).get_attribute('value')

@email.setter
def email(self, value):
Expand All @@ -91,7 +91,7 @@ def email(self, value):
@property
def new_email(self):
"""Get the value of the new email field."""
return self.selenium.find_element(*self._new_email_locator).text
return self.selenium.find_element(*self._new_email_locator).get_attribute('value')

@new_email.setter
def new_email(self, value):
Expand Down Expand Up @@ -119,7 +119,7 @@ def select_email(self, value):
@property
def password(self):
"""Get the value of the password field."""
return self.selenium.find_element(*self._password_locator).text
return self.selenium.find_element(*self._password_locator).get_attribute('value')

@password.setter
def password(self, value):
Expand All @@ -131,7 +131,7 @@ def password(self, value):
@property
def verify_password(self):
"""Get the value of the verify password field."""
return self.selenium.find_element(*self._verify_password_locator).text
return self.selenium.find_element(*self._verify_password_locator).get_attribute('value')

@verify_password.setter
def verify_password(self, value):
Expand Down
3 changes: 2 additions & 1 deletion tests/check_add_email.py
Expand Up @@ -14,7 +14,7 @@


@pytest.mark.nondestructive
class TestSignIn(BaseTest):
class TestAddEmail(BaseTest):

@pytest.mark.travis
def test_add_email(self, mozwebqa):
Expand All @@ -29,6 +29,7 @@ def test_add_email(self, mozwebqa):
signin = SignIn(mozwebqa.selenium, mozwebqa.timeout, expect='returning')
signin.click_add_another_email_address()
signin.new_email = user.additional_emails[0]
assert signin.new_email == user.additional_emails[0], "new email getter failed"
signin.click_add_new_email()
signin.close_window()
signin.switch_to_main_window()
Expand Down
4 changes: 3 additions & 1 deletion tests/check_change_password.py
Expand Up @@ -12,7 +12,7 @@


@pytest.mark.nondestructive
class TestSignIn(BaseTest):
class TestChangePassword(BaseTest):

@pytest.mark.travis
def test_change_password(self, mozwebqa):
Expand All @@ -26,8 +26,10 @@ def test_change_password(self, mozwebqa):

account_manager.click_edit_password()
account_manager.old_password = user.password
assert account_manager.old_password == user.password, "old password getter failed"
user.password += '_new'
account_manager.new_password = user.password
assert account_manager.new_password == user.password, "new password getter failed"
account_manager.click_password_done()
account_manager.click_sign_out()

Expand Down
2 changes: 1 addition & 1 deletion tests/check_reset_password.py
Expand Up @@ -14,7 +14,7 @@


@pytest.mark.nondestructive
class TestSignIn(BaseTest):
class TestResetPassword(BaseTest):

@pytest.mark.travis
def test_reset_password(self, mozwebqa):
Expand Down
3 changes: 3 additions & 0 deletions tests/check_sign_in.py
Expand Up @@ -28,8 +28,10 @@ def test_sign_in(self, mozwebqa):
from .. pages.sign_in import SignIn
signin = SignIn(mozwebqa.selenium, mozwebqa.timeout, expect='new')
signin.email = mozwebqa.email
assert signin.email == mozwebqa.email, "email getter failed"
signin.click_next(expect='password')
signin.password = mozwebqa.password
assert signin.password == mozwebqa.password, "password getter failed"
signin.click_sign_in()

WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until(
Expand All @@ -55,6 +57,7 @@ def test_sign_in_new_user(self, mozwebqa):
signin.click_next(expect='verify')
signin.password = user.password
signin.verify_password = user.password
assert signin.verify_password == user.password, 'verify password getter failed'
signin.click_verify_email()
assert signin.check_email_at_address == user.primary_email

Expand Down

0 comments on commit cbc4fe0

Please sign in to comment.