diff --git a/features/flow_control/before_retry_handlers.feature b/features/flow_control/before_retry_handlers.feature index 4ae4535b..cd12193b 100644 --- a/features/flow_control/before_retry_handlers.feature +++ b/features/flow_control/before_retry_handlers.feature @@ -40,9 +40,9 @@ Feature: Before retry handlers Scenario: Scenario with an before retry handler Given I start a webserver at directory "data/www" and save the port to the variable "PORT" .* - .* INFO handled the pesky button buttons! And I open a browser at the url "http://\{HOST_ADDRESS\}:\{PORT\}/links.html" .* [\s\S]* + .* INFO handled the pesky button buttons! Then I wait to see the button "button with child" .* 1 feature passed, 0 failed, 0 skipped diff --git a/pyproject.toml b/pyproject.toml index 12ff53e2..afefec39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cucu" -version = "0.125.0" +version = "0.126.0" license = "MIT" description = "" authors = ["Rodney Gomes "] diff --git a/src/cucu/page_checks.py b/src/cucu/page_checks.py index 80342d6f..ad759785 100644 --- a/src/cucu/page_checks.py +++ b/src/cucu/page_checks.py @@ -1,4 +1,6 @@ -from cucu import config, retry, register_page_check_hook, logger +from tenacity import retry, stop_after_delay, wait_fixed + +from cucu import config, logger, register_page_check_hook def init_page_checks(): @@ -6,6 +8,10 @@ def init_page_checks(): initialize cucu built in page checks """ + @retry( + stop=stop_after_delay(float(config.CONFIG["CUCU_STEP_WAIT_TIMEOUT_S"])), + wait=wait_fixed(float(config.CONFIG["CUCU_STEP_RETRY_AFTER_S"])), + ) def wait_for_document_to_be_ready(browser): if config.CONFIG["CUCU_READY_STATE_PAGE_CHECK"] == "enabled": state = browser.execute("return document.readyState;") @@ -16,9 +22,13 @@ def wait_for_document_to_be_ready(browser): logger.debug("document.readyState check disabled") register_page_check_hook( - "wait for document.readyState", retry(wait_for_document_to_be_ready) + "wait for document.readyState", wait_for_document_to_be_ready ) + @retry( + stop=stop_after_delay(float(config.CONFIG["CUCU_STEP_WAIT_TIMEOUT_S"])), + wait=wait_fixed(float(config.CONFIG["CUCU_STEP_RETRY_AFTER_S"])), + ) def wait_for_all_images_to_be_loaded(browser): if config.CONFIG["CUCU_BROKEN_IMAGES_PAGE_CHECK"] == "enabled": broken_images = browser.execute( @@ -45,5 +55,5 @@ def wait_for_all_images_to_be_loaded(browser): logger.debug("broken image check disabled") register_page_check_hook( - "broken image checker", retry(wait_for_all_images_to_be_loaded) + "broken image checker", wait_for_all_images_to_be_loaded )