"Fossies" - the Fresh Open Source Software Archive

Member "horizon-14.0.4/openstack_dashboard/test/integration_tests/regions/bars.py" (22 Oct 2019, 2309 Bytes) of package /linux/misc/openstack/horizon-14.0.4.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.regions import baseregion
   16 from openstack_dashboard.test.integration_tests.regions import menus
   17 
   18 
   19 class TopBarRegion(baseregion.BaseRegion):
   20     _user_dropdown_menu_locator = (by.By.CSS_SELECTOR,
   21                                    '.nav.navbar-nav.navbar-right')
   22     _openstack_brand_locator = (by.By.CSS_SELECTOR, 'a[href*="/home/"]')
   23 
   24     _user_dropdown_project_locator = (
   25         by.By.CSS_SELECTOR, '.navbar-collapse > ul.navbar-nav:first-child')
   26     _header_locator = (by.By.CSS_SELECTOR, 'nav.navbar-fixed-top')
   27 
   28     MATERIAL_THEME_CLASS = 'material-header'
   29 
   30     @property
   31     def user(self):
   32         return self._get_element(*self._user_dropdown_menu_locator)
   33 
   34     @property
   35     def brand(self):
   36         return self._get_element(*self._openstack_brand_locator)
   37 
   38     @property
   39     def header(self):
   40         return self._get_element(*self._header_locator)
   41 
   42     @property
   43     def is_material_theme_enabled(self):
   44         classes = self.header.get_attribute('class').strip().split()
   45         return self.MATERIAL_THEME_CLASS in classes
   46 
   47     @property
   48     def user_dropdown_menu(self):
   49         src_elem = self._get_element(*self._user_dropdown_menu_locator)
   50         return menus.UserDropDownMenuRegion(self.driver,
   51                                             self.conf, src_elem)
   52 
   53     @property
   54     def is_logged_in(self):
   55         return self._is_element_visible(*self._user_dropdown_menu_locator)
   56 
   57     @property
   58     def user_dropdown_project(self):
   59         src_elem = self._get_element(*self._user_dropdown_project_locator)
   60         return menus.ProjectDropDownRegion(self.driver,
   61                                            self.conf, src_elem)