Skip to content

Commit

Permalink
DOM-62795 Capture debug logs after and before failed iteration (#535)
Browse files Browse the repository at this point in the history
* DOM-62795 Capture debug logs after and before failed iteration

In cucu debug logs, we are not capturing the before and after
action logs for the tenacity retry calls. This will help us debug
issues seen during retry steps.

* Make lint fix
  • Loading branch information
ddl-cfuerst authored Oct 23, 2024
1 parent 9540066 commit 862ba9a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project closely adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.0.4
- Change - for retry steps, also log before and after call messages

## 1.0.3
- Add - functional test for drag and drop file functionality

Expand Down
2 changes: 1 addition & 1 deletion features/cli/report_basics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Feature: Report basics
@runtime-timeout
Scenario: User can run with a runtime timeout and still produce a valid report
Given I run the command "cucu run data/features/slow_features --runtime-timeout 9 --results {CUCU_RESULTS_DIR}/runtime_timeout_reporting_results" and expect exit code "1"
Then I should see the previous step took less than "13" seconds
Then I should see the previous step took less than "14" seconds
When I run the command "cucu report {CUCU_RESULTS_DIR}/runtime_timeout_reporting_results --output {CUCU_RESULTS_DIR}/runtime_timeout_reporting_report" and expect exit code "0"
And I start a webserver at directory "{CUCU_RESULTS_DIR}/runtime_timeout_reporting_report/" and save the port to the variable "PORT"
And I open a browser at the url "http://{HOST_ADDRESS}:{PORT}/index.html"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cucu"
version = "1.0.3"
version = "1.0.4"
description = "Easy BDD web testing"
readme = "README.md"
license = { text = "The Clear BSD License" }
Expand Down
1 change: 1 addition & 0 deletions src/cucu/steps/file_input_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def upload_file_to_input(ctx, filepath, name):
return input;
"""


def drag_and_drop_file(ctx, name, filepath):
drop_target = fuzzy.find(ctx.browser, name, ["*"])
drop_target_html = drop_target.get_attribute("outerHTML")
Expand Down
4 changes: 4 additions & 0 deletions src/cucu/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import humanize
from tabulate import DataRow, TableFormat, tabulate
from tenacity import (
after_log,
before_log,
before_sleep_log,
retry_if_not_exception_type,
stop_after_delay,
Expand Down Expand Up @@ -119,6 +121,8 @@ def retry(func, wait_up_to_s=None, retry_after_s=None):
stop=stop_after_delay(wait_up_to_s),
wait=wait_fixed(retry_after_s),
retry=retry_if_not_exception_type(StopRetryException),
before=before_log(logger, logging.DEBUG),
after=after_log(logger, logging.DEBUG),
before_sleep=before_sleep_log(logger, logging.DEBUG),
)
def new_decorator(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 862ba9a

Please sign in to comment.