Skip to content

Commit ce23b1c

Browse files
committed
Resoloving merge conflicts (delete and add reports_page.py)
1 parent 61bccb5 commit ce23b1c

File tree

1 file changed

+205
-0
lines changed

1 file changed

+205
-0
lines changed

pages/reports/reports_page.py

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
from playwright.sync_api import Page
2+
from pages.base_page import BasePage
3+
4+
5+
class ReportsPage(BasePage):
6+
def __init__(self, page):
7+
super().__init__(page)
8+
self.page = page
9+
10+
# Reports page main menu links
11+
self.bureau_reports_link = self.page.get_by_text("Bureau Reports")
12+
self.failsafe_reports_link = self.page.get_by_role(
13+
"link", name="Failsafe Reports"
14+
)
15+
self.operational_reports_link = self.page.get_by_role(
16+
"link", name="Operational Reports"
17+
)
18+
self.strategic_reports_link = self.page.get_by_role(
19+
"link", name="Strategic Reports"
20+
)
21+
self.cancer_waiting_times_reports_link = self.page.get_by_role(
22+
"link", name="Cancer Waiting Times Reports"
23+
)
24+
self.dashboard_link = self.page.get_by_role("link", name="Dashboard")
25+
self.qa_report_dataset_completion_link = self.page.get_by_role(
26+
"link", name="QA Report : Dataset Completion"
27+
)
28+
29+
# Reports pages shared buttons, locators & links
30+
self.refresh_page_button = self.page.get_by_role("button", name="Refresh")
31+
self.reports_update_button = self.page.get_by_role("button", name="Update")
32+
self.report_start_date_field = self.page.get_by_role(
33+
"textbox", name="Report Start Date"
34+
)
35+
self.qa_report_dataset_completion_link = self.page.get_by_text(
36+
"QA Report : Dataset Completion"
37+
)
38+
39+
# Generate Report button locators
40+
self.generate_report_button = self.page.get_by_role(
41+
"button", name="Generate Report"
42+
)
43+
self.operational_reports_sp_appointments_generate_report_button = (
44+
self.page.locator("#submitThisForm")
45+
)
46+
47+
# Set patients screening centre dropdown locators
48+
self.set_patients_screening_centre_dropdown = self.page.locator(
49+
"#cboScreeningCentre"
50+
)
51+
self.six_weeks_availability_not_set_up_set_patients_screening_centre_dropdown = self.page.get_by_label(
52+
"Screening Centre"
53+
)
54+
self.practitioner_appointments_set_patients_screening_centre_dropdown = (
55+
page.get_by_label("Screening Centre")
56+
)
57+
self.attendance_not_updated_set_patients_screening_centre_dropdown = (
58+
page.get_by_label("Screening Centre")
59+
)
60+
61+
# Select screening practitioner dropdown locators
62+
self.screening_practitioner_dropdown = self.page.locator("#A_C_NURSE")
63+
64+
# Report Timestamp locators
65+
self.common_report_timestamp_element = self.page.locator("b")
66+
self.subject_ceased_report_timestamp_element = self.page.locator(
67+
"#displayGenerateDate > tbody > tr > td > b"
68+
)
69+
self.fobt_logged_not_read_report_timestamp_element = self.page.locator(
70+
"#report-generated"
71+
)
72+
self.six_weeks_availability_not_set_up_report_timestamp_element = (
73+
self.page.locator("#displayGenerateDate")
74+
)
75+
76+
# Failsafe Reports menu links
77+
self.date_report_last_requested_link = self.page.get_by_role(
78+
"link", name="Date Report Last Requested"
79+
)
80+
self.screening_subjects_with_inactive_open_episode_link = self.page.get_by_role(
81+
"link", name="Screening Subjects With"
82+
)
83+
self.subjects_ceased_due_to_date_of_birth_changes_link = self.page.get_by_role(
84+
"link", name="Subjects Ceased Due to Date"
85+
)
86+
self.allocate_sc_for_patient_movements_within_hub_boundaries_link = (
87+
self.page.get_by_role(
88+
"link", name="Allocate SC for Patient Movements within Hub Boundaries"
89+
)
90+
)
91+
self.allocate_sc_for_patient_movements_into_your_hub_link = (
92+
self.page.get_by_role(
93+
"link", name="Allocate SC for Patient Movements into your Hub"
94+
)
95+
)
96+
self.identify_and_link_new_gp_link = self.page.get_by_role(
97+
"link", name="Identify and link new GP"
98+
)
99+
100+
# Operational Reports menu links
101+
self.appointment_attendance_not_updated_link = self.page.get_by_role(
102+
"link", name="Appointment Attendance Not"
103+
)
104+
self.fobt_kits_logged_but_not_read_link = self.page.get_by_role(
105+
"link", name="FOBT Kits Logged but Not Read"
106+
)
107+
self.demographic_update_inconsistent_with_manual_update_link = (
108+
self.page.get_by_role("link", name="Demographic Update")
109+
)
110+
self.screening_practitioner_6_weeks_availability_not_set_up_report_link = (
111+
page.get_by_role("link", name="Screening Practitioner 6")
112+
)
113+
self.screening_practitioner_appointments_link = self.page.get_by_role(
114+
"link", name="Screening Practitioner Appointments"
115+
)
116+
117+
# Reports page main menu navigation
118+
def go_to_failsafe_reports_page(self) -> None:
119+
self.click(self.failsafe_reports_link)
120+
121+
def go_to_operational_reports_page(self) -> None:
122+
self.click(self.operational_reports_link)
123+
124+
def go_to_strategic_reports_page(self) -> None:
125+
self.click(self.strategic_reports_link)
126+
127+
def go_to_cancer_waiting_times_reports_page(self) -> None:
128+
self.click(self.cancer_waiting_times_reports_link)
129+
130+
def go_to_dashboard(self) -> None:
131+
self.click(self.dashboard_link)
132+
133+
# Reports pages shared buttons and actions
134+
def click_refresh_button(self) -> None:
135+
self.click(self.refresh_page_button)
136+
137+
def click_generate_report_button(self) -> None:
138+
self.click(self.generate_report_button)
139+
140+
def click_reports_pages_update_button(self) -> None:
141+
self.click(self.reports_update_button)
142+
143+
# Failsafe Reports menu links
144+
def go_to_date_report_last_requested_page(self) -> None:
145+
self.click(self.date_report_last_requested_link)
146+
147+
def go_to_screening_subjects_with_inactive_open_episode_link_page(self) -> None:
148+
self.click(self.screening_subjects_with_inactive_open_episode_link)
149+
150+
def go_to_subjects_ceased_due_to_date_of_birth_changes_page(self) -> None:
151+
self.click(self.subjects_ceased_due_to_date_of_birth_changes_link)
152+
153+
def go_to_allocate_sc_for_patient_movements_within_hub_boundaries_page(
154+
self,
155+
) -> None:
156+
self.click(self.allocate_sc_for_patient_movements_within_hub_boundaries_link)
157+
158+
def go_to_allocate_sc_for_patient_movements_into_your_hub_page(self) -> None:
159+
self.click(self.allocate_sc_for_patient_movements_into_your_hub_link)
160+
161+
def go_to_identify_and_link_new_gp_page(self) -> None:
162+
self.click(self.identify_and_link_new_gp_link)
163+
164+
# Operational Reports menu links
165+
def go_to_appointment_attendance_not_updated_page(self) -> None:
166+
self.click(self.appointment_attendance_not_updated_link)
167+
168+
def go_to_fobt_kits_logged_but_not_read_page(self) -> None:
169+
self.click(self.fobt_kits_logged_but_not_read_link)
170+
171+
def go_to_demographic_update_inconsistent_with_manual_update_page(self) -> None:
172+
self.click(self.demographic_update_inconsistent_with_manual_update_link)
173+
174+
def go_to_screening_practitioner_6_weeks_availability_not_set_up_report_page(
175+
self,
176+
) -> None:
177+
self.click(
178+
self.screening_practitioner_6_weeks_availability_not_set_up_report_link
179+
)
180+
181+
def go_to_screening_practitioner_appointments_page(self) -> None:
182+
self.click(self.screening_practitioner_appointments_link)
183+
184+
def click_nhs_number_link(self, page: Page) -> None:
185+
"""
186+
Clicks the first NHS number link present on the screen if any are found.
187+
"""
188+
locators = [
189+
"#listReportDataTable > tbody > tr:nth-child(3) > td:nth-child(1) > a",
190+
"//*[@id='listReportDataTable']/tbody/tr[3]/td[1]",
191+
"//*[@id='listReportDataTable']/tbody/tr[3]/td[2]",
192+
"#listReportDataTable > tbody > tr:nth-child(3) > td:nth-child(1) > a",
193+
"#subjInactiveOpenEpisodes > tbody > tr:nth-child(1) > td.NHS_NUMBER.dt-type-numeric > a",
194+
]
195+
196+
for locator_string in locators:
197+
try:
198+
# Use page.locator to get a locator object
199+
locator = page.locator(locator_string)
200+
# Check if the locator is visible
201+
if locator.is_visible():
202+
# Click the locator
203+
locator.click()
204+
except Exception:
205+
print("No NHS number links found on the page")

0 commit comments

Comments
 (0)