Skip to content

Commit 5c52627

Browse files
Altering code to address review comments on #15
1 parent ddea56f commit 5c52627

File tree

8 files changed

+60
-56
lines changed

8 files changed

+60
-56
lines changed

tests/smokescreen/test_compartment_1.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
@pytest.fixture
1717
def smokescreen_properties() -> dict:
18-
properties = PropertiesFile().smokescreen_properties("compartment")
19-
return properties
18+
return PropertiesFile().get_smokescreen_properties()
2019

2120
@pytest.mark.smoke
2221
@pytest.mark.compartment1

tests/smokescreen/test_compartment_2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
@pytest.fixture
1717
def smokescreen_properties() -> dict:
18-
properties = PropertiesFile().smokescreen_properties("compartment")
19-
return properties
18+
return PropertiesFile().get_smokescreen_properties()
2019

2120

2221
@pytest.mark.smoke

tests/smokescreen/test_compartment_3.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
@pytest.fixture
1717
def smokescreen_properties() -> dict:
18-
properties = PropertiesFile().smokescreen_properties("compartment")
19-
return properties
18+
return PropertiesFile().get_smokescreen_properties()
2019

2120

2221
@pytest.mark.smokescreen

tests/test_call_and_recall_page.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313

1414

1515
@pytest.fixture
16-
def smokescreen_properties() -> dict:
17-
properties = PropertiesFile().smokescreen_properties("smoke")
18-
return properties
16+
def general_properties() -> dict:
17+
return PropertiesFile().get_general_properties()
1918

2019

2120
@pytest.fixture(scope="function", autouse=True)
@@ -65,7 +64,7 @@ def test_call_and_recall_page_navigation(page: Page) -> None:
6564
BasePage(page).main_menu_header_is_displayed()
6665

6766

68-
def test_view_an_invitation_plan(page: Page, smokescreen_properties: dict) -> None:
67+
def test_view_an_invitation_plan(page: Page, general_properties: dict) -> None:
6968
"""
7069
Confirms that an invitation plan can be viewed via a screening centre from the planning ad monitoring page
7170
"""
@@ -74,7 +73,7 @@ def test_view_an_invitation_plan(page: Page, smokescreen_properties: dict) -> No
7473

7574
# Select a screening centre
7675
InvitationsMonitoring(page).go_to_invitation_plan_page(
77-
smokescreen_properties["screening_centre_code"]
76+
general_properties["screening_centre_code"]
7877
)
7978

8079
# Select an invitation plan

tests/test_organisations_page.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88

99
@pytest.fixture
10-
def smokescreen_properties() -> dict:
11-
properties = PropertiesFile().smokescreen_properties("smoke")
12-
return properties
10+
def general_properties() -> dict:
11+
return PropertiesFile().get_general_properties()
1312

1413

1514
@pytest.fixture(scope="function", autouse=True)
@@ -72,7 +71,7 @@ def test_organisations_page_navigation(page: Page) -> None:
7271

7372

7473
def test_view_an_organisations_system_parameters(
75-
page: Page, smokescreen_properties: dict
74+
page: Page, general_properties: dict
7675
) -> None:
7776
"""
7877
Confirms that an organisation's system parameters can be accessed and viewed
@@ -81,7 +80,7 @@ def test_view_an_organisations_system_parameters(
8180
OrganisationsPage(page).go_to_screening_centre_parameters_page()
8281

8382
# View an Organisation
84-
page.get_by_role("link", name=smokescreen_properties["screening_centre_code"]).click()
83+
page.get_by_role("link", name=general_properties["screening_centre_code"]).click()
8584
BasePage(page).bowel_cancer_screening_ntsh_page_title_contains_text(
8685
"System Parameters"
8786
)

tests/test_reports_page.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99

1010
@pytest.fixture
11-
def smokescreen_properties() -> dict:
12-
properties = PropertiesFile().smokescreen_properties("smoke")
13-
return properties
11+
def general_properties() -> dict:
12+
return PropertiesFile().get_general_properties()
1413

1514

1615
@pytest.fixture(scope="function", autouse=True)
@@ -190,7 +189,7 @@ def test_failsafe_reports_subjects_ceased_due_to_date_of_birth_changes(
190189

191190

192191
def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundaries(
193-
page: Page, smokescreen_properties: dict
192+
page: Page, general_properties: dict
194193
) -> None:
195194
"""
196195
Confirms 'allocate_sc_for_patient_movements_within_hub_boundaries' page loads,
@@ -233,15 +232,15 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie
233232

234233
# Select another screening centre
235234
set_patients_screening_centre_dropdown.select_option(
236-
smokescreen_properties["coventry_and_warwickshire_bcs_centre"]
235+
general_properties["coventry_and_warwickshire_bcs_centre"]
237236
)
238237

239238
# Click update
240239
failsafe_report_page.click_reports_pages_update_button()
241240

242241
# Verify new screening centre has saved
243242
expect(ReportsPage(page).set_patients_screening_centre_dropdown).to_have_value(
244-
smokescreen_properties["coventry_and_warwickshire_bcs_centre"]
243+
general_properties["coventry_and_warwickshire_bcs_centre"]
245244
)
246245

247246

@@ -332,7 +331,7 @@ def test_failsafe_reports_identify_and_link_new_gp(page: Page) -> None:
332331

333332
# Operational Reports
334333
def test_operational_reports_appointment_attendance_not_updated(
335-
page: Page, smokescreen_properties: dict
334+
page: Page, general_properties: dict
336335
) -> None:
337336
"""
338337
Confirms 'appointment_attendance_not_updated' page loads,
@@ -361,7 +360,7 @@ def test_operational_reports_appointment_attendance_not_updated(
361360

362361
# Select a screening centre from the drop-down options
363362
set_patients_screening_centre_dropdown.select_option(
364-
smokescreen_properties["coventry_and_warwickshire_bcs_centre"]
363+
general_properties["coventry_and_warwickshire_bcs_centre"]
365364
)
366365

367366
# Click "Generate Report" button
@@ -433,7 +432,7 @@ def test_operational_reports_demographic_update_inconsistent_with_manual_update(
433432

434433

435434
def test_operational_reports_screening_practitioner_6_weeks_availability_not_set_up(
436-
page: Page, smokescreen_properties: dict
435+
page: Page, general_properties: dict
437436
) -> None:
438437
"""
439438
Confirms 'screening_practitioner_6_weeks_availability_not_set_up_report' page loads,
@@ -460,7 +459,7 @@ def test_operational_reports_screening_practitioner_6_weeks_availability_not_set
460459

461460
# Select a screening centre
462461
set_patients_screening_centre_dropdown.select_option(
463-
smokescreen_properties["coventry_and_warwickshire_bcs_centre"]
462+
general_properties["coventry_and_warwickshire_bcs_centre"]
464463
)
465464

466465
# Click "Generate Report"
@@ -480,7 +479,7 @@ def test_operational_reports_screening_practitioner_6_weeks_availability_not_set
480479

481480
@pytest.mark.only
482481
def test_operational_reports_screening_practitioner_appointments(
483-
page: Page, smokescreen_properties: dict
482+
page: Page, general_properties: dict
484483
) -> None:
485484
"""
486485
Confirms 'screening_practitioner_appointments' page loads,
@@ -509,12 +508,12 @@ def test_operational_reports_screening_practitioner_appointments(
509508

510509
# Select a screening centre
511510
set_patients_screening_centre_dropdown.select_option(
512-
smokescreen_properties["coventry_and_warwickshire_bcs_centre"]
511+
general_properties["coventry_and_warwickshire_bcs_centre"]
513512
)
514513

515514
# Select a screening practitioner
516515
screening_practitioner_dropdown.select_option(
517-
smokescreen_properties["screening_practitioner_named_another_stubble"]
516+
general_properties["screening_practitioner_named_another_stubble"]
518517
)
519518

520519
# Click "Generate Report"

tests/test_screening_subject_search_page.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525

2626
@pytest.fixture
27-
def smokescreen_properties() -> dict:
28-
properties = PropertiesFile().smokescreen_properties("smoke")
29-
return properties
27+
def general_properties() -> dict:
28+
return PropertiesFile().get_general_properties()
3029

3130

3231
@pytest.fixture(scope="function", autouse=True)
@@ -44,7 +43,7 @@ def before_each(page: Page):
4443

4544
@pytest.mark.smoke
4645
def test_search_screening_subject_by_nhs_number(
47-
page: Page, smokescreen_properties: dict
46+
page: Page, general_properties: dict
4847
) -> None:
4948
"""
5049
Confirms a screening subject can be searched for, using their nhs number by doing the following:
@@ -54,11 +53,11 @@ def test_search_screening_subject_by_nhs_number(
5453
- Click search button
5554
- Verify the Subject Screening Summary page is displayed
5655
"""
57-
search_subject_by_nhs_number(page, smokescreen_properties["nhs_number"])
56+
search_subject_by_nhs_number(page, general_properties["nhs_number"])
5857

5958

6059
def test_search_screening_subject_by_surname(
61-
page: Page, smokescreen_properties: dict
60+
page: Page, general_properties: dict
6261
) -> None:
6362
"""
6463
Confirms a screening subject can be searched for, using their surname by doing the following:
@@ -68,11 +67,11 @@ def test_search_screening_subject_by_surname(
6867
- Click search button
6968
- Verify the subject summary page is displayed
7069
"""
71-
search_subject_by_surname(page, smokescreen_properties["surname"])
70+
search_subject_by_surname(page, general_properties["surname"])
7271

7372

7473
def test_search_screening_subject_by_forename(
75-
page: Page, smokescreen_properties: dict
74+
page: Page, general_properties: dict
7675
) -> None:
7776
"""
7877
Confirms a screening subject can be searched for, using their forename by doing the following:
@@ -82,10 +81,10 @@ def test_search_screening_subject_by_forename(
8281
- Click search button
8382
- Verify the subject summary page is displayed
8483
"""
85-
search_subject_by_forename(page, smokescreen_properties["forename"])
84+
search_subject_by_forename(page, general_properties["forename"])
8685

8786

88-
def test_search_screening_subject_by_dob(page: Page, smokescreen_properties: dict) -> None:
87+
def test_search_screening_subject_by_dob(page: Page, general_properties: dict) -> None:
8988
"""
9089
Confirms a screening subject can be searched for, using their date of birth by doing the following:
9190
- Clear filters
@@ -94,7 +93,7 @@ def test_search_screening_subject_by_dob(page: Page, smokescreen_properties: dic
9493
- Click search button
9594
- Verify the subject search results page is displayed
9695
"""
97-
search_subject_by_dob(page, smokescreen_properties["subject_dob"])
96+
search_subject_by_dob(page, general_properties["subject_dob"])
9897

9998

10099
def test_search_screening_subject_by_postcode(page: Page) -> None:
@@ -110,7 +109,7 @@ def test_search_screening_subject_by_postcode(page: Page) -> None:
110109

111110

112111
def test_search_screening_subject_by_episode_closed_date(
113-
page: Page, smokescreen_properties: dict
112+
page: Page, general_properties: dict
114113
) -> None:
115114
"""
116115
Confirms a screening subject can be searched for, using their episode closed date by doing the following:
@@ -121,18 +120,18 @@ def test_search_screening_subject_by_episode_closed_date(
121120
- Verify the subject search results page is displayed
122121
- Verify the results contain the date that was searched for
123122
"""
124-
search_subject_by_episode_closed_date(page, smokescreen_properties["episode_closed_date"])
123+
search_subject_by_episode_closed_date(page, general_properties["episode_closed_date"])
125124

126125

127126
def test_search_criteria_clear_filters_button(
128-
page: Page, smokescreen_properties: dict
127+
page: Page, general_properties: dict
129128
) -> None:
130129
"""
131130
Confirms the 'clear filters' button on the search page works as expected by doing the following:
132131
- Enter number in NHS field and verify value
133132
- Click clear filters button and verify field is empty
134133
"""
135-
check_clear_filters_button_works(page, smokescreen_properties["nhs_number"])
134+
check_clear_filters_button_works(page, general_properties["nhs_number"])
136135

137136

138137
# Tests searching via the "Screening Status" drop down list
@@ -345,7 +344,7 @@ def test_search_screening_subject_by_home_hub(page: Page) -> None:
345344

346345

347346
def test_search_screening_subject_by_gp_practice(
348-
page: Page, smokescreen_properties: dict
347+
page: Page, general_properties: dict
349348
) -> None:
350349
"""
351350
Confirms screening subjects can be searched for, using the search area (home hub) by doing the following:
@@ -361,12 +360,12 @@ def test_search_screening_subject_by_gp_practice(
361360
page,
362361
ScreeningStatusSearchOptions.CALL_STATUS.value,
363362
SearchAreaSearchOptions.SEARCH_AREA_GP_PRACTICE.value,
364-
smokescreen_properties["gp_practice_code"],
363+
general_properties["gp_practice_code"],
365364
)
366365
SubjectScreeningSummary(page).verify_result_contains_text("SPRINGS HEALTH CENTRE")
367366

368367

369-
def test_search_screening_subject_by_ccg(page: Page, smokescreen_properties: dict) -> None:
368+
def test_search_screening_subject_by_ccg(page: Page, general_properties: dict) -> None:
370369
"""
371370
Confirms screening subjects can be searched for, using the search area (ccg) by doing the following:
372371
- Clear filters
@@ -381,13 +380,13 @@ def test_search_screening_subject_by_ccg(page: Page, smokescreen_properties: dic
381380
page,
382381
ScreeningStatusSearchOptions.CALL_STATUS.value,
383382
SearchAreaSearchOptions.SEARCH_AREA_CCG.value,
384-
smokescreen_properties["ccg_code"],
385-
smokescreen_properties["gp_practice_code"],
383+
general_properties["ccg_code"],
384+
general_properties["gp_practice_code"],
386385
)
387386

388387

389388
def test_search_screening_subject_by_screening_centre(
390-
page: Page, smokescreen_properties: dict
389+
page: Page, general_properties: dict
391390
) -> None:
392391
"""
393392
Confirms screening subjects can be searched for, using the search area (screening centre) by doing the following:
@@ -402,7 +401,7 @@ def test_search_screening_subject_by_screening_centre(
402401
page,
403402
ScreeningStatusSearchOptions.CALL_STATUS.value,
404403
SearchAreaSearchOptions.SEARCH_AREA_CCG.value,
405-
smokescreen_properties["screening_centre_code"],
404+
general_properties["screening_centre_code"],
406405
)
407406

408407

utils/load_properties_file.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44

55
class PropertiesFile():
66
def __init__(self):
7-
self.compartment_properties_file = "tests/smokescreen/bcss_smokescreen_tests.properties"
8-
self.smokescreen_properties_file = "tests/bcss_tests.properties"
7+
self.smokescreen_properties_file = "tests/smokescreen/bcss_smokescreen_tests.properties"
8+
self.general_properties_file = "tests/bcss_tests.properties"
99

1010

11-
def smokescreen_properties(self, type_of_properties_file: str) -> dict:
11+
def get_properties(self, type_of_properties_file: str | None = None) -> dict:
1212
"""
13-
Reads the 'bcss_smokescreen_tests.properties' file or 'bcss_tests.properties' and populates a 'Properties' object depending on whether "compartment" is given
13+
Reads the 'bcss_smokescreen_tests.properties' file or 'bcss_tests.properties' and populates a 'Properties' object depending on whether "smokescreen" is given
1414
Returns a dictionary of properties for use in tests.
1515
1616
Returns:
1717
dict: A dictionary containing the values loaded from the 'bcss_smokescreen_tests.properties' file.
1818
"""
1919
configs = Properties()
20-
path = f"{os.getcwd()}/{self.compartment_properties_file if type_of_properties_file == "compartment" else self.smokescreen_properties_file}"
20+
path = f"{os.getcwd()}/{self.smokescreen_properties_file if type_of_properties_file == "smokescreen" else self.general_properties_file}"
2121
with open(
2222
path, "rb"
2323
) as read_prop:
2424
configs.load(read_prop)
2525
return configs.properties
26+
27+
28+
def get_smokescreen_properties(self) -> dict:
29+
"This is used to get the `tests/smokescreen/bcss_smokescreen_tests.properties` file"
30+
return self.get_properties("smokescreen")
31+
32+
33+
def get_general_properties(self) -> dict:
34+
"This is used to get the `tests/bcss_tests.properties` file"
35+
return self.get_properties()
36+

0 commit comments

Comments
 (0)