44from pages .call_and_recall .call_and_recall_page import CallAndRecallPage
55from pages .call_and_recall .non_invitations_days_page import NonInvitationDaysPage
66from utils .user_tools import UserTools
7+ from utils .date_time_utils import DateTimeUtils
78
89
910@pytest .fixture (scope = "function" , autouse = True )
@@ -24,29 +25,32 @@ def test_add_then_delete_non_invitation_day(page: Page) -> None:
2425 """
2526 Verifies that a user can add and delete a non-invitation day.
2627 """
27- # Scenario: Add then delete a non invitation day
28- # And I go to "Non-Invitation Days"
28+ test_date = DateTimeUtils ().generate_unique_weekday_date ()
29+
30+ # When I go to "Non-Invitation Days"
2931 CallAndRecallPage (page ).go_to_non_invitation_days_page ()
3032
31- # # The date entered should be a week day, otherwise a warning message will pop up
32- # When I enter "14/11/2030" in the input box with id "date"
33- NonInvitationDaysPage (page ).enter_date ("14/11/2030" )
34- # # Add a new non invitation day
33+ # And I enter a date in the input box with id "date"
34+ # (The date entered should be a week day, otherwise a warning message will pop up)
35+ NonInvitationDaysPage (page ).enter_date (test_date )
36+
3537 # And I enter "Add a non invitation day for automated test" in the input box with id "note"
3638 NonInvitationDaysPage (page ).enter_note (
3739 "Add a non-invitation day for automated test"
3840 )
3941
4042 # And I click the "Add Non-Invitation Day" button
4143 NonInvitationDaysPage (page ).click_add_non_invitation_day_button ()
44+
4245 # Then todays date is visible in the non-invitation days table
43- NonInvitationDaysPage (page ).verify_date_is_visible ()
46+ NonInvitationDaysPage (page ).verify_created_on_date_is_visible ()
47+
4448 # When I click the delete button for the non-invitation day
45- # NonInvitationDaysPage(page).click_delete_button() TODO: this step should be executed as part of the next step (delete this step once confirmed working)
4649 # And I press OK on my confirmation prompt
4750 BasePage (page ).safe_accept_dialog (page .get_by_role ("button" , name = "Delete" ))
48- # Then todays date is not visible in the non-invitation days table
49- NonInvitationDaysPage (page ).verify_date_is_not_visible ()
51+
52+ # Then the non-invitation days has been successfully deleted
53+ NonInvitationDaysPage (page ).verify_created_on_date_is_not_visible ()
5054
5155
5256@pytest .mark .regression
0 commit comments