diff --git a/conftest.py b/conftest.py index d698190b49c..d650a9b20a6 100644 --- a/conftest.py +++ b/conftest.py @@ -35,6 +35,15 @@ def start_mavis(start_exe_session, start_playwright): close_browser(browser=_browser, page=ce.page) +# @pytest.fixture +# def start_consent_workflow(start_exe_session, start_playwright): +# _browser, _context = start_browser(pw=start_playwright, browser_or_device=ce.current_browser_name) +# ce.page = _context.new_page() +# ce.page.goto(url=ce.parental_consent_url) +# yield +# close_browser(browser=_browser, page=ce.page) + + @pytest.fixture def start_consent_workflow(start_exe_session, start_playwright): _browser, _context = start_browser(pw=start_playwright, browser_or_device=ce.current_browser_name) diff --git a/libs/constants.py b/libs/constants.py index 6e39ce9b3b3..323a2142e4a 100644 --- a/libs/constants.py +++ b/libs/constants.py @@ -4,6 +4,7 @@ class object_properties: TEXT: Final[str] = "text" VISIBILITY: Final[str] = "visibility" + HREF: Final[str] = "href" class actions: diff --git a/libs/playwright_ops.py b/libs/playwright_ops.py index 9f5ad8e3ef1..f0155b56e44 100644 --- a/libs/playwright_ops.py +++ b/libs/playwright_ops.py @@ -67,6 +67,9 @@ def get_object_property(self, locator: str, property: str, by_test_id: bool = Fa else: elem = self.ce.page.get_by_role(locator).nth(0) return elem.is_visible() + case object_properties.HREF: + elem = self.ce.page.get_by_role("link", name=locator).nth(0) + return elem.get_attribute(object_properties.HREF) def perform_action(self, locator, action, value=None, exact: bool = False) -> None: self.capture_screenshot(identifier=locator, action=f"before-{action}") diff --git a/pages/pg_login.py b/pages/pg_login.py index 95efe663d3a..ecfc3a84e79 100644 --- a/pages/pg_login.py +++ b/pages/pg_login.py @@ -46,3 +46,10 @@ def perform_invalid_login(self, user: str, pwd: str, expected_message: str) -> s def perform_logout(self): self.po.perform_action(locator=self.BTN_LOGOUT, action=actions.CLICK_BUTTON) + + def go_to_url(self, url: str) -> None: + _full_url = f"{self.ce.service_url.replace("/start","")}{url}" if url.startswith("/") else url + self.ce.page.goto(_full_url) + + def go_to_login_page(self) -> None: + self.ce.page.goto(self.ce.service_url) diff --git a/pages/pg_sessions.py b/pages/pg_sessions.py index 6449842ea4f..979370c46df 100644 --- a/pages/pg_sessions.py +++ b/pages/pg_sessions.py @@ -59,6 +59,7 @@ class pg_sessions: LBL_CHILD_NOT_COMPETENT = "Child assessed as not Gillick competent" LNK_EDIT_GILLICK_COMPETENCE = "Edit Gillick competence" BTN_UPDATE_GILLICK_ASSESSMENT = "Update your assessment" + LNK_CONSENT_FORM = "View parental consent form (" def __get_display_formatted_date(self, date_to_format: str) -> str: _parsed_date = datetime.strptime(date_to_format, "%Y%m%d") @@ -333,3 +334,6 @@ def set_gillick_competence_for_student(self): self.add_gillick_competence(is_competent=True, competence_details="Gillick competent") self.click_edit_gillick_competence() self.edit_gillick_competence(is_competent=False, competence_details="Not Gillick competent") + + def get_consent_url(self) -> str: + return self.po.get_object_property(locator=self.LNK_CONSENT_FORM, property=object_properties.HREF) diff --git a/pytest.ini b/pytest.ini index edff0dfd839..d35a3efa9ed 100644 --- a/pytest.ini +++ b/pytest.ini @@ -23,3 +23,4 @@ markers = childlist vaccsbatch rav + bugs diff --git a/test_data/ParentalConsent.xlsx b/test_data/ParentalConsent.xlsx index 1f6f331f9c7..4d126559df5 100644 Binary files a/test_data/ParentalConsent.xlsx and b/test_data/ParentalConsent.xlsx differ diff --git a/test_data/child/o_invalid_structure.csv b/test_data/child/o_invalid_structure.csv index c9671f0d6a2..559e3b1128c 100644 --- a/test_data/child/o_invalid_structure.csv +++ b/test_data/child/o_invalid_structure.csv @@ -1 +1 @@ -The file is missing the following headers: ["CHILD_DATE_OF_BIRTH", "CHILD_FIRST_NAME", "CHILD_LAST_NAME", "CHILD_POSTCODE", "CHILD_SCHOOL_URN"] +The file is missing the following headers: CHILD_DATE_OF_BIRTH, CHILD_FIRST_NAME, CHILD_LAST_NAME, CHILD_POSTCODE, CHILD_SCHOOL_URN diff --git a/test_data/child/o_negative.csv b/test_data/child/o_negative.csv index 8e711652d07..6ce6ae158b1 100644 --- a/test_data/child/o_negative.csv +++ b/test_data/child/o_negative.csv @@ -7,7 +7,7 @@ Records could not be imported The records cannot be uploaded due to errors in the CSV file. When fixing these errors, note that the header does not count as a row. Row 1 CHILD_FIRST_NAME: is required but missing Row 2 CHILD_LAST_NAME: is required but missing -Row 3 CHILD_SCHOOL_URN: is not included in the list +Row 3 CHILD_SCHOOL_URN: The school URN is not recognised. If you’ve checked the URN, and you believe it’s valid, contact our support organisation. Row 4 CHILD_DATE_OF_BIRTH: is required but missing Row 5 CHILD_NHS_NUMBER: is the wrong length (should be 10 characters) Row 6 CHILD_NHS_NUMBER: is the wrong length (should be 10 characters) diff --git a/test_data/class_list/o_invalid_structure.csv b/test_data/class_list/o_invalid_structure.csv index 27abbe18de3..8d12f9b3629 100644 --- a/test_data/class_list/o_invalid_structure.csv +++ b/test_data/class_list/o_invalid_structure.csv @@ -1 +1 @@ -The file is missing the following headers: ["CHILD_DATE_OF_BIRTH", "CHILD_FIRST_NAME", "CHILD_LAST_NAME"] +There is a problemThe file is missing the following headers: CHILD_DATE_OF_BIRTH, CHILD_FIRST_NAME, CHILD_LAST_NAME diff --git a/test_data/cohorts/o_invalid_structure.csv b/test_data/cohorts/o_invalid_structure.csv index c9671f0d6a2..559e3b1128c 100644 --- a/test_data/cohorts/o_invalid_structure.csv +++ b/test_data/cohorts/o_invalid_structure.csv @@ -1 +1 @@ -The file is missing the following headers: ["CHILD_DATE_OF_BIRTH", "CHILD_FIRST_NAME", "CHILD_LAST_NAME", "CHILD_POSTCODE", "CHILD_SCHOOL_URN"] +The file is missing the following headers: CHILD_DATE_OF_BIRTH, CHILD_FIRST_NAME, CHILD_LAST_NAME, CHILD_POSTCODE, CHILD_SCHOOL_URN diff --git a/test_data/cohorts/o_negative.csv b/test_data/cohorts/o_negative.csv index f78cc7c8858..ba251558eeb 100644 --- a/test_data/cohorts/o_negative.csv +++ b/test_data/cohorts/o_negative.csv @@ -2,8 +2,8 @@ Records could not be imported Row 1 CHILD_FIRST_NAME: is required but missing Row 2 CHILD_LAST_NAME: is required but missing Row 4 CHILD_DATE_OF_BIRTH: is required but missing -Row 6 CHILD_SCHOOL_URN: is not included in the list -Row 7 CHILD_SCHOOL_URN: is not included in the list +Row 6 CHILD_SCHOOL_URN: The school URN is not recognised. If you’ve checked the URN, and you believe it’s valid, contact our support organisation. +Row 7 CHILD_SCHOOL_URN: The school URN is not recognised. If you’ve checked the URN, and you believe it’s valid, contact our support organisation. Row 8 CHILD_POSTCODE: is required but missing Row 9 PARENT_1_EMAIL: ‘example.com’ should be a valid email address, like j.doe@example.com Row 10 PARENT_2_EMAIL: ‘example.com’ should be a valid email address, like j.doe@example.com diff --git a/test_data/hpv/i_dup_1.csv b/test_data/hpv/i_dup_1.csv index 59d7eeb7eaa..7ed6700be8f 100644 --- a/test_data/hpv/i_dup_1.csv +++ b/test_data/hpv/i_dup_1.csv @@ -1,2 +1,2 @@ -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 -R1L,120026,shaftesbury junior school,9316984933,Forename_5,Surname_5,20120108,Male,WF2 9AB,20241001,Cervarix,270916878,20250730,Left Buttock,1,Y,1 +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,<>,Gardasil9,AutoBatch1,20301231,Left Thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, diff --git a/test_data/hpv/i_dup_2.csv b/test_data/hpv/i_dup_2.csv index 59d7eeb7eaa..7ed6700be8f 100644 --- a/test_data/hpv/i_dup_2.csv +++ b/test_data/hpv/i_dup_2.csv @@ -1,2 +1,2 @@ -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 -R1L,120026,shaftesbury junior school,9316984933,Forename_5,Surname_5,20120108,Male,WF2 9AB,20241001,Cervarix,270916878,20250730,Left Buttock,1,Y,1 +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,<>,Gardasil9,AutoBatch1,20301231,Left Thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, diff --git a/test_data/hpv/i_negative.csv b/test_data/hpv/i_negative.csv index dda14a75c99..ebe02891638 100644 --- a/test_data/hpv/i_negative.csv +++ b/test_data/hpv/i_negative.csv @@ -13,7 +13,7 @@ N_FutureDOB,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20 N_NonLeapYearDOB,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100229,Male,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, N_EmptyGender,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, N_InvalidGender,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Transgender,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -N_EmptyPostCode,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, +N_EmptyPostCode,R1L,142181,Bohunt School Wokingham,,<>,<>,20100228,Female,,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, N_InvalidPostCode,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,1AA AA1,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, N_EmptyVaccDate,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, N_FutureVaccDate,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,20301231,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, @@ -31,6 +31,6 @@ N_InvalidProfSName,R1L,142181,Bohunt School Wokingham,<>,<>,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@invalid-example.com,Clinic,12:00, N_InvalidClinic,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,2,,,nurse.joy@example.com,Invalid Clinic,12:00, N_InvalidTime,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,,32:00, -N_InvalidReason,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,,32:00,Did not attend1 -N_InvalidVaccinatedFlag,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,X,1,,,nurse.joy@example.com,,32:00, -N_InvalidCareSetting,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,10,,,nurse.joy@example.com,,32:00, +N_InvalidReason,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,1,,,nurse.joy@example.com,,12:00,Did not attend1 +N_InvalidVaccinatedFlag,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,X,1,,,nurse.joy@example.com,,12:00, +N_InvalidCareSetting,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100228,Female,DN9 1PB,<>,Gardasil9,Batch1,20301231,left thigh,1,Y,10,,,nurse.joy@example.com,,12:00, diff --git a/test_data/hpv/i_positive.csv b/test_data/hpv/i_positive.csv index 33f110332f6..3d4b5f8f161 100644 --- a/test_data/hpv/i_positive.csv +++ b/test_data/hpv/i_positive.csv @@ -2,9 +2,9 @@ TEST_DESC_IGNORED,ORGANISATION_CODE,SCHOOL_URN,SCHOOL_NAME,NHS_NUMBER,PERSON_FOR P_Gardasil9,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,Gardasil9,AutoBatch1,20301231,Left Thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, P_Gardasil,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,Gardasil,AutoBatch1,20301231,Right Thigh,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, P_Cervarix,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,Cervarix,AutoBatch1,20301231,left upper arm,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -P_NFA,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3VZ,<>,Cervarix9,AutoBatch1,20301231,left arm (upper position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -P_Add_Not_Known,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3WZ,<>,Cervarix9,AutoBatch1,20301231,left arm (lower position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -P_AllowPastExpiryDate,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3WZ,<>,Cervarix9,AutoBatch1,20120730,right upper arm,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -P_SiteRAU,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3WZ,<>,Cervarix9,AutoBatch1,20320730,right arm (upper position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -P_SiteRAL,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3WZ,<>,Cervarix9,AutoBatch1,20320730,right arm (lower position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, -P_NotVaccinated,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3WZ,<>,Cervarix9,AutoBatch1,20320730,right arm (upper position),1,N,1,,,nurse.joy@example.com,Clinic,12:00,Did not attend +P_NFA,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3VZ,<>,Gardasil9,AutoBatch1,20301231,left arm (upper position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, +P_Add_Not_Known,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,ZZ99 3WZ,<>,Gardasil9,AutoBatch1,20301231,left arm (lower position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, +P_AllowPastExpiryDate,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,Gardasil9,AutoBatch1,20120730,right upper arm,1,Y,1,,,nurse.joy@example.com,Clinic,12:00, +P_SiteRAU,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,Gardasil9,AutoBatch1,20320730,right arm (upper position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, +P_SiteRAL,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,Gardasil9,AutoBatch1,20320730,right arm (lower position),1,Y,1,,,nurse.joy@example.com,Clinic,12:00, +P_NotVaccinated,R1L,142181,Bohunt School Wokingham,<>,<>,<>,20100811,Male,DN9 1PB,<>,,,,,1,N,1,,,nurse.joy@example.com,Clinic,12:00,Did not attend diff --git a/test_data/hpv/o_invalid_structure.csv b/test_data/hpv/o_invalid_structure.csv index 8b7777d1274..99c9788dd1c 100644 --- a/test_data/hpv/o_invalid_structure.csv +++ b/test_data/hpv/o_invalid_structure.csv @@ -1 +1 @@ -The file is missing the following headers: ["ORGANISATION_CODE", "SCHOOL_URN", "SCHOOL_NAME", "NHS_NUMBER", "PERSON_FORENAME", "PERSON_SURNAME", "PERSON_DOB", "PERSON_POSTCODE", "DATE_OF_VACCINATION", "VACCINE_GIVEN", "BATCH_NUMBER", "BATCH_EXPIRY_DATE", "ANATOMICAL_SITE"] +The file is missing the following headers: ORGANISATION_CODE, SCHOOL_URN, SCHOOL_NAME, NHS_NUMBER, PERSON_FORENAME, PERSON_SURNAME, PERSON_DOB, PERSON_POSTCODE, DATE_OF_VACCINATION, VACCINE_GIVEN, BATCH_NUMBER, BATCH_EXPIRY_DATE, ANATOMICAL_SITE diff --git a/test_data/hpv/o_negative.csv b/test_data/hpv/o_negative.csv index 34b9f1e699f..2a49f5517da 100644 --- a/test_data/hpv/o_negative.csv +++ b/test_data/hpv/o_negative.csv @@ -16,15 +16,19 @@ Row 15 PERSON_POSTCODE: Enter a valid postcode, such as SW1A 1AA Row 16 PERSON_POSTCODE: Enter a valid postcode, such as SW1A 1AA Row 17 DATE_OF_VACCINATION: Enter a date in the correct format Row 18 DATE_OF_VACCINATION: The vaccination date is outside the programme. Enter a date before today. -Row 19 VACCINE_GIVEN: Enter a valid vaccine, eg Gardasil 9. -Row 20 VACCINE_GIVEN: Enter a valid vaccine, eg Gardasil 9. +Row 19 VACCINE_GIVEN: Enter a valid vaccine, eg Gardasil9. +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 24 ANATOMICAL_SITE: Enter a anatomical site that is appropriate for the vaccine. 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 28 CARE_SETTING: Enter a valid care setting. -Row 32 PERFORMING_PROFESSIONAL_EMAIL: Enter a valid email address -Row 34 TIME_OF_VACCINATION: Enter a time in the correct format -Row 35 REASON_NOT_VACCINATED: Enter a reason +Row 28 PERFORMING_PROFESSIONAL_EMAIL: Enter a valid email address +Row 29 PERFORMING_PROFESSIONAL_EMAIL: Enter a valid email address +Row 30 PERFORMING_PROFESSIONAL_EMAIL: Enter a valid email address +Row 31 CLINIC_NAME: Enter a clinic name +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. diff --git a/test_data/hpv/o_positive.csv b/test_data/hpv/o_positive.csv index d08e9408e5c..1e717177385 100644 --- a/test_data/hpv/o_positive.csv +++ b/test_data/hpv/o_positive.csv @@ -2,4 +2,4 @@ Completed Programme HPV Type Immunisation list Imported by Nurse Joy -15 vaccination records +9 vaccination records diff --git a/tests/test_02_sessions.py b/tests/test_02_sessions.py index ce5dcac32ab..0360b78fb5a 100644 --- a/tests/test_02_sessions.py +++ b/tests/test_02_sessions.py @@ -8,23 +8,24 @@ class Test_Regression_Sessions: dashboard_page = pg_dashboard.pg_dashboard() sessions_page = pg_sessions.pg_sessions() - @pytest.mark.sessions - @pytest.mark.order(201) - def test_reg_create_valid_session(self, start_mavis): + @pytest.fixture + def test_setup(self, start_mavis): self.login_page.perform_valid_login() self.dashboard_page.click_sessions() + yield + self.login_page.perform_logout() + + @pytest.mark.sessions + @pytest.mark.order(201) + def test_reg_create_valid_session(self, test_setup): self.sessions_page.schedule_a_valid_session() @pytest.mark.sessions @pytest.mark.order(202) - def test_reg_delete_all_sessions(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_sessions() + def test_reg_delete_all_sessions(self, test_setup): self.sessions_page.delete_all_sessions() @pytest.mark.sessions @pytest.mark.order(203) - def test_reg_create_invalid_session(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_sessions() + def test_reg_create_invalid_session(self, test_setup): self.sessions_page.create_invalid_session() diff --git a/tests/test_03_class_list_upload.py b/tests/test_03_class_list_upload.py index c416aae8bbc..37db4f4da02 100644 --- a/tests/test_03_class_list_upload.py +++ b/tests/test_03_class_list_upload.py @@ -10,7 +10,7 @@ class Test_Regression_Class_List_Upload: sessions_page = pg_sessions.pg_sessions() @pytest.fixture() - def create_session(self, start_mavis: None): + def test_setup(self, start_mavis: None): self.login_page.perform_valid_login() self.dashboard_page.click_sessions() self.sessions_page.schedule_a_valid_session() @@ -23,25 +23,25 @@ def create_session(self, start_mavis: None): @pytest.mark.classlist @pytest.mark.order(301) - def test_reg_class_list_file_upload_positive(self, create_session: None): + def test_reg_class_list_file_upload_positive(self, test_setup: None): self.sessions_page.upload_class_list(file_paths=test_data_file_paths.CLASS_POSITIVE) @pytest.mark.classlist @pytest.mark.order(302) - def test_reg_class_list_file_upload_negative(self, create_session: None): + def test_reg_class_list_file_upload_negative(self, test_setup: None): self.sessions_page.upload_class_list(file_paths=test_data_file_paths.CLASS_NEGATIVE) @pytest.mark.classlist @pytest.mark.order(303) - def test_reg_class_list_file_structure(self, create_session: None): + def test_reg_class_list_file_structure(self, test_setup: None): self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_INVALID_STRUCTURE) @pytest.mark.classlist @pytest.mark.order(304) - def test_reg_class_list_no_record(self, create_session: None): + def test_reg_class_list_no_record(self, test_setup: None): self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_HEADER_ONLY) @pytest.mark.classlist @pytest.mark.order(305) - def test_reg_class_list_empty_file(self, create_session: None): + def test_reg_class_list_empty_file(self, test_setup: None): self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_EMPTY_FILE) diff --git a/tests/test_04_cohorts.py b/tests/test_04_cohorts.py index 2ee39060f11..5f0d79f0096 100644 --- a/tests/test_04_cohorts.py +++ b/tests/test_04_cohorts.py @@ -9,37 +9,34 @@ class Test_Regression_Cohorts: dashboard_page = pg_dashboard.pg_dashboard() programmes_page = pg_programmes.pg_programmes() - @pytest.mark.cohorts - @pytest.mark.order(401) - def test_reg_cohort_upload_positive(self, start_mavis): + @pytest.fixture() + def test_setup(self, start_mavis: None): self.login_page.perform_valid_login() self.dashboard_page.click_programmes() + yield + self.login_page.perform_logout() + + @pytest.mark.cohorts + @pytest.mark.order(401) + def test_reg_cohort_upload_positive(self, test_setup): self.programmes_page.upload_cohorts(file_paths=test_data_file_paths.COHORTS_POSITIVE) @pytest.mark.cohorts @pytest.mark.order(402) - def test_reg_cohort_upload_negative(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_cohort_upload_negative(self, test_setup): self.programmes_page.upload_cohorts(file_paths=test_data_file_paths.COHORTS_NEGATIVE) @pytest.mark.cohorts @pytest.mark.order(403) - def test_reg_cohorts_file_structure(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_cohorts_file_structure(self, test_setup): self.programmes_page.upload_invalid_cohorts(file_paths=test_data_file_paths.COHORTS_INVALID_STRUCTURE) @pytest.mark.cohorts @pytest.mark.order(404) - def test_reg_cohorts_no_record(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_cohorts_no_record(self, test_setup): self.programmes_page.upload_invalid_cohorts(file_paths=test_data_file_paths.COHORTS_HEADER_ONLY) @pytest.mark.cohorts @pytest.mark.order(405) - def test_reg_cohorts_empty_file(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_cohorts_empty_file(self, test_setup): self.programmes_page.upload_invalid_cohorts(file_paths=test_data_file_paths.COHORTS_EMPTY_FILE) diff --git a/tests/test_05_child_list_upload.py b/tests/test_05_child_list_upload.py index 3e2622d9954..df98bf2fc84 100644 --- a/tests/test_05_child_list_upload.py +++ b/tests/test_05_child_list_upload.py @@ -9,37 +9,34 @@ class Test_Regression_Child_List_Upload: dashboard_page = pg_dashboard.pg_dashboard() programmes_page = pg_programmes.pg_programmes() - @pytest.mark.childlist - @pytest.mark.order(501) - def test_reg_child_list_file_upload_positive(self, start_mavis): + @pytest.fixture() + def test_setup(self, start_mavis: None): self.login_page.perform_valid_login() self.dashboard_page.click_programmes() + yield + self.login_page.perform_logout() + + @pytest.mark.childlist + @pytest.mark.order(501) + def test_reg_child_list_file_upload_positive(self, test_setup): self.programmes_page.upload_hpv_child_records(file_paths=test_data_file_paths.CHILD_POSITIVE) @pytest.mark.childlist @pytest.mark.order(502) - def test_reg_child_list_file_upload_negative(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_child_list_file_upload_negative(self, test_setup): self.programmes_page.upload_hpv_child_records(file_paths=test_data_file_paths.CHILD_NEGATIVE) @pytest.mark.childlist @pytest.mark.order(503) - def test_reg_child_list_file_structure(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_child_list_file_structure(self, test_setup): self.programmes_page.upload_invalid_hpv_child_records(file_paths=test_data_file_paths.CHILD_INVALID_STRUCTURE) @pytest.mark.childlist @pytest.mark.order(504) - def test_reg_child_list_no_record(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_child_list_no_record(self, test_setup): self.programmes_page.upload_invalid_hpv_child_records(file_paths=test_data_file_paths.CHILD_HEADER_ONLY) @pytest.mark.childlist @pytest.mark.order(505) - def test_reg_child_list_empty_file(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_programmes() + def test_reg_child_list_empty_file(self, test_setup): self.programmes_page.upload_invalid_hpv_child_records(file_paths=test_data_file_paths.CHILD_EMPTY_FILE) diff --git a/tests/test_06_vaccs_batch.py b/tests/test_06_vaccs_batch.py index 0c4c7a9b974..be3245369ec 100644 --- a/tests/test_06_vaccs_batch.py +++ b/tests/test_06_vaccs_batch.py @@ -8,38 +8,37 @@ class Test_Regression_Cohorts: dashboard_page = pg_dashboard.pg_dashboard() vaccines_page = pg_vaccines.pg_vaccines() + @pytest.fixture + def test_setup(self, start_mavis): + self.login_page.perform_valid_login() + self.dashboard_page.click_vaccines() + yield + self.login_page.perform_logout() + @pytest.mark.vaccsbatch @pytest.mark.mobile @pytest.mark.order(601) - def test_reg_batch_add_batch(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_vaccines() + def test_reg_batch_add_batch(self, test_setup): self.vaccines_page.add_batch() @pytest.mark.vaccsbatch @pytest.mark.mobile @pytest.mark.order(602) - def test_reg_batch_change_batch(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_vaccines() + def test_reg_batch_change_batch(self, test_setup): self.vaccines_page.add_batch() self.vaccines_page.change_batch() @pytest.mark.vaccsbatch @pytest.mark.mobile @pytest.mark.order(603) - def test_reg_batch_archive_batch(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_vaccines() + def test_reg_batch_archive_batch(self, test_setup): self.vaccines_page.add_batch() self.vaccines_page.archive_batch() @pytest.mark.vaccsbatch @pytest.mark.mobile @pytest.mark.order(604) - def test_reg_batch_add_change_archive_batch(self, start_mavis): - self.login_page.perform_valid_login() - self.dashboard_page.click_vaccines() + def test_reg_batch_add_change_archive_batch(self, test_setup): self.vaccines_page.add_batch() self.vaccines_page.change_batch() self.vaccines_page.archive_batch() diff --git a/tests/test_07_record_a_vaccine_using_ui.py b/tests/test_07_record_a_vaccine_using_ui.py index 7fa7c147890..1e05c3a8d61 100644 --- a/tests/test_07_record_a_vaccine_using_ui.py +++ b/tests/test_07_record_a_vaccine_using_ui.py @@ -10,7 +10,7 @@ class Test_Regression_Record_a_Vaccine_Using_UI: sessions_page = pg_sessions.pg_sessions() @pytest.fixture() - def create_session(self, start_mavis: None): + def test_setup(self, start_mavis: None): self.login_page.perform_valid_login() self.dashboard_page.click_sessions() self.sessions_page.schedule_a_valid_session() @@ -24,5 +24,5 @@ def create_session(self, start_mavis: None): @pytest.mark.rav @pytest.mark.order(701) - def test_reg_rav_triage_positive(self, create_session): + def test_reg_rav_triage_positive(self, test_setup): self.sessions_page.update_triage_outcome_positive(file_paths=test_data_file_paths.COHORTS_POSITIVE) diff --git a/tests/test_08_vaccs_upload.py b/tests/test_08_vaccs_upload.py index 7c7dba44ddb..a34ac472fe3 100644 --- a/tests/test_08_vaccs_upload.py +++ b/tests/test_08_vaccs_upload.py @@ -11,7 +11,7 @@ class Test_Regression_Vaccinations_Upload: sessions_page = pg_sessions.pg_sessions() @pytest.fixture() - def create_session(self, start_mavis: None): + def test_setup(self, start_mavis: None): self.login_page.perform_valid_login() self.dashboard_page.click_sessions() self.sessions_page.schedule_a_valid_session(for_today=True) @@ -24,17 +24,17 @@ def create_session(self, start_mavis: None): @pytest.mark.vaccinations @pytest.mark.order(801) - def test_reg_hpv_positive_file_upload(self, start_mavis): + def test_reg_hpv_positive_file_upload(self, test_setup): self.programmes_page.upload_hpv_vaccination_records(file_paths=test_data_file_paths.VACCS_HPV_POSITIVE) @pytest.mark.vaccinations @pytest.mark.order(802) - def test_reg_hpv_negative_file_upload(self, create_session): + def test_reg_hpv_negative_file_upload(self, test_setup): self.programmes_page.upload_hpv_vaccination_records(file_paths=test_data_file_paths.VACCS_HPV_NEGATIVE) @pytest.mark.vaccinations @pytest.mark.order(803) - def test_reg_hpv_duplicate_record_upload(self, start_mavis): + def test_reg_hpv_duplicate_record_upload(self, test_setup): self.programmes_page.upload_hpv_vaccination_records(file_paths=test_data_file_paths.VACCS_HPV_DUP_1) self.dashboard_page.go_to_dashboard() self.dashboard_page.click_programmes() @@ -42,15 +42,15 @@ def test_reg_hpv_duplicate_record_upload(self, start_mavis): @pytest.mark.vaccinations @pytest.mark.order(804) - def test_reg_hpv_file_structure(self, start_mavis): + def test_reg_hpv_file_structure(self, test_setup): self.programmes_page.upload_invalid_files(file_paths=test_data_file_paths.VACCS_HPV_INVALID_STRUCTURE) @pytest.mark.vaccinations @pytest.mark.order(805) - def test_reg_hpv_no_record(self, start_mavis): + def test_reg_hpv_no_record(self, test_setup): self.programmes_page.upload_invalid_files(file_paths=test_data_file_paths.VACCS_HPV_HEADER_ONLY) @pytest.mark.vaccinations @pytest.mark.order(806) - def test_reg_hpv_empty_file(self, start_mavis): + def test_reg_hpv_empty_file(self, test_setup): self.programmes_page.upload_invalid_files(file_paths=test_data_file_paths.VACCS_HPV_EMPTY_FILE) diff --git a/tests/test_10_consent.py b/tests/test_09_consent.py similarity index 54% rename from tests/test_10_consent.py rename to tests/test_09_consent.py index da5672af913..f29c1d6a4ec 100644 --- a/tests/test_10_consent.py +++ b/tests/test_09_consent.py @@ -13,7 +13,7 @@ class Test_Regression_Consent: sessions_page = pg_sessions.pg_sessions() @pytest.fixture() - def create_session(self, start_mavis: None): + def test_setup(self, start_mavis: None): self.login_page.perform_valid_login() self.dashboard_page.click_sessions() self.sessions_page.schedule_a_valid_session(for_today=True) @@ -27,16 +27,39 @@ def create_session(self, start_mavis: None): self.dashboard_page.click_sessions() self.sessions_page.delete_all_sessions() + @pytest.fixture + def get_session_link(self, start_mavis): + self.login_page.perform_valid_login() + self.dashboard_page.click_sessions() + self.sessions_page.schedule_a_valid_session() + link = self.sessions_page.get_consent_url() + self.login_page.perform_logout() + yield link + self.login_page.go_to_login_page + self.login_page.perform_valid_login() + self.dashboard_page.click_sessions() + self.sessions_page.delete_all_sessions() + + # @pytest.mark.consent + # @pytest.mark.mobile + # @pytest.mark.order(901) + # @pytest.mark.parametrize("scenario_data", helper.df.iterrows(), ids=[_tc[0] for _tc in helper.df.iterrows()]) + # def test_reg_parental_consent_workflow(self, start_consent_workflow, scenario_data): + # self.helper.read_data_for_scenario(scenario_data=scenario_data) + # self.helper.enter_details() + @pytest.mark.consent @pytest.mark.mobile - @pytest.mark.order(1001) + @pytest.mark.order(901) + @pytest.mark.skip(reason="Under maintenance") @pytest.mark.parametrize("scenario_data", helper.df.iterrows(), ids=[_tc[0] for _tc in helper.df.iterrows()]) - def test_reg_parental_consent_workflow(self, start_consent_workflow, scenario_data): + def test_reg_parental_consent_workflow(self, get_session_link, scenario_data): + self.login_page.go_to_url(url=get_session_link) self.helper.read_data_for_scenario(scenario_data=scenario_data) self.helper.enter_details() @pytest.mark.consent @pytest.mark.mobile - @pytest.mark.order(1002) - def test_reg_gillick_competence(self, create_session): + @pytest.mark.order(902) + def test_reg_gillick_competence(self, test_setup): self.sessions_page.set_gillick_competence_for_student()