Skip to content

Commit 55378dd

Browse files
MAVIS-1729
1 parent 595922a commit 55378dd

File tree

5 files changed

+61
-6
lines changed

5 files changed

+61
-6
lines changed

libs/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class test_data_file_paths:
123123
COHORTS_INVALID_STRUCTURE: Final[str] = "COHORTS_INVALID_STRUCTURE"
124124
COHORTS_EMPTY_FILE: Final[str] = "COHORTS_EMPTY_FILE"
125125
COHORTS_HEADER_ONLY: Final[str] = "COHORTS_HEADER_ONLY"
126-
COHORTS_NO_APPROVAL: Final[str] = "COHORTS_NO_APPROVAL"
127126
CHILD_POSITIVE: Final[str] = "CHILD_POSITIVE"
128127
CHILD_NEGATIVE: Final[str] = "CHILD_NEGATIVE"
129128
CHILD_INVALID_STRUCTURE: Final[str] = "CHILD_INVALID_STRUCTURE"
@@ -134,3 +133,5 @@ class test_data_file_paths:
134133
CLASS_INVALID_STRUCTURE: Final[str] = "CLASS_INVALID_STRUCTURE"
135134
CLASS_EMPTY_FILE: Final[str] = "CLASS_EMPTY_FILE"
136135
CLASS_HEADER_ONLY: Final[str] = "CLASS_HEADER_ONLY"
136+
COHORTS_NO_APPROVAL: Final[str] = "COHORTS_NO_APPROVAL"
137+
VACCS_HPV_DOSE_TWO: Final[str] = "VACCS_HPV_DOSE_TWO"

pages/pg_programmes.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,27 @@ class pg_programmes:
2222
LBL_IMPORT_STARTED = "Import processing started"
2323
LBL_PARAGRAPH = "paragraph"
2424
LBL_MAIN = "main"
25+
LNK_DOSE2_CHILD = "Dose2 Dose2"
26+
BTN_EDIT_VACCINATION_RECORD = "Edit vaccination record"
2527

2628
def click_hpv(self):
2729
self.po.perform_action(locator=self.LNK_HPV, action=actions.CLICK_LINK)
2830

2931
def click_imports(self):
3032
self.po.perform_action(locator=self.LNK_IMPORTS, action=actions.CLICK_LINK)
3133

34+
def click_vaccinations(self):
35+
self.po.perform_action(
36+
locator="get_by_label('Secondary menu').get_by_role('link', name='Vaccinations').click()",
37+
action=actions.CHAIN_LOCATOR_ACTION,
38+
)
39+
3240
def click_cohorts(self):
3341
self.po.perform_action(locator=self.LNK_COHORTS, action=actions.CLICK_LINK)
3442

43+
def click_edit_vaccination_record(self):
44+
self.po.perform_action(locator=self.BTN_EDIT_VACCINATION_RECORD, action=actions.CLICK_BUTTON)
45+
3546
def click_import_records(self):
3647
self.po.perform_action(locator=self.LNK_IMPORT_RECORDS, action=actions.CLICK_LINK)
3748

@@ -76,6 +87,9 @@ def click_uploaded_file_datetime(self):
7687
def record_upload_time(self):
7788
self.upload_time = get_link_formatted_date_time()
7889

90+
def click_dose2_child(self):
91+
self.po.perform_action(locator=self.LNK_DOSE2_CHILD, action=actions.CLICK_LINK)
92+
7993
def verify_upload_output(self, file_path: str):
8094
_expected_errors = self.tdo.get_expected_errors(file_path=file_path)
8195
if _expected_errors is not None:
@@ -156,3 +170,21 @@ def upload_invalid_hpv_child_records(self, file_paths: str):
156170
self.choose_file_child_records(file_path=_input_file_path)
157171
self.click_continue()
158172
self.verify_upload_output(file_path=_output_file_path)
173+
174+
def edit_dose_to_not_given(self):
175+
self.click_hpv()
176+
self.click_vaccinations()
177+
self.click_dose2_child()
178+
self.click_edit_vaccination_record()
179+
self.po.perform_action(locator="Change   outcome", action=actions.CLICK_LINK)
180+
self.po.perform_action(locator="They refused it", action=actions.RADIO_BUTTON_SELECT)
181+
self.click_continue()
182+
self.po.perform_action(locator="Save changes", action=actions.CLICK_BUTTON)
183+
self.po.verify(
184+
locator=self.LBL_MAIN,
185+
property=object_properties.TEXT,
186+
value="!Sorry, there’s a problem with the service",
187+
exact=False,
188+
by_test_id=False,
189+
chain_locator=False,
190+
)

test_data/file_mapping.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ COHORTS_NEGATIVE,test_data/cohorts/i_negative.csv,test_data/cohorts/o_negative.c
1313
COHORTS_INVALID_STRUCTURE,test_data/cohorts/i_invalid_structure.csv,test_data/cohorts/o_invalid_structure.csv,cohort
1414
COHORTS_EMPTY_FILE,test_data/cohorts/i_empty.csv,test_data/cohorts/o_empty.csv,cohort
1515
COHORTS_HEADER_ONLY,test_data/cohorts/i_header_only.csv,test_data/cohorts/o_header_only.csv,cohort
16-
COHORTS_NO_APPROVAL,test_data/cohorts/i_no_consent.csv,,cohort
1716
CHILD_POSITIVE,test_data/child/i_positive.csv,test_data/child/o_positive.csv,child
1817
CHILD_NEGATIVE,test_data/child/i_negative.csv,test_data/child/o_negative.csv,child
1918
CHILD_INVALID_STRUCTURE,test_data/child/i_invalid_structure.csv,test_data/child/o_invalid_structure.csv,child
@@ -24,3 +23,5 @@ CLASS_NEGATIVE,test_data/class_list/i_negative.csv,test_data/class_list/o_negati
2423
CLASS_INVALID_STRUCTURE,test_data/class_list/i_invalid_structure.csv,test_data/class_list/o_invalid_structure.csv,class
2524
CLASS_EMPTY_FILE,test_data/class_list/i_empty.csv,test_data/class_list/o_empty.csv,class
2625
CLASS_HEADER_ONLY,test_data/class_list/i_header_only.csv,test_data/class_list/o_header_only.csv,class
26+
COHORTS_NO_APPROVAL,test_data/cohorts/i_no_consent.csv,,cohort
27+
VACCS_HPV_DOSE_TWO,test_data/hpv/i_dose_two.csv,,hpv

test_data/hpv/i_dose_two.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ORGANISATION_CODE,SCHOOL_URN,SCHOOL_NAME,NHS_NUMBER,PERSON_FORENAME,PERSON_SURNAME,PERSON_DOB,PERSON_GENDER_CODE,PERSON_POSTCODE,DATE_OF_VACCINATION,VACCINE_GIVEN,BATCH_NUMBER,BATCH_EXPIRY_DATE,ANATOMICAL_SITE,DOSE_SEQUENCE,VACCINATED,CARE_SETTING,PERFORMING_PROFESSIONAL_FORENAME,PERFORMING_PROFESSIONAL_SURNAME,PERFORMING_PROFESSIONAL_EMAIL,CLINIC_NAME,TIME_OF_VACCINATION,REASON_NOT_VACCINATED
2+
R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,Dose2,Dose2,20100228,Female,DN9 1PB,<<VACCS_DATE>>,Gardasil9,Batch1,20301231,left thigh,2,Y,1,,,[email protected],Clinic,00:01,

tests/test_07_record_a_vaccine_using_ui.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import pytest
22

33
from libs.constants import test_data_file_paths
4-
from pages import pg_dashboard, pg_login, pg_sessions
4+
from pages import pg_dashboard, pg_login, pg_programmes, pg_sessions
55

66

77
class Test_Record_a_Vaccine_Using_UI:
88
login_page = pg_login.pg_login()
99
dashboard_page = pg_dashboard.pg_dashboard()
1010
sessions_page = pg_sessions.pg_sessions()
11+
programmes_page = pg_programmes.pg_programmes()
1112

12-
@pytest.fixture(scope="function", autouse=True)
13+
@pytest.fixture(scope="function")
1314
def setup_tests(self, start_mavis: None):
1415
self.login_page.login_as_nurse()
1516
self.dashboard_page.click_sessions()
@@ -24,10 +25,28 @@ def setup_tests(self, start_mavis: None):
2425

2526
@pytest.mark.rav
2627
@pytest.mark.order(701)
27-
def test_rav_triage_positive(self):
28+
def test_rav_triage_positive(self, setup_tests):
2829
self.sessions_page.update_triage_outcome_positive(file_paths=test_data_file_paths.COHORTS_POSITIVE)
2930

3031
@pytest.mark.rav
3132
@pytest.mark.order(702)
32-
def test_rav_triage_consent_refused(self):
33+
def test_rav_triage_consent_refused(self, setup_tests):
3334
self.sessions_page.update_triage_outcome_consent_refused(file_paths=test_data_file_paths.COHORTS_POSITIVE)
35+
36+
@pytest.mark.rav
37+
@pytest.mark.order(703)
38+
@pytest.mark.skip(reason="Under construction")
39+
def test_rav_edit_dose_to_not_given(self, start_mavis):
40+
self.login_page.login_as_nurse()
41+
self.dashboard_page.click_sessions()
42+
self.sessions_page.schedule_a_valid_session(for_today=True)
43+
self.dashboard_page.go_to_dashboard()
44+
self.dashboard_page.click_programmes()
45+
self.programmes_page.upload_hpv_vaccination_records(file_paths=test_data_file_paths.VACCS_HPV_DOSE_TWO)
46+
self.dashboard_page.go_to_dashboard()
47+
self.dashboard_page.click_programmes()
48+
self.programmes_page.edit_dose_to_not_given() # MAVIS-1729
49+
self.dashboard_page.go_to_dashboard()
50+
self.dashboard_page.click_sessions()
51+
self.sessions_page.delete_all_sessions()
52+
self.login_page.logout_of_mavis()

0 commit comments

Comments
 (0)