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:
Rodion Promyshlennikov
2016-10-07 18:10:46 +03:00
parent 893b85353c
commit e98cd6f5e2
4 changed files with 19 additions and 16 deletions

View File

@@ -25,7 +25,6 @@ class ElasticsearchPluginApi(base_test.PluginApi):
def __init__(self): def __init__(self):
super(ElasticsearchPluginApi, self).__init__() super(ElasticsearchPluginApi, self).__init__()
self._es_client = None self._es_client = None
self._kibana_port = None
self._kibana_protocol = None self._kibana_protocol = None
@property @property
@@ -36,18 +35,17 @@ class ElasticsearchPluginApi(base_test.PluginApi):
return self._es_client return self._es_client
def kibana_port(self, admin_role=True): def kibana_port(self, admin_role=True):
if self._kibana_port is None: if admin_role:
if admin_role: if self.kibana_protocol == 'http':
if self.kibana_protocol == 'http': _kibana_port = 80
self._kibana_port = 80
else:
self._kibana_port = 443
else: else:
if self.kibana_protocol == 'http': _kibana_port = 443
self._kibana_port = 8000 else:
else: if self.kibana_protocol == 'http':
self._kibana_port = 8443 _kibana_port = 8000
return self._kibana_port else:
_kibana_port = 8443
return _kibana_port
@property @property
def kibana_protocol(self): def kibana_protocol(self):

View File

@@ -13,6 +13,8 @@
# under the License. # under the License.
from selenium.common import exceptions from selenium.common import exceptions
from selenium.webdriver.common import by 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 from stacklight_tests.helpers.ui import base_pages
@@ -32,7 +34,6 @@ class MainPage(base_pages.PageObject):
self._page_title = "Logs - Dashboard - Kibana" self._page_title = "Logs - Dashboard - Kibana"
def is_main_page(self): def is_main_page(self):
# TODO(rpromyshlennikov): fix unresolved attribute ._main_menu_locator
return (self.is_the_current_page() and return (self.is_the_current_page() and
self._is_element_visible(*self._main_menu_locator)) 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._save_button_locator).click()
self._get_element(*self._submit_button_locator).click() self._get_element(*self._submit_button_locator).click()
try: try:
ui.WebDriverWait(self.driver, 10).until(
ec.alert_is_present(),
"Timed out waiting of confirmation alert")
self.driver.switch_to.alert.accept() self.driver.switch_to.alert.accept()
except exceptions.NoAlertPresentException: except (exceptions.NoAlertPresentException,
exceptions.TimeoutException):
pass pass
return self._get_element(*self._error_field_locator).text return self._get_element(*self._error_field_locator).text

View File

@@ -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 # Set the amount of time to wait for a page load to complete
# before throwing an error. # before throwing an error.
page_timeout = os.environ.get('PAGE_TIMEOUT', 25) page_timeout = os.environ.get('PAGE_TIMEOUT', 15)

View File

@@ -59,7 +59,7 @@ def check_grafana_dashboards(url):
def _check_available_menu_items_for_user(user, url, authz, is_admin=False): def _check_available_menu_items_for_user(user, url, authz, is_admin=False):
logger.info("Checking Grafana service at {} with LDAP authorization " logger.info("Checking Grafana service at {} with LDAP authorization "
"for {} user".format(url, user[0])) "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 viewer_panel = admin_panels[:1] if authz else admin_panels
expected_panels = admin_panels if is_admin else viewer_panel expected_panels = admin_panels if is_admin else viewer_panel