Merge pull request #168 from m8ttyB/vouch_refactor

update test to work with vouch refactor + some cleanup
This commit is contained in:
AndreiH 2014-07-23 18:04:59 +03:00
Родитель f9c7b8f162 284b9b92e9
Коммит 56697b36d9
3 изменённых файлов: 13 добавлений и 11 удалений

Просмотреть файл

@ -13,6 +13,7 @@ from pages.base import Base
class Invite(Base):
_recipient_field_locator = (By.ID, 'id_recipient')
_vouch_reason_field_locator = (By.ID, 'id_description')
_send_invite_button_locator = (By.CSS_SELECTOR, '#main button')
_error_text_locator = (By.CSS_SELECTOR, '.error-message')
@ -20,9 +21,11 @@ class Invite(Base):
def error_text_message(self):
return self.selenium.find_element(*self._error_text_locator).text
def invite(self, email):
input_field = self.selenium.find_element(*self._recipient_field_locator)
input_field.send_keys(email)
def invite(self, email, reason=''):
email_field = self.selenium.find_element(*self._recipient_field_locator)
email_field.send_keys(email)
reason_field = self.selenium.find_element(*self._vouch_reason_field_locator)
reason_field.send_keys(reason)
self.selenium.find_element(*self._send_invite_button_locator).click()
from pages.invite_success import InviteSuccess
return InviteSuccess(self.testsetup)

Просмотреть файл

@ -25,7 +25,7 @@ class TestInvite:
home_page = Home(mozwebqa)
home_page.login()
invite_page = home_page.header.click_invite_menu_item()
mail_address = "validuser@example.com"
invite_success_page = invite_page.invite(mail_address)
email_address = "user@example.com"
invite_success_page = invite_page.invite(email_address, 'Just a bot sending a test invite to a test account.')
Assert.equal("%s has been invited to Mozillians. They'll receive an email with instructions on how to join.\
You can invite another Mozillian if you like." % mail_address, invite_success_page.success_message)
You can invite another Mozillian if you like." % email_address, invite_success_page.success_message)

Просмотреть файл

@ -324,13 +324,12 @@ class TestProfile(BaseTest):
@pytest.mark.credentials
@pytest.mark.nondestructive
def test_private_groups_field_as_public_when_logged_in(self, mozwebqa):
home_page = Home(mozwebqa)
# User has certain fields preset to values to run the test properly
# groups - private
# belongs to at least one group
credentials = mozwebqa.credentials['vouched_with_private_fields']
home_page = Home(mozwebqa)
home_page.login('vouched_with_private_fields')
profile_page = home_page.header.click_view_profile_menu_item()
profile_page.view_profile_as('Public')