|
| 1 | +from datetime import date |
1 | 2 | from playwright.sync_api import Page, expect, Locator |
2 | 3 | from pages.base_page import BasePage |
3 | 4 | import logging |
@@ -141,3 +142,65 @@ def click_waiting_decision_to_proceed_with_diagnostic_test(self) -> None: |
141 | 142 | self.safe_accept_dialog( |
142 | 143 | self.waiting_decision_to_proceed_with_diagnostic_test_button |
143 | 144 | ) |
| 145 | + |
| 146 | + def select_ct_colonography_and_invite(self) -> None: |
| 147 | + """ |
| 148 | + Enters today's date, selects 'CT Colonography' as the diagnostic test type, |
| 149 | + and clicks the 'Invite for Diagnostic Test' button. |
| 150 | + """ |
| 151 | + logging.info("[ADVANCE EPISODE] Selecting CT Colonography and inviting for diagnostic test") |
| 152 | + |
| 153 | + # Step 1: Enter today's date |
| 154 | + today = date.today().strftime("%d/%m/%Y") |
| 155 | + self.page.locator("#UI_APPT_DATE_38").fill(today) |
| 156 | + logging.info(f"[ADVANCE EPISODE] Entered appointment date: {today}") |
| 157 | + |
| 158 | + # Step 2: Select 'CT Colonography' from dropdown |
| 159 | + self.page.locator("#UI_EXT_TEST_TYPE_38").select_option(label="CT Colonography") |
| 160 | + logging.info("[ADVANCE EPISODE] Selected test type: CT Colonography") |
| 161 | + |
| 162 | + # Step 3: Click 'Invite for Diagnostic Test' |
| 163 | + invite_button = self.page.get_by_role("button", name="Invite for Diagnostic Test >>") |
| 164 | + self.safe_accept_dialog(invite_button) |
| 165 | + |
| 166 | + logging.info("[ADVANCE EPISODE] Invite for diagnostic test completed") |
| 167 | + |
| 168 | + def record_contact_close_episode_no_contact(self) -> None: |
| 169 | + """ |
| 170 | + Records contact with the subject and sets the outcome to 'Close Episode - No Contact'. |
| 171 | +
|
| 172 | + Steps: |
| 173 | + - Clicks the 'Record Contact with Patient' button |
| 174 | + - Selects 'To patient' as the direction |
| 175 | + - Fills start time, end time, and duration |
| 176 | + - Enters a note |
| 177 | + - Selects the outcome 'Close Episode - No Contact' |
| 178 | + - Clicks the save button |
| 179 | + """ |
| 180 | + logging.info("[CONTACT RECORD] Starting contact recording flow with outcome: Close Episode - No Contact") |
| 181 | + |
| 182 | + # Step 1: Click 'Record Contact with Patient' button |
| 183 | + self.page.get_by_role("button", name="Record Contact with Patient").click() |
| 184 | + logging.info("[CONTACT RECORD] Navigated to contact recording screen") |
| 185 | + |
| 186 | + # Step 2: Select 'To patient' from direction dropdown |
| 187 | + self.page.locator("#UI_DIRECTION").select_option(label="To patient") |
| 188 | + logging.info("[CONTACT RECORD] Selected direction: To patient") |
| 189 | + |
| 190 | + # Step 3: Enter time details |
| 191 | + self.page.locator("#UI_START_TIME").fill("09:00") |
| 192 | + self.page.locator("#UI_END_TIME").fill("09:10") |
| 193 | + self.page.locator("#UI_DURATION").fill("10") |
| 194 | + logging.info("[CONTACT RECORD] Entered time details: 09:00–09:10, duration 10 mins") |
| 195 | + |
| 196 | + # Step 4: Enter note |
| 197 | + self.page.locator("#UI_COMMENT_ID").fill("automation test note") |
| 198 | + logging.info("[CONTACT RECORD] Entered note: automation test note") |
| 199 | + |
| 200 | + # Step 5: Select outcome |
| 201 | + self.page.locator("#UI_OUTCOME").select_option(label="Close Episode - No Contact") |
| 202 | + logging.info("[CONTACT RECORD] Selected outcome: Close Episode - No Contact") |
| 203 | + |
| 204 | + # Step 6: Click save |
| 205 | + self.page.locator("input[name='UI_BUTTON_SAVE']").click() |
| 206 | + logging.info("[CONTACT RECORD] Contact recording flow completed successfully") |
0 commit comments