generated from NHSDigital/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1b26db
commit 0355988
Showing
15 changed files
with
292 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from libs import CurrentExecution, playwright_ops | ||
from libs.constants import actions, object_properties, wait_time | ||
from libs.wrappers import * | ||
|
||
|
||
class pg_children: | ||
po = playwright_ops.playwright_operations() | ||
ce = CurrentExecution() | ||
|
||
LBL_CHILDREN = "Children" | ||
LBL_HEADING = "heading" | ||
LBL_MAIN = "main" | ||
LBL_TABLE_HEADERS = "Full name NHS number Date of birth Postcode School" | ||
|
||
def verify_headers(self): | ||
self.po.verify(locator=self.LBL_HEADING, property=object_properties.TEXT, value=self.LBL_CHILDREN, exact=True) | ||
self.po.verify(locator=self.LBL_MAIN, property=object_properties.TEXT, value=self.LBL_TABLE_HEADERS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
import re | ||
|
||
from playwright.sync_api import expect | ||
|
||
from libs import CurrentExecution, file_ops, playwright_ops, testdata_ops | ||
from libs.constants import actions, object_properties, wait_time | ||
from libs.wrappers import * | ||
from pages import pg_dashboard | ||
|
||
|
||
class pg_sessions: | ||
po = playwright_ops.playwright_operations() | ||
ce = CurrentExecution() | ||
tdo = testdata_ops.testdata_operations() | ||
fo = file_ops.file_operations() | ||
dashboard_page = pg_dashboard.pg_dashboard() | ||
|
||
LNK_SCHEDULED = "Scheduled" | ||
LNK_UNSCHEDULED = "Unscheduled" | ||
LNK_SCHOOL = "The Ruiz Centre" | ||
LNK_IMPORT_CLASS_LIST = "Import class list" | ||
LBL_CHOOSE_COHORT_FILE = "The Ruiz CentreImport class" | ||
BTN_CONTINUE = "Continue" | ||
LNK_ADD_SESSION_DATES = "Add session dates" | ||
LNK_RECORD_VACCINATIONS = "Record vaccinations" | ||
LNK_CHILD_FULL_NAME = "ChildFirst28 ChildLast28" | ||
LNK_UPDATE_TRIAGE_OUTCOME = "Update triage outcome" | ||
LNK_SCHEDULE_SESSIONS = "Schedule sessions" | ||
RDO_YES_SAFE_TO_VACCINATE = "Yes, it’s safe to vaccinate" | ||
BTN_SAVE_TRIAGE = "Save triage" | ||
LBL_PARAGRAPH = "paragraph" | ||
LBL_TRIAGE_UPDATED_MESSAGE = "Triage outcome updated for ChildFirst28 ChildLast28" | ||
LBL_MAIN = "main" | ||
TXT_DAY = "Day" | ||
TXT_MONTH = "Month" | ||
TXT_YEAR = "Year" | ||
LNK_EDIT_SESSION = "Edit session" | ||
LNK_CHANGE_SESSION_DATES = "Change session dates" | ||
BTN_DELETE = "Delete" | ||
LNK_CANCEL = "Cancel" | ||
LNK_CONTINUE = "Continue" | ||
|
||
def get_display_formatted_date(self, date_to_format: str) -> str: | ||
_parsed_date = datetime.strptime(date_to_format, "%Y%m%d") | ||
_formatted_date = _parsed_date.strftime("%A %d %B %Y").replace(" 0", " ") | ||
return _formatted_date | ||
|
||
def click_Scheduled(self): | ||
self.po.perform_action(locator=self.LNK_SCHEDULED, action=actions.CLICK_LINK, exact=True) | ||
|
||
def click_Unscheduled(self): | ||
self.po.perform_action(locator=self.LNK_UNSCHEDULED, action=actions.CLICK_LINK, exact=True) | ||
|
||
def click_School(self): | ||
self.po.perform_action(locator=self.LNK_SCHOOL, action=actions.CLICK_LINK) | ||
|
||
def click_Import_Class_List(self): | ||
self.po.perform_action(locator=self.LNK_IMPORT_CLASS_LIST, action=actions.CLICK_LINK) | ||
|
||
def click_Continue(self): | ||
self.po.perform_action(locator=self.BTN_CONTINUE, action=actions.CLICK_BUTTON) | ||
|
||
def choose_file_child_records(self, file_path: str): | ||
self.po.perform_action( | ||
locator=self.LBL_CHOOSE_COHORT_FILE, | ||
action=actions.SELECT_FILE, | ||
value=file_path, | ||
) | ||
|
||
def click_Record_Vaccinations(self): | ||
self.po.perform_action(locator=self.LNK_RECORD_VACCINATIONS, action=actions.CLICK_LINK) | ||
|
||
def click_child_full_name(self): | ||
self.po.perform_action(locator=self.LNK_CHILD_FULL_NAME, action=actions.CLICK_LINK) | ||
|
||
def click_Update_Triage_Outcome(self): | ||
self.po.perform_action(locator=self.LNK_UPDATE_TRIAGE_OUTCOME, action=actions.CLICK_LINK) | ||
|
||
def select_Yes_Safe_To_Vaccinate(self): | ||
self.po.perform_action(locator=self.RDO_YES_SAFE_TO_VACCINATE, action=actions.RADIO_BUTTON_SELECT) | ||
|
||
def click_Save_Triage(self): | ||
self.po.perform_action(locator=self.BTN_SAVE_TRIAGE, action=actions.CLICK_BUTTON) | ||
|
||
def __schedule_session(self, future_date: str, expect_error: bool): | ||
_day = future_date[-2:] | ||
_month = future_date[4:6] | ||
_year = future_date[:4] | ||
self.po.perform_action(locator=self.LNK_SCHEDULE_SESSIONS, action=actions.CLICK_LINK) | ||
self.po.perform_action(locator=self.LNK_ADD_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.BTN_CONTINUE, action=actions.CLICK_BUTTON) | ||
if expect_error: | ||
_expected_message = "There is a problem Enter a date" | ||
self.po.verify( | ||
locator=self.LBL_MAIN, property=object_properties.TEXT, value=_expected_message, exact=False | ||
) | ||
|
||
def __delete_all_sessions(self): | ||
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.BTN_DELETE, action=actions.CLICK_BUTTON) | ||
self.po.perform_action(locator=self.LNK_CANCEL, action=actions.CLICK_LINK) | ||
self.po.perform_action(locator=self.LNK_CONTINUE, action=actions.CLICK_LINK) | ||
# TODO: Use the common verify function | ||
expect( | ||
self.ce.page.locator("div") | ||
.filter(has_text=re.compile(r"^Session datesNot provided$")) | ||
.get_by_role("definition") | ||
).to_be_visible() | ||
|
||
def verify_Triage_Updated(self): | ||
self.po.verify( | ||
locator=self.LBL_PARAGRAPH, | ||
property=object_properties.TEXT, | ||
value=self.LBL_TRIAGE_UPDATED_MESSAGE, | ||
exact=True, | ||
) | ||
|
||
def verify_scheduled_date(self, message: str): | ||
self.po.verify(locator=self.LBL_MAIN, property=object_properties.TEXT, value=message, exact=False) | ||
|
||
def update_triage_outcome_positive(self, file_paths): | ||
_input_file_path, _ = self.tdo.split_file_paths(file_paths=file_paths) | ||
self.click_Scheduled() | ||
self.click_School() | ||
self.click_Import_Class_List() | ||
self.choose_file_child_records(file_path=_input_file_path) | ||
self.click_Continue() | ||
self.dashboard_page.go_to_dashboard() | ||
self.dashboard_page.click_sessions() | ||
self.click_Scheduled() | ||
self.click_School() | ||
self.click_Record_Vaccinations() | ||
self.click_child_full_name() | ||
self.click_Update_Triage_Outcome() | ||
self.select_Yes_Safe_To_Vaccinate() | ||
self.click_Save_Triage() | ||
self.verify_Triage_Updated() | ||
|
||
def schedule_a_valid_session(self): | ||
_future_date = get_future_date(offset_days=10) | ||
_expected_message = f"Session dates {self.get_display_formatted_date(date_to_format=_future_date)}" | ||
self.click_Unscheduled() | ||
self.click_School() | ||
self.__schedule_session(future_date=_future_date, expect_error=False) | ||
self.verify_scheduled_date(message=_expected_message) | ||
|
||
def delete_all_sessions(self): | ||
self.click_Scheduled() | ||
self.click_School() | ||
self.__delete_all_sessions() | ||
|
||
def create_invalid_session(self): | ||
_future_date = "20241332" | ||
self.click_Unscheduled() | ||
self.click_School() | ||
self.__schedule_session(future_date=_future_date, expect_error=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CHILD_FIRST_NAME,CHILD_LAST_NAME,CHILD_COMMON_NAME,CHILD_DATE_OF_BIRTH,CHILD_SCHOOL_URN,CHILD_NHS_NUMBER,CHILD_ADDRESS_LINE_1,CHILD_ADDRESS_LINE_2,CHILD_TOWN,CHILD_POSTCODE,PARENT_1_NAME,PARENT_1_RELATIONSHIP,PARENT_1_EMAIL,PARENT_1_PHONE,PARENT_2_NAME,PARENT_2_RELATIONSHIP,PARENT_2_EMAIL,PARENT_2_PHONE | ||
ChildFirst,ChildLast,ChildCommon,1-1-2010,110158,,Addr1,Add2,City,AA1 1AA,Parent1Name,Dad,dad@example.com,,Parent2Name,Mum,mum@example.com, | ||
ChildFirst28,ChildLast28,ChildCommon,1-1-2009,134522,,Addr1,Add2,City,AA1 1AA,Parent1Name1,Dad,dad1@example.com,,Parent2Name1,Mum,mum1@example.com, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
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,LOCAL_PATIENT_ID,LOCAL_PATIENT_ID_URI,CARE_SETTING | ||
P_Gardasil9,R1L,110158,Eton College,9729852545,BERT,BOYES,20100811,Male,DN9 1PB,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Gardasil,R1L,110158,Eton College,9650974318,BOB,JERMEY,20100819,Male,DN38 6JP,20240514,Gardasil,123013325,20220730,Left Thigh,2,LocalPatient3,www.LocalPatient3,1 | ||
P_Cervarix,R1L,110158,Eton College,5990960948,MURRAY,MARQUARDT,20100808,Male,N8 7RE,20240514,Cervarix,123013325,20220730,Left Thigh,3,LocalPatient3,www.LocalPatient3,1 | ||
P_Gardasil9,R1L,888888,Test-Auto School,9461217986,SHEENA,HART-DAVIS,20100818,Female,HD9 2DD,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Gardasil,R1L,999999,Homeschooled,9448251165,ANDRIANA,MACLULICH,20100813,Female,DN17 1UE,20240514,Gardasil,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Cervarix,R1L,110158,Eton College,9490189804,VISHALA,MOKATE,20100817,Female,LA22 9SJ,20240514,Cervarix,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_NFA,R1L,110158,Eton College,9694580307,LERON,KUFAKI,20100811,Male,ZZ99 3VZ,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Add_Not_Known,R1L,110158,Eton College,9694580307,LERON,KUFAKI,20100811,Male,ZZ99 3WZ,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Site_LB,R1L,110158,Eton College,9694580307,LERON,KUFAKI,20100811,Male,DN34 4SE,20240514,Gardasil9,123013325,20220730,Left Buttock,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Site_RB,R1L,110158,Eton College,9460860354,MATTIE,MERRIGAN,20100831,Male,TS8 9EF,20240514,Gardasil9,123013325,20220730,Right Buttock,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Site_LT,R1L,110158,Eton College,9651751703,SARA,NOYES,20100829,Not Known,HU5 3SG,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Site_LUA,R1L,110158,Eton College,5991336512,HARLEY,PHILLIPS,20100821,Female,ZZ99 3AZ,20240514,Gardasil9,123013325,20220730,Left Upper Arm,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Site_RUA,R1L,110158,Eton College,9454468014,GIDEON,CREAN,20100830,Male,NE39 1AD,20240514,Gardasil9,123013325,20220730,Right Upper Arm,1,LocalPatient3,www.LocalPatient3,1 | ||
P_Site_RT,R1L,110158,Eton College,9686147837,JEFF,GREENE,20100808,Male,SK16 4HT,20240514,Gardasil9,123013325,20220730,Right Thigh,1,LocalPatient3,www.LocalPatient3,1 | ||
P_AllowPastExpiryDate,R1L,110158,Eton College,9448205147,DARIEN,MARGETSON,20100827,Female,BH23 8BY,20240514,Gardasil9,123013325,20120730,Left Thigh,1,www.LocalPatient3,www.LocalPatient3,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,LOCAL_PATIENT_ID,LOCAL_PATIENT_ID_URI,CARE_SETTING,VACCINATED | ||
P_Gardasil9,R1L,110158,Eton College,9729852545,BERT,BOYES,20100811,Male,DN9 1PB,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Gardasil,R1L,110158,Eton College,9650974318,BOB,JERMEY,20100819,Male,DN38 6JP,20240514,Gardasil,123013325,20220730,Left Thigh,2,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Cervarix,R1L,110158,Eton College,5990960948,MURRAY,MARQUARDT,20100808,Male,N8 7RE,20240514,Cervarix,123013325,20220730,Left Thigh,3,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Gardasil9,R1L,888888,Test-Auto School,9461217986,SHEENA,HART-DAVIS,20100818,Female,HD9 2DD,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Gardasil,R1L,999999,Homeschooled,9448251165,ANDRIANA,MACLULICH,20100813,Female,DN17 1UE,20240514,Gardasil,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Cervarix,R1L,110158,Eton College,9490189804,VISHALA,MOKATE,20100817,Female,LA22 9SJ,20240514,Cervarix,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_NFA,R1L,110158,Eton College,9694580307,LERON,KUFAKI,20100811,Male,ZZ99 3VZ,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Add_Not_Known,R1L,110158,Eton College,9694580307,LERON,KUFAKI,20100811,Male,ZZ99 3WZ,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Site_LB,R1L,110158,Eton College,9694580307,LERON,KUFAKI,20100811,Male,DN34 4SE,20240514,Gardasil9,123013325,20220730,Left Buttock,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Site_RB,R1L,110158,Eton College,9460860354,MATTIE,MERRIGAN,20100831,Male,TS8 9EF,20240514,Gardasil9,123013325,20220730,Right Buttock,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Site_LT,R1L,110158,Eton College,9651751703,SARA,NOYES,20100829,Not Known,HU5 3SG,20240514,Gardasil9,123013325,20220730,Left Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Site_LUA,R1L,110158,Eton College,5991336512,HARLEY,PHILLIPS,20100821,Female,ZZ99 3AZ,20240514,Gardasil9,123013325,20220730,Left Upper Arm,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Site_RUA,R1L,110158,Eton College,9454468014,GIDEON,CREAN,20100830,Male,NE39 1AD,20240514,Gardasil9,123013325,20220730,Right Upper Arm,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_Site_RT,R1L,110158,Eton College,9686147837,JEFF,GREENE,20100808,Male,SK16 4HT,20240514,Gardasil9,123013325,20220730,Right Thigh,1,LocalPatient3,www.LocalPatient3,1,Y | ||
P_AllowPastExpiryDate,R1L,110158,Eton College,9448205147,DARIEN,MARGETSON,20100827,Female,BH23 8BY,20240514,Gardasil9,123013325,20120730,Left Thigh,1,www.LocalPatient3,www.LocalPatient3,1,Y | ||
P_NotVaccinated,R1L,110158,Eton College,9448205148,NOT1,VACCINATED1,20100827,Female,BH23 8BY,20240514,Gardasil9,123013325,20120730,Left Thigh,1,www.LocalPatient3,www.LocalPatient3,1,N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
Completed | ||
Programme HPV | ||
Type Immunisation list | ||
Imported by Nurse Joy | ||
Omitted records 8 previously imported records were omitted | ||
Duplicate records 5 duplicate records need review | ||
13 vaccination records |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
|
||
from pages import pg_dashboard, pg_login, pg_sessions | ||
|
||
|
||
class Test_Regression_Sessions: | ||
login_page = pg_login.pg_login() | ||
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, create_browser_page): | ||
self.login_page.perform_valid_login() | ||
self.dashboard_page.click_sessions() | ||
self.sessions_page.schedule_a_valid_session() | ||
|
||
@pytest.mark.sessions | ||
@pytest.mark.order(202) | ||
def test_reg_delete_all_sessions(self, create_browser_page): | ||
self.login_page.perform_valid_login() | ||
self.dashboard_page.click_sessions() | ||
self.sessions_page.delete_all_sessions() | ||
|
||
@pytest.mark.sessions | ||
@pytest.mark.order(203) | ||
def test_reg_create_invalid_schedule(self, create_browser_page): | ||
self.login_page.perform_valid_login() | ||
self.dashboard_page.click_sessions() | ||
self.sessions_page.create_invalid_session() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
|
||
from pages import pg_children, pg_dashboard, pg_login | ||
|
||
|
||
class Test_Regression_Bugs: | ||
login_page = pg_login.pg_login() | ||
dashboard_page = pg_dashboard.pg_dashboard() | ||
children_page = pg_children.pg_children() | ||
|
||
@pytest.mark.bugs | ||
@pytest.mark.order(5001) | ||
def test_reg_children_page(self, create_browser_page): | ||
self.login_page.perform_valid_login() | ||
self.dashboard_page.click_children() | ||
self.children_page.verify_headers() |
Oops, something went wrong.