Skip to content

Commit f2e9a4b

Browse files
committed
updated the pom for diagnostic test outcome and modified the corresponding lines in C6
1 parent 62ddfc5 commit f2e9a4b

File tree

2 files changed

+50
-15
lines changed

2 files changed

+50
-15
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from playwright.sync_api import Page,expect
2+
from pages.base_page import BasePage
3+
from enum import StrEnum
4+
5+
6+
class DiagnosticTestOutcomePage(BasePage):
7+
"""Diagnostic Test Outcome Page locators and methods for interacting with the page."""
8+
9+
def __init__(self, page: Page):
10+
super().__init__(page)
11+
self.page = page
12+
# Diagnostic Test Outcome- page locators
13+
self.test_outcome_result = self.page.get_by_role("cell", name="outcome_name").nth(1)
14+
self.test_outcome_dropdown = self.page.get_by_label("Outcome of Diagnostic Test")
15+
self.save_button = self.page.get_by_role("button", name="Save")
16+
17+
def verify_diagnostic_test_outcome(self, outcome_name: str) -> None:
18+
"""Verify that the diagnostic test outcome is visible."""
19+
expect(self.test_outcome_result(outcome_name)).to_be_visible()
20+
21+
def select_test_outcome_option(self, option: str) -> None:
22+
"""Select an option from the Outcome of Diagnostic Test dropdown."""
23+
self.outcome_dropdown.select_option(option)
24+
25+
def click_save_button(self) -> None:
26+
"""Click the 'Save' button."""
27+
self.click(self.save_button)
28+
29+
class OutcomeOfDiagnosticTest(StrEnum):
30+
"""Enum for outcome of diagnostic test options."""
31+
32+
Failed_Test_Refer_Another = "20363"
33+
Refer_Symptomatic = "20366"
34+
Refer_Surveillance = "20365"

tests/smokescreen/test_compartment_6.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from pages.screening_subject_search.record_diagnosis_date_page import (
1515
RecordDiagnosisDatePage,
1616
)
17+
from pages.screening_subject_search.diagnostic_test_outcome_page import (
18+
DiagnosticTestOutcomePage,
19+
)
1720
from pages.datasets.investigation_dataset_page import (
1821
InvestigationDatasetsPage,
1922
SiteLookupOptions,
@@ -213,10 +216,9 @@ def after_high_risk_result(page: Page) -> None:
213216
AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button()
214217

215218
# The following code is on the diagnostic test outcome page
216-
expect(page.get_by_role("cell", name="High-risk findings").nth(1)).to_be_visible()
217-
page.get_by_label("Outcome of Diagnostic Test").select_option("20365")
218-
page.get_by_role("button", name="Save").click()
219-
219+
DiagnosticTestOutcomePage(page).verify_diagnostic_test_outcome("High-risk findings")
220+
DiagnosticTestOutcomePage(page).select_test_outcome_option("20365")
221+
DiagnosticTestOutcomePage(page).click_save_button()
220222

221223
def after_lnpcp_result(page: Page) -> None:
222224
InvestigationDatasetsPage(page).expect_text_to_be_visible("LNPCP")
@@ -232,10 +234,9 @@ def after_lnpcp_result(page: Page) -> None:
232234
AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button()
233235

234236
# The following code is on the diagnostic test outcome page
235-
expect(page.get_by_role("cell", name="LNPCP").nth(1)).to_be_visible()
236-
page.get_by_label("Outcome of Diagnostic Test").select_option("20365")
237-
page.get_by_role("button", name="Save").click()
238-
237+
DiagnosticTestOutcomePage(page).verify_diagnostic_test_outcome("LNPCP")
238+
DiagnosticTestOutcomePage(page).select_test_outcome_option("20365")
239+
DiagnosticTestOutcomePage(page).click_save_button()
239240

240241
def handover_subject_to_symptomatic_care(page: Page) -> None:
241242
SubjectScreeningSummaryPage(page).verify_latest_event_status_value(
@@ -244,7 +245,7 @@ def handover_subject_to_symptomatic_care(page: Page) -> None:
244245
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
245246

246247
# The following code is on the advance fobt screening episode page
247-
page.get_by_role("button", name="Handover into Symptomatic Care").click()
248+
AdvanceFOBTScreeningEpisodePage(page).click_handover_into_symptomatic_care_button()
248249

249250
# The following code is on the handover into symptomatic care page
250251
page.get_by_label("Referral").select_option("20445")
@@ -362,7 +363,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
362363
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
363364

364365
# The following code is on the advance fobt screening episode page
365-
page.get_by_role("button", name="Record Diagnosis Date").click()
366+
AdvanceFOBTScreeningEpisodePage(page).click_record_diagnosis_date_button()
366367

367368
# The following code is on the record diagnosis date page
368369
RecordDiagnosisDatePage(page).enter_date_in_diagnosis_date_field(datetime.today())
@@ -400,11 +401,11 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
400401
AdvanceFOBTScreeningEpisodePage(page).click_enter_diagnostic_test_outcome_button()
401402

402403
# The following code is on the diagnostic test outcome page
403-
expect(
404-
page.get_by_role("cell", name="Normal (No Abnormalities").nth(1)
405-
).to_be_visible()
406-
page.get_by_label("Outcome of Diagnostic Test").select_option("20360")
407-
page.get_by_role("button", name="Save").click()
404+
DiagnosticTestOutcomePage(page).verify_diagnostic_test_outcome(
405+
"Normal (No Abnormalities"
406+
)
407+
DiagnosticTestOutcomePage(page).select_test_outcome_option("20360")
408+
DiagnosticTestOutcomePage(page).click_save_button()
408409

409410
SubjectScreeningSummaryPage(page).verify_latest_event_status_value(
410411
"A318 - Post-investigation Appointment NOT Required - Result Letter Created"

0 commit comments

Comments
 (0)