diff --git a/ocs_ci/ocs/ui/base_ui.py b/ocs_ci/ocs/ui/base_ui.py index 1a07a467877..0684f12faa8 100644 --- a/ocs_ci/ocs/ui/base_ui.py +++ b/ocs_ci/ocs/ui/base_ui.py @@ -359,17 +359,21 @@ def select_checkbox_status(self, status, locator): if status != current_status: self.do_click(locator=locator) - def check_element_text(self, expected_text, element="*"): + def check_element_text(self, expected_text, element="*", take_screenshot=False): """ Check if the text matches the expected text. Args: expected_text (string): The expected text. + element (str): element + take_screenshot (bool): if screenshot should be taken return: bool: True if the text matches the expected text, False otherwise """ + if take_screenshot: + self.take_screenshot() element_list = self.driver.find_elements_by_xpath( f"//{element}[contains(text(), '{expected_text}')]" ) diff --git a/ocs_ci/ocs/ui/deployment_ui.py b/ocs_ci/ocs/ui/deployment_ui.py index e989f4a02b0..d2d7fcda421 100644 --- a/ocs_ci/ocs/ui/deployment_ui.py +++ b/ocs_ci/ocs/ui/deployment_ui.py @@ -45,11 +45,13 @@ def verify_disks_lso_attached(self, timeout=600, sleep=20): capacity_str = str(capacity / 1024).rstrip("0").rstrip(".") + " TiB" else: capacity_str = str(capacity) + " GiB" + logger.info(f"Waiting for {capacity_str}") sample = TimeoutSampler( timeout=timeout, sleep=sleep, func=self.check_element_text, expected_text=capacity_str, + take_screenshot=True, ) if not sample.wait_for_func_status(result=True): raise TimeoutExpiredError(f"Disks are not attached after {timeout} seconds") @@ -226,6 +228,7 @@ def install_lso_cluster(self): text=constants.LOCAL_BLOCK_RESOURCE, timeout=300, ) + self.take_screenshot() self.do_send_keys( locator=self.dep_loc["sc_name"], text=constants.LOCAL_BLOCK_RESOURCE ) @@ -234,10 +237,11 @@ def install_lso_cluster(self): self.do_click( locator=self.dep_loc["all_nodes_create_sc"], enable_screenshot=True ) - if config.ENV_DATA.get("platform") in [ + if config.ENV_DATA.get("platform") not in [ constants.BAREMETAL_PLATFORM, constants.HCI_BAREMETAL, ]: + self.take_screenshot() self.verify_disks_lso_attached() timeout_next = 60 else: