"Fossies" - the Fresh Open Source Software Archive

Member "horizon-16.0.0/openstack_dashboard/test/integration_tests/pages/basepage.py" (16 Oct 2019, 2546 Bytes) of package /linux/misc/openstack/horizon-16.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    2 #    not use this file except in compliance with the License. You may obtain
    3 #    a copy of the License at
    4 #
    5 #         http://www.apache.org/licenses/LICENSE-2.0
    6 #
    7 #    Unless required by applicable law or agreed to in writing, software
    8 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    9 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   10 #    License for the specific language governing permissions and limitations
   11 #    under the License.
   12 
   13 from selenium.webdriver.common import by
   14 
   15 from openstack_dashboard.test.integration_tests.pages import navigation
   16 from openstack_dashboard.test.integration_tests.pages import pageobject
   17 from openstack_dashboard.test.integration_tests.regions import bars
   18 from openstack_dashboard.test.integration_tests.regions import menus
   19 from openstack_dashboard.test.integration_tests.regions import messages
   20 
   21 
   22 class BasePage(pageobject.PageObject):
   23     """Base class for all dashboard page objects."""
   24 
   25     _heading_locator = (by.By.CSS_SELECTOR, 'div.page-header > h2')
   26     _help_page_brand = (by.By.CSS_SELECTOR, '.navbar-brand')
   27 
   28     @property
   29     def heading(self):
   30         return self._get_element(*self._heading_locator)
   31 
   32     @property
   33     def topbar(self):
   34         return bars.TopBarRegion(self.driver, self.conf)
   35 
   36     @property
   37     def is_logged_in(self):
   38         return self.topbar.is_logged_in
   39 
   40     @property
   41     def navaccordion(self):
   42         return menus.NavigationAccordionRegion(self.driver, self.conf)
   43 
   44     def go_to_login_page(self):
   45         self.driver.get(self.login_url)
   46 
   47     def go_to_home_page(self):
   48         self.topbar.brand.click()
   49 
   50     def log_out(self):
   51         self.topbar.user_dropdown_menu.click_on_logout()
   52 
   53     def go_to_help_page(self):
   54         self.topbar.user_dropdown_menu.click_on_help()
   55 
   56     def is_help_page(self):
   57         self._wait_till_element_visible(self._help_page_brand)
   58 
   59     def choose_theme(self, theme_name):
   60         self.topbar.user_dropdown_menu.choose_theme(theme_name)
   61 
   62     def find_message_and_dismiss(self, message_level=messages.SUCCESS):
   63         message = messages.MessageRegion(self.driver, self.conf, message_level)
   64         is_message_present = message.exists()
   65         if is_message_present:
   66             message.close()
   67         return is_message_present
   68 
   69     def change_project(self, name):
   70         self.topbar.user_dropdown_project.click_on_project(name)
   71 
   72 
   73 class BaseNavigationPage(BasePage, navigation.Navigation):
   74     pass