Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/MAVIS_TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
continue-on-error: true
env:
HEADLESS: ${{ vars.HEADLESS }}
CAPTURE_SCREENSHOTS: ${{ vars.CAPTURE_SCREENSHOTS }}
Expand All @@ -57,18 +58,24 @@ jobs:
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
API_TOKEN: ${{ secrets.API_TOKEN }}
run: |
echo "Starting tests on Chromium"
echo "::group::Chromium"
pytest --browser_or_device chromium
echo "Starting tests on Chrome"
echo "::endgroup::"
echo "::group::Chrome"
pytest --browser_or_device chrome
echo "Starting tests on Firefox"
echo "::endgroup::"
echo "::group::Firefox"
pytest --browser_or_device firefox
echo "Starting tests on iPhone 12"
echo "::endgroup::"
echo "::group::iPhone 12"
pytest -m mobile --browser_or_device iphone_12
echo "Starting tests on iPhone 11"
echo "::endgroup::"
echo "::group::iPhone 11"
pytest -m mobile --browser_or_device iphone_11
echo "Starting tests on Pixel 5"
echo "::endgroup::"
echo "::group::Pixel 5"
pytest -m mobile --browser_or_device pixel_5
echo "::endgroup::"
- name: Upload report
uses: actions/upload-artifact@v4
with:
Expand Down
11 changes: 9 additions & 2 deletions pages/pg_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class pg_dashboard:
LNK_CHILDREN = f"heading{escape_characters.SEPARATOR}Children"
LNK_NOTICES = f"heading{escape_characters.SEPARATOR}Important Notices"
LNK_ORGANISATION = f"heading{escape_characters.SEPARATOR}Your organisation"
LNK_DASHBOARD = "Manage vaccinations in schools"
LNK_NHS_LOGO = "Manage vaccinations in schools"
LNK_GUIDE = "Service guidance (opens in a"

def click_programmes(self):
self.po.perform_action(locator=self.LNK_PROGRAMMES, action=actions.CLICK_LINK)
Expand All @@ -34,7 +35,7 @@ def click_your_organisation(self):

def go_to_dashboard(self):
wait(timeout=wait_time.MIN) # Scripts sometimes error out without this wait when called as a teardown action
self.po.perform_action(locator=self.LNK_DASHBOARD, action=actions.CLICK_LINK)
self.po.perform_action(locator=self.LNK_NHS_LOGO, action=actions.CLICK_LINK)

def verify_all_expected_links(self):
self.po.verify(locator=self.LNK_PROGRAMMES, property=object_properties.VISIBILITY, value=True, exact=True)
Expand All @@ -48,3 +49,9 @@ def verify_all_expected_links(self):
value=True,
exact=True,
)
self.po.verify(
locator=self.LNK_GUIDE,
property=object_properties.HREF,
value="https://guide.manage-vaccinations-in-schools.nhs.uk/",
exact=True,
)
34 changes: 28 additions & 6 deletions pages/pg_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,26 @@ def __delete_sessions(self):
chain_locator=True,
)

def edit_session(self, to_date: str):
_day = to_date[-2:]
_month = to_date[4:6]
_year = to_date[:4]
self.po.perform_action(locator=self.LNK_EDIT_SESSION, action=actions.CLICK_LINK)
self.po.perform_action(locator=self.LNK_CHANGE_SESSION_DATES, action=actions.CLICK_LINK)
self.po.perform_action(locator=self.TXT_DAY, action=actions.FILL, value=_day)
self.po.perform_action(locator=self.TXT_MONTH, action=actions.FILL, value=_month)
self.po.perform_action(locator=self.TXT_YEAR, action=actions.FILL, value=_year)
self.po.perform_action(locator=self.LNK_CONTINUE, action=actions.CLICK_BUTTON)
self.po.perform_action(locator=self.LNK_CONTINUE, action=actions.CLICK_LINK)
self.po.verify(
locator="locator('div').filter(has_text=re.compile(r'^Session datesNot provided$')).get_by_role('definition')",
property=object_properties.VISIBILITY,
value=False,
exact=False,
by_test_id=False,
chain_locator=True,
)

def verify_triage_updated(self):
self.po.verify(
locator=self.LBL_PARAGRAPH,
Expand Down Expand Up @@ -319,12 +339,6 @@ def update_triage_outcome_consent_refused(self, file_paths):
self.click_child_full_name()
self.click_get_consent_responses()
self.consent_page.service_refuse_consent()
# self.dashboard_page.go_to_dashboard()
# self.dashboard_page.click_sessions()
# self.click_scheduled()
# self.click_school1()
# self.click_record_vaccinations()
# self.click_could_not_vaccinate()
self.click_consent_refused()
self.click_child_full_name()
self.click_activity_log()
Expand All @@ -338,6 +352,14 @@ def schedule_a_valid_session(self, for_today: bool = False):
self.schedule_session(future_date=_future_date)
self.verify_scheduled_date(message=_expected_message)

def edit_a_session_to_today(self):
_future_date = get_offset_date(offset_days=0)
self.click_scheduled()
self.click_school1()
self.edit_session(to_date=_future_date)
# _expected_message = f"Session dates {self.__get_display_formatted_date(date_to_format=_future_date)}"
# self.verify_scheduled_date(message=_expected_message)

def delete_all_sessions(self):
self.click_scheduled()
self.click_school1()
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ markers =
consent
cohorts
childlist
classlist
vaccsbatch
rav
bugs
1 change: 1 addition & 0 deletions test_data/hpv/i_dup_1.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TEST_DESC_IGNORED,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
P_Gardasil9,R1L,142181,Bohunt School Wokingham,9000000000,ChildFirst1,ChildLast1,20100811,Male,DN9 1PB,<<VACCS_DATE>>,Gardasil9,AutoBatch1,20301231,Left Thigh,1,Y,1,,,[email protected],Clinic,00:01,
P_Gardasil9,R1L,142181,Bohunt School Wokingham,9000000000,ChildFirst1,ChildLast1,20100811,Male,DN9 1PB,<<VACCS_DATE>>,Gardasil9,AutoBatch1,20301231,Left Thigh,1,Y,1,,,[email protected],Clinic,00:01,
2 changes: 2 additions & 0 deletions test_data/hpv/i_hist_negative.csv
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ N_EmptyBatchNumber,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNA
N_EmptyExpiryDate,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,,left thigh,1,Y,1,,,[email protected],Clinic,00:01,
N_EmptyAnatomicalSite,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,,1,Y,1,,,[email protected],Clinic,00:01,
N_InvalidAnatomicalSite,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,Nasal,1,Y,1,,,[email protected],Clinic,00:01,
N_InvalidAnatomicalSite,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,Left Buttock,1,Y,1,,,[email protected],Clinic,00:01,
N_InvalidAnatomicalSite,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,Right Buttock,1,Y,1,,,[email protected],Clinic,00:01,
N_EmptyDoseSeq,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,left thigh,,Y,1,,,[email protected],Clinic,00:01,
N_InvalidDoseSeq,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,left thigh,10,Y,1,,,[email protected],Clinic,00:01,
N_EmptyCareSetting,R1L,142181,Bohunt School Wokingham,<<NHS_NO>>,<<FNAME>>,<<LNAME>>,20100228,Female,DN9 1PB,<<HIST_VACCS_DATE>>,Gardasil9,Batch1,20301231,left thigh,1,Y,,,,[email protected],Clinic,00:01,
Expand Down
3 changes: 3 additions & 0 deletions test_data/hpv/o_dup_1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Completed
0 previously imported records were omitted
2 vaccination records
12 changes: 6 additions & 6 deletions test_data/hpv/o_hist_negative.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Row 20 VACCINE_GIVEN: Enter a valid vaccine, eg Gardasil9.
Row 21 BATCH_NUMBER: Enter a batch number.
Row 22 BATCH_EXPIRY_DATE: Enter a batch expiry date.
Row 23 ANATOMICAL_SITE: Enter an anatomical site.
Row 25 DOSE_SEQUENCE: The dose sequence number cannot be greater than 3. Enter a dose sequence number, for example, 1, 2 or 3.
Row 26 DOSE_SEQUENCE: must be less than or equal to 3
Row 27 CARE_SETTING: Enter a care setting.
Row 32 TIME_OF_VACCINATION: Enter a time in the correct format
Row 34 VACCINATED: You need to record whether the child was vaccinated or not. Enter ‘Y’ or ‘N’ in the ‘vaccinated’ column.BATCH_EXPIRY_DATE: must be blankBATCH_NUMBER: must be blankANATOMICAL_SITE: must be blankREASON_NOT_VACCINATED: Enter a valid reasonVACCINE_GIVEN: must be blank
Row 35 CARE_SETTING: Enter a valid care setting.
Row 27 DOSE_SEQUENCE: The dose sequence number cannot be greater than 3. Enter a dose sequence number, for example, 1, 2 or 3.
Row 28 DOSE_SEQUENCE: must be less than or equal to 3
Row 29 CARE_SETTING: Enter a care setting.
Row 34 TIME_OF_VACCINATION: Enter a time in the correct format
Row 36 VACCINATED: You need to record whether the child was vaccinated or not. Enter ‘Y’ or ‘N’ in the ‘vaccinated’ column.BATCH_EXPIRY_DATE: must be blankBATCH_NUMBER: must be blankANATOMICAL_SITE: must be blankREASON_NOT_VACCINATED: Enter a valid reasonVACCINE_GIVEN: must be blank
Row 37 CARE_SETTING: Enter a valid care setting.
9 changes: 7 additions & 2 deletions tests/test_02_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ def test_reg_create_valid_session(self):
self.sessions_page.schedule_a_valid_session()

@pytest.mark.sessions
@pytest.mark.order(202)
@pytest.mark.order(201)
def test_reg_edit_session(self):
self.sessions_page.edit_a_session_to_today()

@pytest.mark.sessions
@pytest.mark.order(203)
def test_reg_delete_all_sessions(self):
self.sessions_page.delete_all_sessions()

@pytest.mark.sessions
@pytest.mark.order(203)
@pytest.mark.order(204)
def test_reg_create_invalid_session(self):
self.sessions_page.create_invalid_session()
Loading