From 7695a164ab96aef4f9dfce9e6ec7c94899836000 Mon Sep 17 00:00:00 2001 From: Oded Viner <61982127+OdedViner@users.noreply.github.com> Date: Tue, 16 Apr 2024 12:19:59 +0300 Subject: [PATCH] Fix UI deployment on ODF4.16 (#9658) * Fix UI deployment on ODF4.16 Signed-off-by: oviner --- ocs_ci/ocs/ui/base_ui.py | 17 +++++++++++++++++ ocs_ci/ocs/ui/deployment_ui.py | 29 +++++++++++++++++++++++------ ocs_ci/ocs/ui/views.py | 5 ++++- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/ocs_ci/ocs/ui/base_ui.py b/ocs_ci/ocs/ui/base_ui.py index 23ffa61cd89..41ab9ba6df2 100644 --- a/ocs_ci/ocs/ui/base_ui.py +++ b/ocs_ci/ocs/ui/base_ui.py @@ -372,6 +372,23 @@ def check_element_text(self, expected_text, element="*"): ) return len(element_list) > 0 + def check_number_occurrences_text(self, expected_text, number, element="*"): + """ + The number of times the string appears on the web page + + Args: + expected_text (string): The expected text. + number (int): The number of times the string appears on the web page + + return: + bool: True if the text matches the expected text, False otherwise + + """ + element_list = self.driver.find_elements_by_xpath( + f"//{element}[contains(text(), '{expected_text}')]" + ) + return len(element_list) == number + def get_element_text(self, locator): """ Get the inner text of an element in locator. diff --git a/ocs_ci/ocs/ui/deployment_ui.py b/ocs_ci/ocs/ui/deployment_ui.py index 2532e68f912..5700b42028d 100644 --- a/ocs_ci/ocs/ui/deployment_ui.py +++ b/ocs_ci/ocs/ui/deployment_ui.py @@ -153,9 +153,17 @@ def install_storage_cluster(self): if self.check_element_text("404"): logger.info("Refresh storage cluster page") self.refresh_page() + # WA for https://issues.redhat.com/browse/OCPBUGS-32223 + time.sleep(60) self.do_click( locator=self.dep_loc["create_storage_cluster"], enable_screenshot=True ) + # WA for https://issues.redhat.com/browse/OCPBUGS-32223 + time.sleep(30) + if self.check_element_text("An error"): + logger.info("Refresh storage system page if error occurred") + self.refresh_page() + time.sleep(30) if config.ENV_DATA.get("mcg_only_deployment", False): self.install_mcg_only_cluster() elif config.DEPLOYMENT.get("local_storage"): @@ -425,12 +433,21 @@ def verify_operator_succeeded( """ self.search_operator_installed_operators_page(operator=operator) time.sleep(5) - sample = TimeoutSampler( - timeout=timeout_install, - sleep=sleep, - func=self.check_element_text, - expected_text="Succeeded", - ) + if self.ocs_version_semantic > version.VERSION_4_15: + sample = TimeoutSampler( + timeout=timeout_install, + sleep=sleep, + func=self.check_number_occurrences_text, + expected_text="Succeeded", + number=2, + ) + else: + sample = TimeoutSampler( + timeout=timeout_install, + sleep=sleep, + func=self.check_element_text, + expected_text="Succeeded", + ) if not sample.wait_for_func_status(result=True): logger.error( f"{operator} Installation status is not Succeeded after {timeout_install} seconds" diff --git a/ocs_ci/ocs/ui/views.py b/ocs_ci/ocs/ui/views.py index af84cfc19cf..38a617e762b 100644 --- a/ocs_ci/ocs/ui/views.py +++ b/ocs_ci/ocs/ui/views.py @@ -227,7 +227,10 @@ } deployment_4_16 = { - "osd_size_dropdown": ("//*[@class='pf-c-select dropdown--full-width']", By.XPATH), + "osd_size_dropdown": ( + "//*[@class='pf-v5-c-select dropdown--full-width']", + By.XPATH, + ), } generic_locators = {