Skip to content

Commit 33afda9

Browse files
authored
Merge pull request #536 from NHSDigital/adapt-invite-to-clinic-test
Adapt clinic invite test to work during rollover period
2 parents 0ac3c59 + 9dc1c11 commit 33afda9

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

mavis/test/pages/sessions.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ def __init__(
186186
self.archived_records_checkbox = self.page.get_by_role(
187187
"checkbox", name="Archived records"
188188
)
189+
self.send_clinic_invitations_link = self.page.get_by_role(
190+
"link", name="Send clinic invitations"
191+
)
192+
self.send_clinic_invitations_button = self.page.get_by_role(
193+
"button", name="Send clinic invitations"
194+
)
189195

190196
def __get_display_formatted_date(self, date_to_format: str) -> str:
191197
_parsed_date = datetime.strptime(date_to_format, "%Y%m%d")
@@ -373,6 +379,14 @@ def click_on_update_results(self):
373379
def fill_notes(self, notes: str):
374380
self.notes_textbox.fill(notes)
375381

382+
@step("Click Send clinic invitations")
383+
def click_send_clinic_invitations_link(self):
384+
self.send_clinic_invitations_link.click()
385+
386+
@step("Click Send clinic invitations")
387+
def click_send_clinic_invitations_button(self):
388+
self.send_clinic_invitations_button.click()
389+
376390
@step("Click on Record a new consent response")
377391
def click_record_a_new_consent_response(self):
378392
# temporary wait before clicking the button to prevent errors
@@ -651,13 +665,21 @@ def verify_scheduled_date(self, message: str):
651665
self.click_continue_link()
652666

653667
def schedule_a_valid_session(
654-
self, location: str, programme_group: str, for_today: bool = False
668+
self,
669+
location: str,
670+
programme_group: str,
671+
for_today: bool = False,
672+
yesterday: bool = False,
655673
):
656-
_future_date = (
657-
get_offset_date(offset_days=0)
658-
if for_today
659-
else get_offset_date(offset_days=10)
660-
)
674+
# scheduling a session for yesterday is a temporary measure for the rollover period
675+
# this will be disallowed in the future
676+
if yesterday:
677+
offset_days = -1
678+
elif for_today:
679+
offset_days = 0
680+
else:
681+
offset_days = 10
682+
_future_date = get_offset_date(offset_days=offset_days)
661683
_expected_message = f"Session dates{self.__get_display_formatted_date(date_to_format=_future_date)}"
662684
self.click_session_for_programme_group(location, programme_group)
663685
self.__schedule_session(on_date=_future_date)

tests/test_programmes.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def setup_mav_854(
9595
batch_name = add_vaccine_batch(Vaccine.GARDASIL_9)
9696
dashboard_page.click_mavis()
9797
dashboard_page.click_sessions()
98-
sessions_page.schedule_a_valid_session(school, Programme.HPV, for_today=True)
98+
sessions_page.schedule_a_valid_session(school, Programme.HPV, yesterday=True)
9999
sessions_page.click_import_class_lists()
100100
import_records_page.import_class_list_for_current_year(
101101
ClassFileMapping.FIXED_CHILD, year_group
@@ -106,7 +106,6 @@ def setup_mav_854(
106106
"Community clinic", Programme.HPV, for_today=True
107107
)
108108
dashboard_page.click_mavis()
109-
dashboard_page.click_children()
110109
yield batch_name
111110
finally:
112111
dashboard_page.click_mavis()
@@ -293,9 +292,19 @@ def test_rav_verify_excel_mav_854(
293292
school = schools[Programme.HPV][0]
294293
batch_name = setup_mav_854
295294

295+
dashboard_page.click_sessions()
296+
sessions_page.click_session_for_programme_group(school, Programme.HPV)
297+
298+
# temporary approach for rollover
299+
# if the rollover period has passed, revert the commit this was added in
300+
sessions_page.click_send_clinic_invitations_link()
301+
sessions_page.click_send_clinic_invitations_button()
302+
303+
dashboard_page.click_mavis()
304+
dashboard_page.click_children()
305+
296306
children_page.search_for_a_child_name(str(child))
297307
children_page.click_record_for_child(child)
298-
children_page.click_invite_to_community_clinic()
299308
children_page.click_session_for_programme(
300309
"Community clinic", Programme.HPV, check_date=True
301310
)

0 commit comments

Comments
 (0)