
Regions module should contains basic functionality that should be shared among multiple page objects: common tables, forms, notifications etc.. Basically every piece of code that can be reused by multiple classes in a form of a new object should be placed in here. * I would suggest that already created regions should be moved into this module. * I would consider region everything that can be reused by at least two page objects and aim for maximal code reusability in the future. * Every new region should inherit from class BaseRegion located in baseregion.py. Partially implements blueprint: selenium-integration-testing Change-Id: Ib8c20d8833e0830c85030633091663d33de6e3ab
56 lines
2.3 KiB
Python
56 lines
2.3 KiB
Python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
from selenium.webdriver.common import by
|
|
|
|
from openstack_dashboard.test.integration_tests.pages import accesssecuritypage
|
|
from openstack_dashboard.test.integration_tests.pages import basepage
|
|
from openstack_dashboard.test.integration_tests.pages import settingspage
|
|
from openstack_dashboard.test.integration_tests.regions import forms
|
|
from openstack_dashboard.test.integration_tests.regions import tables
|
|
|
|
|
|
class ProjectPage(basepage.BasePage):
|
|
|
|
_usage_table_locator = (by.By.CSS_SELECTOR, 'table#project_usage')
|
|
_date_form_locator = (by.By.CSS_SELECTOR, 'form#date_form')
|
|
|
|
USAGE_TABLE_ACTIONS = ("download_csv",)
|
|
|
|
def __init__(self, driver, conf):
|
|
super(ProjectPage, self).__init__(driver, conf)
|
|
self._page_title = 'Instance Overview'
|
|
|
|
def go_to_settings_page(self):
|
|
self.topbar.user_dropdown_menu.click()
|
|
self.topbar.settings_link.click()
|
|
return settingspage.SettingsPage(self.driver, self.conf)
|
|
|
|
def go_to_accesssecurity_page(self):
|
|
access_security_locator_flag = self._is_element_visible(
|
|
*self.navaccordion._project_access_security_locator)
|
|
if not access_security_locator_flag:
|
|
self.navaccordion.project_bar.click()
|
|
self.navaccordion.access_security.click()
|
|
return accesssecuritypage.AccessSecurityPage(
|
|
self.driver, self.conf)
|
|
|
|
@property
|
|
def usage_table(self):
|
|
src_elem = self._get_element(*self._usage_table_locator)
|
|
return tables.ActionsTableRegion(self.driver, self.conf, src_elem,
|
|
self.USAGE_TABLE_ACTIONS)
|
|
|
|
@property
|
|
def date_form(self):
|
|
src_elem = self._get_element(*self._date_form_locator)
|
|
return forms.DateFormRegion(self.driver, self.conf, src_elem)
|