|
1 | 1 | import pytest |
2 | 2 | from playwright.sync_api import Page, expect |
3 | | -<<<<<<< HEAD |
4 | | -======= |
5 | | -from sys import platform |
6 | | ->>>>>>> 9311a0b (BCSS-20020: Compartment 1 Smokescreen Tests (#7)) |
7 | 3 | from pages.base_page import BasePage |
8 | 4 | from pages.reports.reports_page import ReportsPage |
9 | 5 | from utils.date_time_utils import DateTimeUtils |
10 | 6 | from utils.user_tools import UserTools |
11 | | -from jproperties import Properties |
12 | | -<<<<<<< HEAD |
13 | | -import os |
14 | | -======= |
15 | | ->>>>>>> 9311a0b (BCSS-20020: Compartment 1 Smokescreen Tests (#7)) |
| 7 | +from utils.load_properties_file import PropertiesFile |
16 | 8 |
|
17 | 9 |
|
18 | 10 | @pytest.fixture |
19 | | -def tests_properties() -> dict: |
20 | | - """ |
21 | | - Reads the 'bcss_tests.properties' file and populates a 'Properties' object. |
22 | | - Returns a dictionary of properties for use in tests. |
23 | | -
|
24 | | - Returns: |
25 | | - dict: A dictionary containing the values loaded from the 'bcss_tests.properties' file. |
26 | | - """ |
27 | | -<<<<<<< HEAD |
28 | | - path = f"{os.getcwd()}/tests/bcss_tests.properties" |
29 | | - configs = Properties() |
30 | | - with open(path, "rb") as read_prop: |
31 | | - configs.load(read_prop) |
32 | | -======= |
33 | | - configs = Properties() |
34 | | - if platform == "win32": # File path from content root is required on Windows OS |
35 | | - with open("tests/bcss_tests.properties", "rb") as read_prop: |
36 | | - configs.load(read_prop) |
37 | | - elif platform == "darwin": # Only the filename is required on macOS |
38 | | - with open("bcss_tests.properties", "rb") as read_prop: |
39 | | - configs.load(read_prop) |
40 | | ->>>>>>> 9311a0b (BCSS-20020: Compartment 1 Smokescreen Tests (#7)) |
41 | | - return configs.properties |
| 11 | +def general_properties() -> dict: |
| 12 | + return PropertiesFile().get_general_properties() |
42 | 13 |
|
43 | 14 |
|
44 | 15 | @pytest.fixture(scope="function", autouse=True) |
@@ -273,7 +244,7 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie |
273 | 244 |
|
274 | 245 |
|
275 | 246 | def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundaries( |
276 | | - page: Page, tests_properties: dict |
| 247 | + page: Page, general_properties: dict |
277 | 248 | ) -> None: |
278 | 249 | """ |
279 | 250 | Confirms 'allocate_sc_for_patient_movements_within_hub_boundaries' page loads, |
@@ -338,15 +309,15 @@ def test_failsafe_reports_allocate_sc_for_patient_movements_within_hub_boundarie |
338 | 309 |
|
339 | 310 | # Select another screening centre |
340 | 311 | set_patients_screening_centre_dropdown.select_option( |
341 | | - tests_properties["coventry_and_warwickshire_bcs_centre"] |
| 312 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
342 | 313 | ) |
343 | 314 |
|
344 | 315 | # Click update |
345 | 316 | failsafe_report_page.click_reports_pages_update_button() |
346 | 317 |
|
347 | 318 | # Verify new screening centre has saved |
348 | 319 | expect(ReportsPage(page).set_patients_screening_centre_dropdown).to_have_value( |
349 | | - tests_properties["coventry_and_warwickshire_bcs_centre"] |
| 320 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
350 | 321 | ) |
351 | 322 |
|
352 | 323 |
|
@@ -478,7 +449,7 @@ def test_operational_reports_appointment_attendance_not_updated( |
478 | 449 |
|
479 | 450 | # Operational Reports |
480 | 451 | def test_operational_reports_appointment_attendance_not_updated( |
481 | | - page: Page, tests_properties: dict |
| 452 | + page: Page, general_properties: dict |
482 | 453 | ) -> None: |
483 | 454 | """ |
484 | 455 | Confirms 'appointment_attendance_not_updated' page loads, |
@@ -508,17 +479,15 @@ def test_operational_reports_appointment_attendance_not_updated( |
508 | 479 | ) |
509 | 480 |
|
510 | 481 | # Select a screening centre from the drop-down options |
511 | | - ReportsPage( |
512 | | - page |
513 | | - ).attendance_not_updated_set_patients_screening_centre_dropdown.select_option( |
514 | | - tests_properties["coventry_and_warwickshire_bcs_centre"] |
| 482 | + set_patients_screening_centre_dropdown.select_option( |
| 483 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
515 | 484 | ) |
516 | 485 | ======= |
517 | 486 | BasePage(page).bowel_cancer_screening_ntsh_page_title_contains_text("Appointment Attendance Not Updated") |
518 | 487 |
|
519 | 488 | # Select a screening centre from the drop-down options |
520 | 489 | set_patients_screening_centre_dropdown.select_option( |
521 | | - tests_properties["coventry_and_warwickshire_bcs_centre"] |
| 490 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
522 | 491 | ) |
523 | 492 |
|
524 | 493 | # Click "Generate Report" button |
@@ -606,7 +575,7 @@ def test_operational_reports_demographic_update_inconsistent_with_manual_update( |
606 | 575 |
|
607 | 576 |
|
608 | 577 | def test_operational_reports_screening_practitioner_6_weeks_availability_not_set_up( |
609 | | - page: Page, tests_properties: dict |
| 578 | + page: Page, general_properties: dict |
610 | 579 | ) -> None: |
611 | 580 | """ |
612 | 581 | Confirms 'screening_practitioner_6_weeks_availability_not_set_up_report' page loads, |
@@ -651,7 +620,19 @@ def test_operational_reports_screening_practitioner_6_weeks_availability_not_set |
651 | 620 |
|
652 | 621 | # Select a screening centre |
653 | 622 | set_patients_screening_centre_dropdown.select_option( |
654 | | - tests_properties["coventry_and_warwickshire_bcs_centre"] |
| 623 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
| 624 | + ) |
| 625 | +======= |
| 626 | + ReportsPage(page).go_to_screening_practitioner_6_weeks_availability_not_set_up_report_page() |
| 627 | + |
| 628 | + # Verify page title is "Screening Practitioner 6 Weeks Availability Not Set Up" |
| 629 | + BasePage(page).bowel_cancer_screening_ntsh_page_title_contains_text( |
| 630 | + "Screening Practitioner 6 Weeks Availability Not Set Up" |
| 631 | + ) |
| 632 | + |
| 633 | + # Select a screening centre |
| 634 | + set_patients_screening_centre_dropdown.select_option( |
| 635 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
655 | 636 | ) |
656 | 637 |
|
657 | 638 | # Click "Generate Report" |
@@ -691,7 +672,7 @@ def test_operational_reports_screening_practitioner_appointments( |
691 | 672 |
|
692 | 673 | @pytest.mark.only |
693 | 674 | def test_operational_reports_screening_practitioner_appointments( |
694 | | - page: Page, tests_properties: dict |
| 675 | + page: Page, general_properties: dict |
695 | 676 | ) -> None: |
696 | 677 | """ |
697 | 678 | Confirms 'screening_practitioner_appointments' page loads, |
@@ -749,12 +730,35 @@ def test_operational_reports_screening_practitioner_appointments( |
749 | 730 |
|
750 | 731 | # Select a screening centre |
751 | 732 | set_patients_screening_centre_dropdown.select_option( |
752 | | - tests_properties["coventry_and_warwickshire_bcs_centre"] |
| 733 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
| 734 | + ) |
| 735 | + |
| 736 | + # Select a screening practitioner |
| 737 | + ReportsPage(page).screening_practitioner_dropdown.select_option( |
| 738 | + general_properties["screening_practitioner_named_another_stubble"] |
| 739 | + ) |
| 740 | + |
| 741 | + # Click "Generate Report" |
| 742 | + ReportsPage(page).operational_reports_sp_appointments_generate_report_button.click() |
| 743 | + |
| 744 | + # Verify timestamp has updated to current date and time |
| 745 | + report_timestamp = ( |
| 746 | + DateTimeUtils.screening_practitioner_appointments_report_timestamp_date_format() |
| 747 | + ) |
| 748 | + expect(ReportsPage(Page).common_report_timestamp_element).to_contain_text( |
| 749 | + report_timestamp |
| 750 | + ) |
| 751 | +======= |
| 752 | + BasePage(page).bowel_cancer_screening_ntsh_page_title_contains_text("Screening Practitioner Appointments") |
| 753 | + |
| 754 | + # Select a screening centre |
| 755 | + set_patients_screening_centre_dropdown.select_option( |
| 756 | + general_properties["coventry_and_warwickshire_bcs_centre"] |
753 | 757 | ) |
754 | 758 |
|
755 | 759 | # Select a screening practitioner |
756 | 760 | screening_practitioner_dropdown.select_option( |
757 | | - tests_properties["screening_practitioner_named_another_stubble"] |
| 761 | + general_properties["screening_practitioner_named_another_stubble"] |
758 | 762 | ) |
759 | 763 |
|
760 | 764 | # Click "Generate Report" |
|
0 commit comments