summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Jasek <jasekjan96@gmail.com>2022-10-17 14:05:00 +0200
committerJan Jasek <jjasek@redhat.com>2023-04-24 06:21:00 +0000
commit85b6de393a85cfd8108f68007d00dbdec0e0fba4 (patch)
tree800b5190f669e99495b7c371eef5a7e9b03fad25
parent07343c853af4e9b74fe11faaa2bbc1a8c1e62b78 (diff)
downloadhorizon-85b6de393a85cfd8108f68007d00dbdec0e0fba4.tar.gz
Fix delete image tests.
Add wait until checkbox is in active state. Fix edit_image_description_and_name test. Add wait until the name text box is filled by default name (is not empty). In the other case selenium write new name into text box faster than default name is written there so default name then rewrite the new name. Change-Id: I56803e19dd80180cc432ca872a28a7ee7f41290d (cherry picked from commit 01c4ab920d82ed7e84dab84d9c925cd476902f1e)
-rw-r--r--openstack_dashboard/test/integration_tests/basewebobject.py7
-rw-r--r--openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py11
2 files changed, 18 insertions, 0 deletions
diff --git a/openstack_dashboard/test/integration_tests/basewebobject.py b/openstack_dashboard/test/integration_tests/basewebobject.py
index aae87e910..f4207b0ce 100644
--- a/openstack_dashboard/test/integration_tests/basewebobject.py
+++ b/openstack_dashboard/test/integration_tests/basewebobject.py
@@ -152,6 +152,13 @@ class BaseWebObject(unittest.TestCase):
# it will raise the NoSuchElementException exception.
pass
+ def wait_until_element_is_visible(self, locator):
+ with self.waits_disabled():
+ try:
+ self._wait_till_element_visible(locator)
+ except Exceptions.NoSuchElementException:
+ pass
+
def wait_till_spinner_disappears(self):
def getter():
return self.driver.find_element(*self._spinner_locator)
diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py
index 117c64b5c..0c61bfcea 100644
--- a/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py
+++ b/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py
@@ -117,6 +117,14 @@ class ImagesPage(basepage.BaseNavigationPage):
'hz-magic-search-bar span.fa-search')
_search_option_locator = (by.By.CSS_SELECTOR,
'magic-search.form-control span.search-entry')
+ _search_name_locator_filled = (
+ by.By.XPATH,
+ "//*[@id='imageForm-name'][contains(@class,'ng-not-empty')]"
+ )
+ _search_checkbox_loaded = (
+ by.By.CSS_SELECTOR,
+ "td .themable-checkbox [type='checkbox'] + label[for*='Zactive']"
+ )
def __init__(self, driver, conf):
super().__init__(driver, conf)
@@ -134,6 +142,8 @@ class ImagesPage(basepage.BaseNavigationPage):
return self._get_element(*self._default_form_locator)
def _get_row_with_image_name(self, name):
+ self.wait_until_element_is_visible(self._search_checkbox_loaded)
+
return self.images_table.get_row(IMAGES_TABLE_NAME_COLUMN, name)
def create_image(self, name, description=None,
@@ -178,6 +188,7 @@ class ImagesPage(basepage.BaseNavigationPage):
visibility=None, protected=None):
row = self._get_row_with_image_name(name)
confirm_edit_images_form = self.images_table.edit_image(row)
+ self.wait_until_element_is_visible(self._search_name_locator_filled)
if new_name is not None:
confirm_edit_images_form.name.text = new_name