Skip to content

Commit

Permalink
Fix UI deployment on ODF4.16 (#9658)
Browse files Browse the repository at this point in the history
* Fix UI deployment on ODF4.16

Signed-off-by: oviner <[email protected]>
  • Loading branch information
OdedViner authored Apr 16, 2024
1 parent 4e1bc8f commit 7695a16
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
17 changes: 17 additions & 0 deletions ocs_ci/ocs/ui/base_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
29 changes: 23 additions & 6 deletions ocs_ci/ocs/ui/deployment_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion ocs_ci/ocs/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 7695a16

Please sign in to comment.