From 0b05999889d4a70156eea29c765aa8aaf382c0af Mon Sep 17 00:00:00 2001 From: Marcel Wilson Date: Fri, 1 Mar 2024 11:36:42 -0600 Subject: [PATCH] ensuring messages include punctuation --- screenpy_selenium/resolutions/is_clickable.py | 2 +- screenpy_selenium/resolutions/is_invisible.py | 2 +- screenpy_selenium/resolutions/is_present.py | 2 +- screenpy_selenium/resolutions/is_visible.py | 2 +- tests/test_resolutions.py | 22 +++++++++++++++++-- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/screenpy_selenium/resolutions/is_clickable.py b/screenpy_selenium/resolutions/is_clickable.py index ff5ed06..50f35aa 100644 --- a/screenpy_selenium/resolutions/is_clickable.py +++ b/screenpy_selenium/resolutions/is_clickable.py @@ -24,7 +24,7 @@ def describe(self) -> str: """Describe the Resolution's expectation.""" return "clickable" - @beat("... hoping it's clickable") + @beat("... hoping it's clickable.") def resolve(self) -> IsClickableElement: """Produce the Matcher to make the assertion.""" return is_clickable_element() diff --git a/screenpy_selenium/resolutions/is_invisible.py b/screenpy_selenium/resolutions/is_invisible.py index 01f09fb..cc4107b 100644 --- a/screenpy_selenium/resolutions/is_invisible.py +++ b/screenpy_selenium/resolutions/is_invisible.py @@ -24,7 +24,7 @@ def describe(self) -> str: """Describe the Resolution's expectation.""" return "invisible" - @beat("... hoping it's invisible") + @beat("... hoping it's invisible.") def resolve(self) -> IsInvisibleElement: """Produce the Matcher to make the assertion.""" return is_invisible_element() diff --git a/screenpy_selenium/resolutions/is_present.py b/screenpy_selenium/resolutions/is_present.py index 6ed23bb..9175d35 100644 --- a/screenpy_selenium/resolutions/is_present.py +++ b/screenpy_selenium/resolutions/is_present.py @@ -26,7 +26,7 @@ def describe(self) -> str: """Describe the Resolution's expectation.""" return "present" - @beat("... hoping it's present") + @beat("... hoping it's present.") def resolve(self) -> IsPresentElement: """Produce the Matcher to make the assertion.""" return is_present_element() diff --git a/screenpy_selenium/resolutions/is_visible.py b/screenpy_selenium/resolutions/is_visible.py index 7a5283e..ade2a35 100644 --- a/screenpy_selenium/resolutions/is_visible.py +++ b/screenpy_selenium/resolutions/is_visible.py @@ -24,7 +24,7 @@ def describe(self) -> str: """Describe the Resolution's expectation.""" return "visible" - @beat("... hoping it's visible") + @beat("... hoping it's visible.") def resolve(self) -> IsVisibleElement: """Produce the Matcher to make the assertion.""" return is_visible_element() diff --git a/tests/test_resolutions.py b/tests/test_resolutions.py index d3ebe1d..8f3f42d 100644 --- a/tests/test_resolutions.py +++ b/tests/test_resolutions.py @@ -107,7 +107,7 @@ def test_beat_logging(self, caplog: pytest.LogCaptureFixture) -> None: IsClickable().resolve() assert [r.msg for r in caplog.records] == [ - "... hoping it's clickable", + "... hoping it's clickable.", " => the element is enabled/clickable", ] @@ -152,6 +152,15 @@ def test_type_hint(self) -> None: assert annotation == "IsVisibleElement" assert type(iv.resolve()) == IsVisibleElement + def test_beat_logging(self, caplog: pytest.LogCaptureFixture) -> None: + caplog.set_level(logging.INFO) + IsVisible().resolve() + + assert [r.msg for r in caplog.records] == [ + "... hoping it's visible.", + " => the element is visible", + ] + class TestIsInvisible: def test_can_be_instantiated(self) -> None: @@ -214,7 +223,7 @@ def test_beat_logging(self, caplog: pytest.LogCaptureFixture) -> None: IsInvisible().resolve() assert [r.msg for r in caplog.records] == [ - "... hoping it's invisible", + "... hoping it's invisible.", " => the element is invisible", ] @@ -260,3 +269,12 @@ def test_type_hint(self) -> None: annotation = ip.resolve.__annotations__["return"] assert annotation == "IsPresentElement" assert type(ip.resolve()) == IsPresentElement + + def test_beat_logging(self, caplog: pytest.LogCaptureFixture) -> None: + caplog.set_level(logging.INFO) + IsPresent().resolve() + + assert [r.msg for r in caplog.records] == [ + "... hoping it's present.", + " => the element is present", + ]