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
12 changes: 6 additions & 6 deletions pages/datasets/colonoscopy_dataset_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ def select_asa_grade_option(self, option: str) -> None:
"""
This method is designed to select a specific grade option from the colonoscopy dataset page, ASA Grade dropdown menu.
Args:
option (str): The ASA grade option to be selected. This should be a string that matches one of the available options in the dropdown menu.
Valid options are: "FIT", "RELEVANT_DISEASE", "UNABLE_TO_ASSESS", RESTRICTIVE_DISEASE, "LIFE_THREATENING_DISEASE", "MORIBUND", "NOT_APPLICABLE", or "NOT_KNOWN".
option (str): The ASA grade option to be selected. This should be a string that matches one of the available options in the dropdown menu.
Valid options are: "FIT", "RELEVANT_DISEASE", "UNABLE_TO_ASSESS", RESTRICTIVE_DISEASE, "LIFE_THREATENING_DISEASE", "MORIBUND", "NOT_APPLICABLE", or "NOT_KNOWN".
Returns:
None
None
"""
self.select_asa_grade_dropdown.select_option(option)

def select_fit_for_colonoscopy_option(self, option: str) -> None:
"""
This method is designed to select a specific option from the colonoscopy dataset page, Fit for Colonoscopy (SSP) dropdown menu.
Args:
option (str): The option to be selected. This should be a string that matches one of the available options in the dropdown menu.
Valid options are: "YES", "NO", or "UNABLE_TO_ASSESS".
option (str): The option to be selected. This should be a string that matches one of the available options in the dropdown menu.
Valid options are: "YES", "NO", or "UNABLE_TO_ASSESS".
Returns:
None
None
"""
self.select_fit_for_colonoscopy_dropdown.select_option(option)

Expand Down
48 changes: 48 additions & 0 deletions pages/screening_subject_search/contact_with_patient_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from playwright.sync_api import Page
from pages.base_page import BasePage


class ContactWithPatientPage(BasePage):
"""
ContactWithPatientPage class for interacting with 'Contact With Patient' page elements.
"""

def __init__(self, page: Page):
super().__init__(page)
self.page = page

# Contact With Patient - Page Locators
self.contact_direction_dropdown = self.page.locator("#UI_DIRECTION")
self.contact_made_between_patient_and_dropdown = self.page.locator(
"#UI_CALLER_ID"
)
self.calendar_button = self.page.get_by_role("button", name="Calendar")
self.start_time_field = self.page.locator("#UI_START_TIME")
self.end_time_field = self.page.locator("#UI_END_TIME")
self.discussion_record_text_field = self.page.locator("#UI_COMMENT_ID")
self.outcome_dropdown = self.page.locator("#UI_OUTCOME")
self.save_button = self.page.get_by_role("button", name="Save")

def select_direction_dropdown_option(self, direction: str) -> None:
self.contact_direction_dropdown.select_option(label=direction)

def select_caller_id_dropdown_index_option(self, index_value: int) -> None:
self.contact_made_between_patient_and_dropdown.select_option(index=index_value)

def click_calendar_button(self) -> None:
self.click(self.calendar_button)

def enter_start_time(self, start_time: str) -> None:
self.start_time_field.fill(start_time)

def enter_end_time(self, end_time: str) -> None:
self.end_time_field.fill(end_time)

def enter_discussion_record_text(self, value: str) -> None:
self.discussion_record_text_field.fill(value)

def select_outcome_dropdown_option(self, outcome: str) -> None:
self.outcome_dropdown.select_option(label=outcome)

def click_save_button(self) -> None:
self.click(self.save_button)
74 changes: 35 additions & 39 deletions tests/smokescreen/test_compartment_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@
from playwright.sync_api import Page
from pages.logout.log_out_page import Logout
from pages.base_page import BasePage
from pages.screening_practitioner_appointments.appointment_calendar_page import (
AppointmentCalendar,
)
from pages.screening_practitioner_appointments.appointment_detail_page import (
AppointmentDetail,
)
from pages.screening_practitioner_appointments.screening_practitioner_appointments import (
ScreeningPractitionerAppointmentsPage,
)
from pages.screening_practitioner_appointments.screening_practitioner_day_view import (
ScreeningPractitionerDayView,
)
from pages.datasets.subject_datasets_page import (
SubjectDatasetsPage,
)
Expand All @@ -13,24 +22,20 @@
FitForColonoscopySspOptions,
AsaGradeOptions,
)
from pages.screening_subject_search.subject_screening_summary import (
SubjectScreeningSummary,
)
from pages.screening_subject_search.advance_fobt_screening_episode_page import (
AdvanceFOBTScreeningEpisode,
)
from pages.screening_practitioner_appointments.screening_practitioner_day_view import (
ScreeningPractitionerDayView,
)
from pages.screening_practitioner_appointments.appointment_detail_page import (
AppointmentDetail,
)
from pages.screening_practitioner_appointments.appointment_calendar_page import (
AppointmentCalendar,
)
from pages.screening_subject_search.attend_diagnostic_test_page import (
AttendDiagnosticTest,
)
from pages.screening_subject_search.subject_screening_summary import (
SubjectScreeningSummary,
)

from pages.screening_subject_search.contact_with_patient_page import (
ContactWithPatientPage,
)

from utils.user_tools import UserTools
from utils.load_properties_file import PropertiesFile
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
Expand Down Expand Up @@ -76,14 +81,16 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
AppointmentCalendar(page).select_site_dropdown(
smokescreen_properties["c5_eng_site"]
)
# page.get_by_role("link", name="Screening Practitioner").select_option("")

AppointmentCalendar(page).click_view_appointments_on_this_day_button()
ScreeningPractitionerDayView(page).click_calendar_button()
date_from_util = datetime(2025, 4, 30)
date_from_util = datetime(2025, 5, 2)
CalendarPicker(page).v1_calender_picker(date_from_util)
# page.locator("#UI_PRACTITIONER_NDV").select_option("")

# Select subject from inital test data util
ScreeningPractitionerDayView(page).click_patient_link("DIVIDEND MUZZLE")
ScreeningPractitionerDayView(page).click_patient_link("REGALLY DRAGONISH")

# Select Attendance radio button, tick Attended checkbox, set Attended Date to yesterday's (system) date and then press Save
AppointmentDetail(page).check_attendance_radio()
Expand All @@ -96,7 +103,7 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
# Repeat for x Abnormal patients

# Navigate to the 'Subject Screening Summary' screen for the 1st Abnormal patient
nhs_no = "9852356488" # Test NHS NO for DIVIDEND MUZZLE
nhs_no = "9645516129" # Test NHS NO for DIVIDEND MUZZLE
verify_subject_event_status_by_nhs_no(
page, nhs_no, "J10 - Attended Colonoscopy Assessment Appointment"
)
Expand Down Expand Up @@ -151,10 +158,10 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
AdvanceFOBTScreeningEpisode(page).click_attend_diagnostic_test_button()

# Select Colonoscopy from drop down list. Enter the actual appointment date as today's date and select 'Save'
AttendDiagnosticTest.select_actual_type_of_test_dropdown_option("Colonoscopy")
AttendDiagnosticTest.click_calendar_button()
AttendDiagnosticTest(page).select_actual_type_of_test_dropdown_option("Colonoscopy")
AttendDiagnosticTest(page).click_calendar_button()
CalendarPicker(page).v1_calender_picker(datetime.today())
AttendDiagnosticTest.click_save_button()
AttendDiagnosticTest(page).click_save_button()
SubjectScreeningSummary(page).verify_latest_event_status_value(
"A259 - Attended Diagnostic Test"
)
Expand All @@ -178,31 +185,20 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
page
).click_record_other_post_investigation_contact_button()

# Complete 'Contact Direction', To patient
# 'Contact made between patient and', Selects the top option in the dropdown
# 'Date of Patient Contact', Today
# 'Duration', 01:00
# 'Start Time', 11:00
# 'End Time', 12:00
# 'Discussion Record' TEST AUTOMATION
# select 'Outcome' - 'Post-investigation Appointment Not Required' and click 'Save'
page.locator("#UI_DIRECTION").select_option(label="To patient")
page.locator("#UI_CALLER_ID").select_option(index=0)
page.get_by_role("button", name="Calendar").click()
ContactWithPatientPage(page).select_direction_dropdown_option("To patient")
ContactWithPatientPage(page).select_caller_id_dropdown_index_option(1)
ContactWithPatientPage(page).click_calendar_button()
CalendarPicker(page).v1_calender_picker(datetime.today())
page.locator("#UI_START_TIME").click()
page.locator("#UI_START_TIME").fill("11:00")
page.locator("#UI_END_TIME").click()
page.locator("#UI_END_TIME").fill("12:00")
page.locator("#UI_COMMENT_ID").click()
page.locator("#UI_COMMENT_ID").fill("Test Automation")
page.locator("#UI_OUTCOME").select_option(
label="Post-investigation Appointment Not Required"
ContactWithPatientPage(page).enter_start_time("11:00")
ContactWithPatientPage(page).enter_end_time("12:00")
ContactWithPatientPage(page).enter_discussion_record_text("Test Automation")
ContactWithPatientPage(page).select_outcome_dropdown_option(
"Post-investigation Appointment Not Required"
)
page.get_by_role("button", name="Save").click()
ContactWithPatientPage(page).click_save_button()

verify_subject_event_status_by_nhs_no(
page, nhs_no, "A361 - Other Post-investigation Contact Required"
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
)

# Repeat above for x subjects
Expand Down