Add go_to_home_page method and two more properties
I added the brand property which is used by the go_to_home_page method. This method will generally be used for tests. In particular, it will be part of the TestCase class, which is planned to be the base class for all tests (on top of helpers's BaseTestCase class), except login tests. In addition, I modified the css selector in the _user_indicator_locator and made the user property from it. https://wiki.openstack.org/wiki/Horizon/Testing/UI Partially implements blueprint: selenium-integration-testing Change-Id: Ic614c6a37ea04aeccf1a06312f4bcd20e5fe2c76
This commit is contained in:
parent
b9467671e2
commit
52f60355cf
@ -18,31 +18,45 @@ from openstack_dashboard.test.integration_tests.pages import pageobject
|
||||
class BasePage(pageobject.PageObject):
|
||||
"""Base class for all dashboard page objects."""
|
||||
@property
|
||||
def top_bar(self):
|
||||
def topbar(self):
|
||||
return BasePage.TopBarRegion(self.driver, self.conf)
|
||||
|
||||
@property
|
||||
def is_logged_in(self):
|
||||
return self.top_bar.is_logged_in
|
||||
return self.topbar.is_logged_in
|
||||
|
||||
def go_to_login_page(self):
|
||||
self.driver.get(self.login_url)
|
||||
|
||||
def go_to_home_page(self):
|
||||
self.topbar.brand.click()
|
||||
|
||||
def log_out(self):
|
||||
self.top_bar.logout_link.click()
|
||||
self.topbar.logout_link.click()
|
||||
return self.go_to_login_page()
|
||||
|
||||
class TopBarRegion(pageobject.PageObject):
|
||||
_user_indicator_locator = (by.By.CSS_SELECTOR, "#user_info")
|
||||
_user_indicator_locator = (by.By.CSS_SELECTOR,
|
||||
'#profile_editor_switcher > '
|
||||
'a.dropdown-toggle > div')
|
||||
_user_dropdown_menu_locator = (by.By.CSS_SELECTOR,
|
||||
"#profile_editor_switcher >"
|
||||
" a.dropdown-toggle")
|
||||
'#profile_editor_switcher >'
|
||||
' a.dropdown-toggle')
|
||||
_settings_link_locator = (by.By.CSS_SELECTOR,
|
||||
"a[href*='/settings/']")
|
||||
'a[href*="/settings/"]')
|
||||
_help_link_locator = (by.By.CSS_SELECTOR,
|
||||
"ul#editor_list li:nth-of-type(3) > a")
|
||||
'ul#editor_list li:nth-of-type(3) > a')
|
||||
_logout_link_locator = (by.By.CSS_SELECTOR,
|
||||
"a[href*='/auth/logout/']")
|
||||
'a[href*="/auth/logout/"]')
|
||||
_openstack_brand_locator = (by.By.CSS_SELECTOR, 'a[href*="/home/"]')
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
return self.get_element(*self._user_indicator_locator)
|
||||
|
||||
@property
|
||||
def brand(self):
|
||||
return self.get_element(*self._openstack_brand_locator)
|
||||
|
||||
@property
|
||||
def logout_link(self):
|
||||
|
Loading…
Reference in New Issue
Block a user