fixed test_that_user_can_login_and_logout
This commit is contained in:
Родитель
f91477ec3e
Коммит
28918e8e44
|
@ -21,6 +21,7 @@
|
|||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Bebe
|
||||
# Jonny Gerig Meyer <jonny@oddbird.net>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -41,10 +42,8 @@ from page import Page
|
|||
|
||||
class CaseConductorBasePage(Page):
|
||||
|
||||
_user_name_locator = "css=.meta>ul>li"
|
||||
_logout_locator = "css=.meta>ul>li>a"
|
||||
|
||||
|
||||
_user_name_locator = 'css=#accountnav .account-welcome .fn'
|
||||
_logout_locator = 'css=#accountnav .account-links .signout'
|
||||
|
||||
@property
|
||||
def is_user_logged_in(self):
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#
|
||||
# Example:
|
||||
# admin:
|
||||
# email: email@site.com
|
||||
# username: username
|
||||
# password: password
|
||||
# name: Test User
|
||||
#
|
||||
|
@ -53,19 +53,19 @@
|
|||
#
|
||||
# Example:
|
||||
# admin:
|
||||
# email: email@site.com
|
||||
# username: username
|
||||
# password: password
|
||||
# name: Test User
|
||||
# username: testuser
|
||||
# email: email@site.com
|
||||
# some_user_data: data
|
||||
#
|
||||
# The contents of this file are accessible via the pytest-mozwebqa plugin:
|
||||
#
|
||||
# Example:
|
||||
# credentials = mozwebqa.credentials['default']
|
||||
# credentials['email']
|
||||
# credentials['username']
|
||||
|
||||
default:
|
||||
email: <value>
|
||||
username: <value>
|
||||
password: <value>
|
||||
name: <value>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Bebe
|
||||
# Jonny Gerig Meyer <jonny@oddbird.net>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -41,21 +42,18 @@ from base_page import CaseConductorBasePage
|
|||
|
||||
class CaseConductorLoginPage(CaseConductorBasePage):
|
||||
|
||||
_page_title = "Mozilla Case Conductor"
|
||||
_page_title = 'Mozilla Case Conductor'
|
||||
|
||||
_signin_locator = "css=nav.meta>ul>li>a:nth(0)"
|
||||
_register_locator = "css=nav.meta>ul>li>a:nth(1)"
|
||||
_account_locator = "css=nav.meta>ul"
|
||||
_username_locator = 'id=id_username'
|
||||
_password_locator = 'id=id_password'
|
||||
_submit_locator = 'css=#loginform .form-actions > button'
|
||||
_register_locator = 'css=#loginform .form-actions > a'
|
||||
|
||||
_email_locator = "id=id_email"
|
||||
_password_locator = "id=id_password"
|
||||
_submit_locator = "css=div.form-actions>button"
|
||||
|
||||
def login(self, user="default"):
|
||||
def login(self, user='default'):
|
||||
if type(user) is str:
|
||||
user = self.testsetup.credentials[user]
|
||||
|
||||
self.type(self._email_locator, user['email'])
|
||||
self.type(self._username_locator, user['username'])
|
||||
self.type(self._password_locator, user['password'])
|
||||
self.click(self._submit_locator, True)
|
||||
from home_page import CaseConductorHomePage
|
||||
|
@ -67,8 +65,4 @@ class CaseConductorLoginPage(CaseConductorBasePage):
|
|||
|
||||
@property
|
||||
def is_signin_visible(self):
|
||||
return self.is_element_visible(self._signin_locator)
|
||||
|
||||
@property
|
||||
def account_text(self):
|
||||
return self.get_text(self._account_locator)
|
||||
return self.is_element_visible(self._submit_locator)
|
||||
|
|
|
@ -50,16 +50,13 @@ class TestHomepage(BaseTest):
|
|||
user = home_pg.testsetup.credentials['default']
|
||||
home_pg.go_to_homepage_page()
|
||||
|
||||
# TODO: uncomment when the id's are added
|
||||
#Assert.false(home_pg.is_user_logged_in)
|
||||
|
||||
Assert.true(home_pg.is_user_logged_in)
|
||||
welcome_text = u'Welcome %s [Sign Out]' % user['name']
|
||||
Assert.equal(home_pg.users_name_text, welcome_text)
|
||||
users_name_text = user['name']
|
||||
Assert.equal(home_pg.users_name_text, users_name_text)
|
||||
|
||||
login_page = home_pg.logout()
|
||||
|
||||
#Assert.false(home_pg.is_user_logged_in)
|
||||
Assert.false(home_pg.is_user_logged_in)
|
||||
Assert.true(login_page.is_register_visible)
|
||||
Assert.true(login_page.is_signin_visible)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче