From e3343af1381d014ad105095a7d0c5c40563a95fe Mon Sep 17 00:00:00 2001 From: Daniel Osypenko Date: Mon, 13 Nov 2023 11:04:21 +0200 Subject: [PATCH] add redunancy _check_all_rules_exist (#8713) Signed-off-by: Daniel Osypenko --- .../data_foundation_tabs_common.py | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/ocs_ci/ocs/ui/page_objects/data_foundation_tabs_common.py b/ocs_ci/ocs/ui/page_objects/data_foundation_tabs_common.py index 9e220a04d48..b13d233e538 100644 --- a/ocs_ci/ocs/ui/page_objects/data_foundation_tabs_common.py +++ b/ocs_ci/ocs/ui/page_objects/data_foundation_tabs_common.py @@ -13,6 +13,7 @@ from ocs_ci.utility.retry import retry from ocs_ci.ocs.ui.base_ui import logger, wait_for_element_to_be_visible from ocs_ci.ocs.ui.page_objects.page_navigator import PageNavigator +from ocs_ci.utility.utils import TimeoutSampler class CreateResourceForm(PageNavigator): @@ -61,16 +62,27 @@ def check_error_messages(self): def _verify_input_requirements(self): """ Verify that all input requirements are met. - """ - rules_texts_ok = self._check_all_rules_exist( - self.generic_locators["text_input_popup_rules"] - ) - self.test_results.loc[len(self.test_results)] = [ - None, - self._check_all_rules_exist.__name__, - rules_texts_ok, - ] + Function retries to get all error message rule texts during 120 seconds. + """ + # verify that all rules exist when input rules popup is visible + for sample in TimeoutSampler( + 120, + 3, + self._check_all_rules_exist, + self.generic_locators["text_input_popup_rules"], + ): + if sample: + self.test_results.loc[len(self.test_results)] = [ + None, + self._check_all_rules_exist.__name__, + True, + ] + break + else: + self.do_click(self.validation_loc["input_value_validator_icon"]) + logger.info("retrying get all error message rule texts") + # invoke execution of every rule-checker function for rule, func in self.rules.items(): res = func(rule) self.test_results.loc[len(self.test_results)] = [rule, func.__name__, res]