Skip to content

Commit 90f0739

Browse files
More duplication fixes
1 parent 4e917df commit 90f0739

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

tests/smokescreen/test_compartment_6.py

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212

1313

1414
# This should go into a util. Adding it here to avoid SonarQube duplication errors:
15+
def go_to_investigation_datasets_page(page: Page, nhs_no) -> None:
16+
verify_subject_event_status_by_nhs_no(
17+
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
18+
)
19+
20+
SubjectScreeningSummaryPage(page).click_datasets_link()
21+
SubjectDatasetsPage(page).click_investigation_show_datasets()
22+
23+
1524
def investigation_dataset_forms(page: Page) -> None:
1625
page.locator("#UI_SITE_SELECT_LINK").click()
1726
page.locator("#UI_RESULTS_rljsjnkh").select_option("35317")
@@ -54,6 +63,15 @@ def investigation_dataset_forms(page: Page) -> None:
5463
page.get_by_label("Proof Parameters").select_option("200575")
5564

5665

66+
def investigation_datasets_failure_reason_and_adding_initial_polyp(page: Page) -> None:
67+
page.locator("#anchorFailure").click()
68+
page.get_by_label("Failure Reasons").select_option("205148")
69+
page.get_by_role("button", name="Add Polyp").click()
70+
page.locator("#UI_POLYP_LOCATION1").select_option("17240~Colonoscopy Complete")
71+
page.get_by_label("Classification ?").select_option("17295")
72+
page.get_by_role("textbox", name="Estimate of whole polyp size").click()
73+
74+
5775
@pytest.mark.vpn_required
5876
@pytest.mark.smokescreen
5977
@pytest.mark.compartment5
@@ -72,21 +90,11 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
7290

7391
# This needs to be repeated for two subjects, one old and one not - High Risk Result
7492
nhs_no = "9619187075" # Dummy NHS Number (will not work)
75-
verify_subject_event_status_by_nhs_no(
76-
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
77-
)
78-
79-
SubjectScreeningSummaryPage(page).click_datasets_link()
80-
SubjectDatasetsPage(page).click_investigation_show_datasets()
93+
go_to_investigation_datasets_page(page, nhs_no)
8194

8295
# The following code is on the investigation datasets page
8396
investigation_dataset_forms(page)
84-
page.locator("#anchorFailure").click()
85-
page.get_by_label("Failure Reasons").select_option("205148")
86-
page.get_by_role("button", name="Add Polyp").click()
87-
page.locator("#UI_POLYP_LOCATION1").select_option("17240~Colonoscopy Complete")
88-
page.get_by_label("Classification ?").select_option("17295")
89-
page.get_by_role("textbox", name="Estimate of whole polyp size").click()
97+
investigation_datasets_failure_reason_and_adding_initial_polyp(page)
9098
page.get_by_role("textbox", name="Estimate of whole polyp size").fill("15")
9199
page.get_by_label("Polyp Access").select_option("17060")
92100
page.get_by_role("link", name="Add Intervention").click()
@@ -176,22 +184,12 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
176184
)
177185

178186
# This needs to be repeated for two subjects, one old and one not - LBPCP Result
179-
nhs_no = "9619187075" # Dummy NHS Number (will not work)
180-
verify_subject_event_status_by_nhs_no(
181-
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
182-
)
183-
184-
SubjectScreeningSummaryPage(page).click_datasets_link()
185-
SubjectDatasetsPage(page).click_investigation_show_datasets()
187+
nhs_no = "9619187076" # Dummy NHS Number (will not work)
188+
go_to_investigation_datasets_page(page, nhs_no)
186189

187190
# The following code is on the investigation datasets page
188191
investigation_dataset_forms(page)
189-
page.locator("#anchorFailure").click()
190-
page.get_by_label("Failure Reasons").select_option("205148")
191-
page.get_by_role("button", name="Add Polyp").click()
192-
page.locator("#UI_POLYP_LOCATION1").select_option("17240~Colonoscopy Complete")
193-
page.get_by_label("Classification ?").select_option("17295")
194-
page.get_by_role("textbox", name="Estimate of whole polyp size").click()
192+
investigation_datasets_failure_reason_and_adding_initial_polyp(page)
195193
page.get_by_role("textbox", name="Estimate of whole polyp size").fill("30")
196194
page.get_by_label("Polyp Access").select_option("17060")
197195
page.get_by_role("link", name="Add Intervention").click()
@@ -269,13 +267,8 @@ def test_compartment_5(page: Page, smokescreen_properties: dict) -> None:
269267
)
270268

271269
# This needs to be repeated for 1 subject, age does not matter - Normal Result
272-
nhs_no = "9619187075" # Dummy NHS Number (will not work)
273-
verify_subject_event_status_by_nhs_no(
274-
page, nhs_no, "A323 - Post-investigation Appointment NOT Required"
275-
)
276-
277-
SubjectScreeningSummaryPage(page).click_datasets_link()
278-
SubjectDatasetsPage(page).click_investigation_show_datasets()
270+
nhs_no = "9619187077" # Dummy NHS Number (will not work)
271+
go_to_investigation_datasets_page(page, nhs_no)
279272

280273
# The following code is on the investigation datasets page
281274
investigation_dataset_forms(page)

0 commit comments

Comments
 (0)