Skip to content

Commit 75ae0ae

Browse files
committed
pom for subject dataset page and refactor C6
1 parent bafb4cf commit 75ae0ae

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

pages/datasets/subject_datasets_page.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from playwright.sync_api import Page
1+
from playwright.sync_api import Page, expect
22
from pages.base_page import BasePage
33

44

@@ -31,3 +31,13 @@ def click_colonoscopy_show_datasets(self) -> None:
3131
def click_investigation_show_datasets(self) -> None:
3232
"""Clicks on the 'Show Dataset' button for the Investigation row on the Subject Datasets Page."""
3333
self.click(self.investigation_show_dataset_button)
34+
35+
def expect_text_to_be_visible(self, text: str) -> None:
36+
"""
37+
This method is designed to expect a text to be visible on the page.
38+
It checks if the given text is visible.
39+
40+
Args:
41+
text (str): The text to check for visibility.
42+
"""
43+
expect(self.page.get_by_text(text).nth(1)).to_be_visible()

tests/smokescreen/test_compartment_6.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
from pages.logout.log_out_page import LogoutPage
1111
from pages.datasets.subject_datasets_page import SubjectDatasetsPage
1212
from pages.screening_subject_search.handover_into_symptomatic_care_page import (
13-
HandoverIntoSymptomaticCarePage
13+
HandoverIntoSymptomaticCarePage,
1414
)
1515
from utils.calendar_picker import CalendarPicker
1616
from datetime import datetime
1717
from pages.screening_subject_search.record_diagnosis_date_page import (
1818
RecordDiagnosisDatePage,
1919
)
2020
from pages.screening_subject_search.diagnostic_test_outcome_page import (
21-
DiagnosticTestOutcomePage,OutcomeOfDiagnosticTest
21+
DiagnosticTestOutcomePage,
22+
OutcomeOfDiagnosticTest,
2223
)
24+
from pages.datasets.subject_datasets_page import SubjectDatasetsPage
2325
from pages.datasets.investigation_dataset_page import (
2426
InvestigationDatasetsPage,
2527
SiteLookupOptions,
@@ -211,7 +213,7 @@ def after_high_risk_result(page: Page) -> None:
211213
BasePage(page).click_back_button()
212214

213215
# The following code is on the subject datasets page
214-
expect(page.get_by_text("** Completed **").nth(1)).to_be_visible()
216+
SubjectDatasetsPage(page).expect_text_to_be_visible("** Completed **")
215217
BasePage(page).click_back_button()
216218

217219
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
@@ -220,15 +222,18 @@ def after_high_risk_result(page: Page) -> None:
220222

221223
# The following code is on the diagnostic test outcome page
222224
DiagnosticTestOutcomePage(page).verify_diagnostic_test_outcome("High-risk findings")
223-
DiagnosticTestOutcomePage(page).select_test_outcome_option(OutcomeOfDiagnosticTest.REFER_SURVEILLANCE)
225+
DiagnosticTestOutcomePage(page).select_test_outcome_option(
226+
OutcomeOfDiagnosticTest.REFER_SURVEILLANCE
227+
)
224228
DiagnosticTestOutcomePage(page).click_save_button()
225229

230+
226231
def after_lnpcp_result(page: Page) -> None:
227232
InvestigationDatasetsPage(page).expect_text_to_be_visible("LNPCP")
228233
BasePage(page).click_back_button()
229234

230235
# The following code is on the subject datasets page
231-
expect(page.get_by_text("** Completed **").nth(1)).to_be_visible()
236+
SubjectDatasetsPage(page).expect_text_to_be_visible("** Completed **")
232237
BasePage(page).click_back_button()
233238

234239
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
@@ -238,9 +243,12 @@ def after_lnpcp_result(page: Page) -> None:
238243

239244
# The following code is on the diagnostic test outcome page
240245
DiagnosticTestOutcomePage(page).verify_diagnostic_test_outcome("LNPCP")
241-
DiagnosticTestOutcomePage(page).select_test_outcome_option(OutcomeOfDiagnosticTest.REFER_SURVEILLANCE)
246+
DiagnosticTestOutcomePage(page).select_test_outcome_option(
247+
OutcomeOfDiagnosticTest.REFER_SURVEILLANCE
248+
)
242249
DiagnosticTestOutcomePage(page).click_save_button()
243250

251+
244252
def handover_subject_to_symptomatic_care(page: Page) -> None:
245253
SubjectScreeningSummaryPage(page).verify_latest_event_status_value(
246254
"A394 - Handover into Symptomatic Care for Surveillance - Patient Age"
@@ -282,7 +290,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
282290

283291
# This needs to be repeated for two subjects, one old and one not - High Risk Result
284292
# Older patient
285-
nhs_no = "9772286785"
293+
nhs_no = "9730614296"
286294
go_to_investigation_datasets_page(page, nhs_no)
287295

288296
# The following code is on the investigation datasets page
@@ -297,7 +305,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
297305
handover_subject_to_symptomatic_care(page)
298306

299307
# Younger patient
300-
nhs_no = "9802397318"
308+
nhs_no = "9711391848"
301309
go_to_investigation_datasets_page(page, nhs_no)
302310

303311
# The following code is on the investigation datasets page
@@ -327,7 +335,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
327335

328336
# This needs to be repeated for two subjects, one old and one not - LNPCP Result
329337
# Older patient
330-
nhs_no = "9359523194"
338+
nhs_no = "9468743977"
331339
go_to_investigation_datasets_page(page, nhs_no)
332340

333341
# The following code is on the investigation datasets page
@@ -342,7 +350,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
342350
handover_subject_to_symptomatic_care(page)
343351

344352
# Younger patient
345-
nhs_no = "9828941813"
353+
nhs_no = "9724560430"
346354
go_to_investigation_datasets_page(page, nhs_no)
347355

348356
# The following code is on the investigation datasets page
@@ -370,7 +378,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
370378
)
371379

372380
# This needs to be repeated for 1 subject, age does not matter - Normal Result
373-
nhs_no_normal = "9852356488"
381+
nhs_no_normal = "9808363938"
374382
go_to_investigation_datasets_page(page, nhs_no_normal)
375383

376384
# The following code is on the investigation datasets page
@@ -388,7 +396,7 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
388396
BasePage(page).click_back_button()
389397

390398
# The following code is on the subject datasets page
391-
expect(page.get_by_text("** Completed **").nth(1)).to_be_visible()
399+
SubjectDatasetsPage(page).expect_text_to_be_visible("** Completed **")
392400
BasePage(page).click_back_button()
393401

394402
SubjectScreeningSummaryPage(page).click_advance_fobt_screening_episode_button()
@@ -400,7 +408,9 @@ def test_compartment_6(page: Page, smokescreen_properties: dict) -> None:
400408
DiagnosticTestOutcomePage(page).verify_diagnostic_test_outcome(
401409
"Normal (No Abnormalities"
402410
)
403-
DiagnosticTestOutcomePage(page).select_test_outcome_option(OutcomeOfDiagnosticTest.INVESTIGATION_COMPLETE)
411+
DiagnosticTestOutcomePage(page).select_test_outcome_option(
412+
OutcomeOfDiagnosticTest.INVESTIGATION_COMPLETE
413+
)
404414
DiagnosticTestOutcomePage(page).click_save_button()
405415

406416
SubjectScreeningSummaryPage(page).verify_latest_event_status_value(

0 commit comments

Comments
 (0)