Skip to content

Commit cd0b962

Browse files
As per JIRA Ticket # BCSS-20606, Code Change is implemented.
1 parent 415415b commit cd0b962

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
from playwright.sync_api import Page, expect
2+
from pages.base_page import BasePage
3+
4+
class SubjectPage(BasePage):
5+
6+
def __init__(
7+
self,
8+
page: Page,
9+
hub_manager_role: str,
10+
lynch_diagnosis_type: str,
11+
subject_age: int,
12+
diagnosis_date: str,
13+
last_colonoscopy_date: str,
14+
default_pause_seconds: int,
15+
screening_status_lynch_self_referral: str,
16+
expected_self_referral_updates: dict,
17+
expected_seeking_further_data_updates: dict,
18+
expected_reset_seeking_further_data_updates: dict,
19+
):
20+
21+
super().__init__(page)
22+
self.page = page
23+
self.hub_manager_role = hub_manager_role
24+
self.lynch_diagnosis_type = lynch_diagnosis_type
25+
self.subject_age = subject_age
26+
self.diagnosis_date = diagnosis_date
27+
self.last_colonoscopy_date = last_colonoscopy_date
28+
self.default_pause_seconds = default_pause_seconds
29+
self.screening_status_lynch_self_referral = screening_status_lynch_self_referral
30+
self.expected_self_referral_updates = expected_self_referral_updates
31+
self.expected_seeking_further_data_updates = expected_seeking_further_data_updates
32+
self.expected_reset_seeking_further_data_updates = expected_reset_seeking_further_data_updates
33+
34+
# Class attributes for test data and expected results
35+
36+
hub_manager_role = "Hub Manager"
37+
lynch_diagnosis_type = "EPCAM"
38+
subject_age = 75
39+
diagnosis_date = "3 years ago"
40+
last_colonoscopy_date = "2 years ago"
41+
default_pause_seconds = 5
42+
screening_status_lynch_self_referral = "Lynch Self-referral"
43+
44+
expected_self_referral_updates = {
45+
# ... (your expected values here)
46+
}
47+
expected_seeking_further_data_updates = {
48+
# ... (your expected values here)
49+
}
50+
expected_reset_seeking_further_data_updates = {
51+
# ... (your expected values here)
52+
}
53+
54+
def receive_lynch_diagnosis(self, diagnosis_type, age, diagnosis_date, last_colonoscopy_date):
55+
"""
56+
Implement UI steps to receive Lynch diagnosis for a subject.
57+
"""
58+
# Example: Fill diagnosis form fields and submit
59+
pass
60+
61+
def pause_for_processing(self, seconds):
62+
"""
63+
Pause for the specified number of seconds to allow processing.
64+
"""
65+
self.page.wait_for_timeout(seconds * 1000)
66+
67+
def self_refer_subject(self):
68+
"""
69+
Implement UI steps to self-refer the subject.
70+
"""
71+
# Example: Click self-referral button
72+
pass
73+
74+
def confirm_prompt(self):
75+
"""
76+
Implement UI steps to confirm the prompt (e.g., confirmation dialog).
77+
"""
78+
# Example: Accept confirmation dialog
79+
pass
80+
81+
def assert_subject_updates(self, expected_updates: dict):
82+
"""
83+
Assert that subject details match the expected updates.
84+
"""
85+
for key, expected_value in expected_updates.items():
86+
locator = self.page.get_by_text(key)
87+
expect(locator).to_be_visible()
88+
# Optionally, check the value displayed next to the key
89+
# value_locator = locator.locator("xpath=following-sibling::*[1]")
90+
# expect(value_locator).to_have_text(expected_value)
91+
92+
def set_seeking_further_data(self):
93+
"""
94+
Implement UI steps to set the subject to Seeking Further Data.
95+
"""
96+
# Example: Select status from dropdown and save
97+
pass
98+
99+
def set_screening_status(self, status):
100+
"""
101+
Implement UI steps to set the screening status.
102+
"""
103+
# Example: Select status from dropdown and save
104+
pass

0 commit comments

Comments
 (0)