Skip to content

Commit 548e28d

Browse files
authored
Merge pull request #1016 from NHSDigital/offline-import-clinic-sessions
Support offline recording for clinic sessions that don't yet exist
2 parents 9b4a104 + 8de3159 commit 548e28d

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

mavis/test/data/vaccs/o_systmone_hist_negative.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Row 2 Date of birth: Enter a date of birth.
22
Row 4 NHS number: should be a valid NHS number with 10 characters
33
Row 5 NHS number: should be a valid NHS number with 10 characters
4-
Row 6 Vaccination type: This programme is not available in this session. Vaccination type: This vaccine is not valid.
4+
Row 6 Vaccination type: This programme is not recognised. Vaccination type: This vaccine is not valid.
55
Row 7 Vaccination type: must be less than or equal to 3
6-
Row 8 Vaccination type: This programme is not available in this session. Vaccination type: This vaccine is not valid.
6+
Row 8 Vaccination type: This programme is not recognised. Vaccination type: This vaccine is not valid.
77
Row 9 First name: Enter a first name.
88
Row 10 Postcode: Enter a valid postcode, such as SW1A 1AA.
99
Row 11 Postcode: Enter a valid postcode, such as SW1A 1AA.

mavis/test/data/vaccs/o_systmone_negative.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Row 2 Date of birth: Enter a date of birth.
22
Row 4 NHS number: should be a valid NHS number with 10 characters
33
Row 5 NHS number: should be a valid NHS number with 10 characters
4-
Row 6 Vaccination type: This programme is not available in this session. Vaccination type: This vaccine is not valid.
4+
Row 6 Vaccination type: This programme is not recognised. Vaccination type: This vaccine is not valid.
55
Row 7 Vaccination type: must be less than or equal to 3
6-
Row 8 Vaccination type: This programme is not available in this session. Vaccination type: This vaccine is not valid.
6+
Row 8 Vaccination type: This programme is not recognised. Vaccination type: This vaccine is not valid.
77
Row 9 First name: Enter a first name.
88
Row 10 Postcode: Enter a valid postcode, such as SW1A 1AA.
99
Row 11 Postcode: Enter a valid postcode, such as SW1A 1AA.

mavis/test/pages/sessions/sessions_overview_page.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def __init__(self, page: Page) -> None:
3838
"link",
3939
name="Import class lists",
4040
)
41-
self.record_offline_link = self.page.get_by_role("link", name="Record offline")
41+
self.download_offline_spreadsheet_button = self.page.get_by_role(
42+
"link", name="Download offline spreadsheet"
43+
)
4244
self.review_no_consent_response_link = self.page.get_by_role(
4345
"link",
4446
name="with no response",
@@ -139,12 +141,12 @@ def get_session_id_from_offline_excel(self) -> str:
139141
file_path = self.download_offline_recording_excel()
140142
return get_session_id(file_path)
141143

142-
@step("Click on Record offline")
144+
@step("Click on Download offline spreadsheet")
143145
def download_offline_recording_excel(self) -> Path:
144146
_file_path = Path(f"working/excel_{get_current_datetime_compact()}.xlsx")
145147

146148
with self.page.expect_download() as download_info:
147-
self.record_offline_link.click()
149+
self.download_offline_spreadsheet_button.click()
148150
download = download_info.value
149151
download.save_as(_file_path)
150152

tests/test_e2e_doubles.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import time
2+
13
import pytest
24

35
from mavis.test.constants import Programme, Vaccine
@@ -109,12 +111,18 @@ def test_recording_doubles_vaccination_e2e(
109111
SessionsChildrenPage(page).header.click_mavis()
110112
DashboardPage(page).click_sessions()
111113
SessionsSearchPage(page).click_session_for_programme_group(schools[0], "doubles")
114+
112115
SessionsOverviewPage(page).verify_offline_sheet_vaccination_row(
113116
menacwy_vaccination_record,
114117
Vaccine.MENQUADFI,
115118
point_of_care_nurse,
116119
schools[0],
117120
)
121+
122+
# The button to download the offline spreadsheet prevents double clicks.
123+
# We need to wait here to avoid the second click being ignored.
124+
time.sleep(1)
125+
118126
SessionsOverviewPage(page).verify_offline_sheet_vaccination_row(
119127
td_ipv_vaccination_record,
120128
Vaccine.REVAXIS,

tests/test_import_issues.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ def setup_vaccination_import(
116116
ImportRecordsWizardPage(page, point_of_care_file_generator).import_class_list(
117117
ClassFileMapping.RANDOM_CHILD, year_group
118118
)
119-
schedule_school_session_if_needed(page, school, [Programme.HPV], [year_group])
119+
schedule_school_session_if_needed(
120+
page, school, [Programme.FLU, Programme.HPV], [year_group]
121+
)
120122
session_id = SessionsOverviewPage(page).get_session_id_from_offline_excel()
121123
SessionsOverviewPage(page).header.click_mavis()
122124
return session_id

tests/test_import_offline_vaccinations.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,27 @@ def setup_vaccs(
3232
point_of_care_file_generator,
3333
year_groups,
3434
):
35-
school = schools[Programme.HPV][0]
36-
year_group = year_groups[Programme.HPV]
35+
school = schools["doubles"][0]
36+
year_group = year_groups["doubles"]
3737

3838
DashboardPage(page).click_schools()
3939
SchoolsSearchPage(page).click_school(school)
4040
SchoolChildrenPage(page).click_import_class_lists()
4141
ImportRecordsWizardPage(page, point_of_care_file_generator).import_class_list(
42-
ClassFileMapping.RANDOM_CHILD, year_group
42+
ClassFileMapping.RANDOM_CHILD, year_group, programme_group="doubles"
43+
)
44+
schedule_school_session_if_needed(
45+
page,
46+
school,
47+
[
48+
Programme.FLU,
49+
Programme.HPV,
50+
Programme.MENACWY,
51+
Programme.MMR,
52+
Programme.TD_IPV,
53+
],
54+
[year_group],
4355
)
44-
schedule_school_session_if_needed(page, school, [Programme.HPV], [year_group])
4556
session_id = SessionsOverviewPage(page).get_session_id_from_offline_excel()
4657
SessionsOverviewPage(page).header.click_mavis()
4758
DashboardPage(page).click_imports()

0 commit comments

Comments
 (0)