Skip to content

Improve formatting of all widgets being checked #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/scwidgets/check/_widget_check_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,7 @@ def _on_click_check_all_widgets_button(self, change: dict):
]:
print(
Formatter.color_error_message(
Formatter.format_title_message(
f"Widget {self._names[widget]} raised error."
)
f"Widget {self._names[widget]}: ‼ (error)"
)
)

Expand All @@ -314,19 +312,13 @@ def _on_click_check_all_widgets_button(self, change: dict):
]:
print(
Formatter.color_success_message(
Formatter.format_title_message(
f"Widget {self._names[widget]} all checks "
f"were successful."
)
f"Widget {self._names[widget]}: ✓ (success)"
)
)
else:
print(
Formatter.color_error_message(
Formatter.format_title_message(
f"Widget {self._names[widget]} not all checks "
"were successful."
)
f"Widget {self._names[widget]}: 𐄂 (failed)"
)
)
except Exception as exception:
Expand Down
29 changes: 19 additions & 10 deletions tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,9 @@ def test_button_clicks(
]
)
== 1
), (
f"Expected: {expected_text_on_check_all_widgets} to be found in "
f"{[output.text for output in outputs]}"
)

WebDriverWait(driver, 5).until(
Expand All @@ -1018,6 +1021,9 @@ def test_button_clicks(
]
)
== 1
), (
f"Expected: {expected_text_on_set_all_references} to be found in "
f"{[output.text for output in outputs]}"
)

WebDriverWait(driver, 5).until(
Expand All @@ -1033,46 +1039,49 @@ def test_button_clicks(
]
)
== 1
), (
f"Expected: {expected_text_on_set_all_references_and_check} to be found in "
f"{[output.text for output in outputs]}"
)

# Test 1.1 use_fingerprint=False, failing=False, buggy=False
test_button_clicks(
nb_cells[3],
"Widget 1 all checks were successful",
"Widget 1: ✓ (success)",
"Successfully set all references",
"Widget 1 all checks were successful",
"Widget 1: ✓ (success)",
)

# Test 1.2 use_fingerprint=True, failing=False, buggy=False
test_button_clicks(
nb_cells[4],
"Widget 1 all checks were successful",
"Widget 1: ✓ (success)",
"Successfully set all references",
"Widget 1 all checks were successful",
"Widget 1: ✓ (success)",
)

# Test 1.3 use_fingerprint=False, failing=False, buggy=False
test_button_clicks(
nb_cells[5],
"Widget 1 not all checks were successful",
"Widget 1: 𐄂 (failed)",
"Successfully set all references",
"Widget 1 all checks were successful",
"Widget 1: ✓ (success)",
)

# Test 1.4 use_fingerprint=False, failing=False, buggy=False
test_button_clicks(
nb_cells[6],
"Widget 1 not all checks were successful",
"Widget 1: 𐄂 (failed)",
"Successfully set all references",
"Widget 1 all checks were successful",
"Widget 1: ✓ (success)",
)

# Test 1.5 use_fingerprint=False, failing=False, buggy=True
test_button_clicks(
nb_cells[7],
"Widget 1 raised error",
"Widget 1: ‼ (error)",
"NameError: name 'bug' is not defined",
"Widget 1 raised error",
"Widget 1: ‼ (error)",
)


Expand Down
Loading