From bee35b5f42cec86d04a88202b438c43d7599c7c6 Mon Sep 17 00:00:00 2001 From: Sergei Chipiga Date: Mon, 25 Apr 2016 13:31:01 +0300 Subject: [PATCH] Wait for user menu items to become visible before clicking them Change-Id: I312e63eafa7a92ce05028de3505f37547a0bc139 Closes-Bug: #1574734 --- openstack_dashboard/test/integration_tests/basewebobject.py | 5 ++--- openstack_dashboard/test/integration_tests/regions/menus.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/test/integration_tests/basewebobject.py b/openstack_dashboard/test/integration_tests/basewebobject.py index afe2507a36..a0036d477a 100644 --- a/openstack_dashboard/test/integration_tests/basewebobject.py +++ b/openstack_dashboard/test/integration_tests/basewebobject.py @@ -124,9 +124,8 @@ class BaseWebObject(unittest.TestCase): return self._wait_until(predicate, timeout) - def _wait_till_element_visible(self, element, timeout=None): - self._wait_until(lambda x: self._is_element_displayed(element), - timeout) + def _wait_till_element_visible(self, locator, timeout=None): + self._wait_until(lambda x: self._is_element_visible(*locator), timeout) def _wait_till_element_disappears(self, element, timeout=None): self._wait_until(lambda x: not self._is_element_displayed(element), diff --git a/openstack_dashboard/test/integration_tests/regions/menus.py b/openstack_dashboard/test/integration_tests/regions/menus.py index 1dd0746fd1..cb8e0e6a23 100644 --- a/openstack_dashboard/test/integration_tests/regions/menus.py +++ b/openstack_dashboard/test/integration_tests/regions/menus.py @@ -179,6 +179,7 @@ class NavigationAccordionRegion(baseregion.BaseRegion): class DropDownMenuRegion(baseregion.BaseRegion): """Drop down menu region.""" + _menu_container_locator = (by.By.CSS_SELECTOR, 'ul.dropdown-menu') _menu_items_locator = (by.By.CSS_SELECTOR, 'ul.dropdown-menu > li > *') _menu_first_child_locator = (by.By.CSS_SELECTOR, @@ -198,6 +199,7 @@ class DropDownMenuRegion(baseregion.BaseRegion): """Opens menu by clicking on the first child of the source element.""" if self.is_open() is False: self._get_element(*self._menu_first_child_locator).click() + self._wait_till_element_visible(self._menu_container_locator) class UserDropDownMenuRegion(DropDownMenuRegion):