Fix kibana ui bugs
Fix bug with page timeout on ldap with autz for non-admin user: incorrect port was being returned. Fix bug with unexpected alarm: added awaiting of alarm. Reverted page_timeout value, because it is not reason of first bug mentioned. Removed "Admin" panel from dashboards list in ldap tests: it is not presented by design. Change-Id: Iedcd1222d90a14af6e639afecc6fffac12d0d0b2 Closes-Bug: #1621414 Closes-Bug: #1626039
This commit is contained in:
		@@ -25,7 +25,6 @@ class ElasticsearchPluginApi(base_test.PluginApi):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        super(ElasticsearchPluginApi, self).__init__()
 | 
			
		||||
        self._es_client = None
 | 
			
		||||
        self._kibana_port = None
 | 
			
		||||
        self._kibana_protocol = None
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
@@ -36,18 +35,17 @@ class ElasticsearchPluginApi(base_test.PluginApi):
 | 
			
		||||
        return self._es_client
 | 
			
		||||
 | 
			
		||||
    def kibana_port(self, admin_role=True):
 | 
			
		||||
        if self._kibana_port is None:
 | 
			
		||||
            if admin_role:
 | 
			
		||||
                if self.kibana_protocol == 'http':
 | 
			
		||||
                    self._kibana_port = 80
 | 
			
		||||
                else:
 | 
			
		||||
                    self._kibana_port = 443
 | 
			
		||||
        if admin_role:
 | 
			
		||||
            if self.kibana_protocol == 'http':
 | 
			
		||||
                _kibana_port = 80
 | 
			
		||||
            else:
 | 
			
		||||
                if self.kibana_protocol == 'http':
 | 
			
		||||
                    self._kibana_port = 8000
 | 
			
		||||
                else:
 | 
			
		||||
                    self._kibana_port = 8443
 | 
			
		||||
        return self._kibana_port
 | 
			
		||||
                _kibana_port = 443
 | 
			
		||||
        else:
 | 
			
		||||
            if self.kibana_protocol == 'http':
 | 
			
		||||
                _kibana_port = 8000
 | 
			
		||||
            else:
 | 
			
		||||
                _kibana_port = 8443
 | 
			
		||||
        return _kibana_port
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def kibana_protocol(self):
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,8 @@
 | 
			
		||||
#    under the License.
 | 
			
		||||
from selenium.common import exceptions
 | 
			
		||||
from selenium.webdriver.common import by
 | 
			
		||||
from selenium.webdriver.support import expected_conditions as ec
 | 
			
		||||
from selenium.webdriver.support import ui
 | 
			
		||||
 | 
			
		||||
from stacklight_tests.helpers.ui import base_pages
 | 
			
		||||
 | 
			
		||||
@@ -32,7 +34,6 @@ class MainPage(base_pages.PageObject):
 | 
			
		||||
        self._page_title = "Logs - Dashboard - Kibana"
 | 
			
		||||
 | 
			
		||||
    def is_main_page(self):
 | 
			
		||||
        # TODO(rpromyshlennikov): fix unresolved attribute ._main_menu_locator
 | 
			
		||||
        return (self.is_the_current_page() and
 | 
			
		||||
                self._is_element_visible(*self._main_menu_locator))
 | 
			
		||||
 | 
			
		||||
@@ -40,7 +41,11 @@ class MainPage(base_pages.PageObject):
 | 
			
		||||
        self._get_element(*self._save_button_locator).click()
 | 
			
		||||
        self._get_element(*self._submit_button_locator).click()
 | 
			
		||||
        try:
 | 
			
		||||
            ui.WebDriverWait(self.driver, 10).until(
 | 
			
		||||
                ec.alert_is_present(),
 | 
			
		||||
                "Timed out waiting of confirmation alert")
 | 
			
		||||
            self.driver.switch_to.alert.accept()
 | 
			
		||||
        except exceptions.NoAlertPresentException:
 | 
			
		||||
        except (exceptions.NoAlertPresentException,
 | 
			
		||||
                exceptions.TimeoutException):
 | 
			
		||||
            pass
 | 
			
		||||
        return self._get_element(*self._error_field_locator).text
 | 
			
		||||
 
 | 
			
		||||
@@ -32,4 +32,4 @@ implicit_wait = os.environ.get('IMPLICIT_WAIT', 5)
 | 
			
		||||
 | 
			
		||||
# Set the amount of time to wait for a page load to complete
 | 
			
		||||
# before throwing an error.
 | 
			
		||||
page_timeout = os.environ.get('PAGE_TIMEOUT', 25)
 | 
			
		||||
page_timeout = os.environ.get('PAGE_TIMEOUT', 15)
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ def check_grafana_dashboards(url):
 | 
			
		||||
def _check_available_menu_items_for_user(user, url, authz, is_admin=False):
 | 
			
		||||
    logger.info("Checking Grafana service at {} with LDAP authorization "
 | 
			
		||||
                "for {} user".format(url, user[0]))
 | 
			
		||||
    admin_panels = ["Dashboards", "Data Sources", "Plugins", "Admin"]
 | 
			
		||||
    admin_panels = ["Dashboards", "Data Sources", "Plugins"]
 | 
			
		||||
    viewer_panel = admin_panels[:1] if authz else admin_panels
 | 
			
		||||
    expected_panels = admin_panels if is_admin else viewer_panel
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user