Skip to content

Commit 28fa43b

Browse files
committed
Removed my_pages.py and updated imports for compartment 3
# Conflicts: # tests/Smokescreen/my_pages.py # tests/Smokescreen/test_compartment_1.py
1 parent 552d6f1 commit 28fa43b

File tree

7 files changed

+74
-46
lines changed

7 files changed

+74
-46
lines changed

tests/Smokescreen/my_pages.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/Smokescreen/test_compartment_1.py

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
import logging
2+
from sys import platform
13
import pytest
24
from jproperties import Properties
3-
4-
from my_pages import *
5+
from pages.bcss_home_page import MainMenu
6+
from pages.call_and_recall_page import CallAndRecall
7+
from pages.create_a_plan_page import *
8+
from pages.generate_invitations_page import GenerateInvitations
9+
from pages.invitations_monitoring_page import InvitationsMonitoring
10+
from pages.invitations_plans_page import InvitationsPlans
11+
from pages.log_out_page import Logout
12+
from pages.navigation_bar_links import NavigationBar
513
from utils.batch_processing import batch_processing
6-
from utils.oracle import OracleDB
14+
from utils.user_tools import UserTools
715

816

917
@pytest.fixture
@@ -16,14 +24,21 @@ def smokescreen_properties() -> dict:
1624
dict: A dictionary containing the values loaded from the 'bcss_smokescreen_tests.properties' file.
1725
"""
1826
configs = Properties()
19-
with open('bcss_smokescreen_tests.properties', 'rb') as read_prop:
20-
configs.load(read_prop)
27+
if platform == "win32": # File path from content root is required on Windows OS
28+
with open('tests/smokescreen/bcss_smokescreen_tests.properties', 'rb') as read_prop:
29+
configs.load(read_prop)
30+
elif platform == "darwin": # Only the filename is required on macOS
31+
with open('bcss_smokescreen_tests.properties', 'rb') as read_prop:
32+
configs.load(read_prop)
2133
return configs.properties
2234

2335

2436
@pytest.mark.smoke
2537
@pytest.mark.compartment1
26-
def test_compartment_1(page: Page, smokescreen_properties: dict) -> None:
38+
def test_create_invitations_plan(page: Page, smokescreen_properties: dict) -> None:
39+
"""
40+
This is used to create the invitations plan. As it is not always needed it is separate to the main Compartment 1 function
41+
"""
2742
logging.info("Compartment 1 - Create Invitations Plan")
2843
UserTools.user_login(page, "Hub Manager State Registered")
2944
# Create plan - England
@@ -42,30 +57,41 @@ def test_compartment_1(page: Page, smokescreen_properties: dict) -> None:
4257
InvitationsPlans(page).invitations_plans_title.wait_for()
4358
logging.info("Invitation plan created")
4459

60+
4561
@pytest.mark.smoke
4662
@pytest.mark.smokescreen
4763
@pytest.mark.compartment1
4864
def test_compartment_1(page: Page) -> None:
65+
"""
66+
This is the main compartment 1 function. It covers the following:
67+
- Generating invitations based on the invitation plan
68+
- Processes S1 (FIT) batches
69+
- Processes S9 (FIT) batches
70+
- Processes S10 (FIT) batches
71+
"""
4972
logging.info("Compartment 1 - Generate Invitations")
5073
UserTools.user_login(page, "Hub Manager State Registered")
5174

5275
# Generate Invitations
76+
NavigationBar(page).click_main_menu_link()
5377
MainMenu(page).go_to_call_and_recall_page()
5478
CallAndRecall(page).go_to_generate_invitations_page()
5579
logging.info("Generating invitations based on the invitations plan")
5680
GenerateInvitations(page).click_generate_invitations_button()
57-
GenerateInvitations(page).wait_for_invitation_generation_complete()
81+
self_referrals_available = GenerateInvitations(page).wait_for_invitation_generation_complete()
5882

5983
# Print the batch of Pre-Invitation Letters - England
6084
logging.info("Compartment 1 - Process S1 Batch")
61-
batch_processing(page, "S1", "Pre-invitation (FIT) (digital leaflet)", "S9 - Pre-invitation Sent")
62-
nhs_number_df = batch_processing(page, "S1", "Pre-invitation (FIT)", "S9 - Pre-invitation Sent")
63-
OracleDB().exec_bcss_timed_events(nhs_number_df)
85+
if self_referrals_available:
86+
batch_processing(page, "S1", "Pre-invitation (FIT) (digital leaflet)", "S9 - Pre-invitation Sent")
87+
else:
88+
logging.warning(
89+
"Skipping S1 Pre-invitation (FIT) (digital leaflet) as no self referral invitations were generated")
90+
batch_processing(page, "S1", "Pre-invitation (FIT)", "S9 - Pre-invitation Sent", True)
6491

6592
# Print the batch of Invitation & Test Kit Letters - England
6693
logging.info("Compartment 1 - Process S9 Batch")
67-
nhs_number_df = batch_processing(page, "S9", "Invitation & Test Kit (FIT)", "S10 - Invitation & Test Kit Sent")
68-
OracleDB().exec_bcss_timed_events(nhs_number_df)
94+
batch_processing(page, "S9", "Invitation & Test Kit (FIT)", "S10 - Invitation & Test Kit Sent", True)
6995

7096
# Print a set of reminder letters
7197
logging.info("Compartment 1 - Process S10 Batch")

tests/Smokescreen/test_compartment_2.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
import logging
2+
from datetime import datetime
13
import pytest
24
from playwright.sync_api import Page
3-
from my_pages import *
5+
from pages.fit_test_kits_page import FITTestKits
6+
from pages.bcss_home_page import MainMenu
7+
from pages.log_out_page import Logout
8+
from pages.navigation_bar_links import NavigationBar
9+
from pages.log_devices_page import LogDevices
410
from utils.batch_processing import batch_processing
5-
from datetime import datetime
6-
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
711
from utils.fit_kit_generation import create_fit_id_df
8-
import logging
12+
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
13+
from utils.user_tools import UserTools
914

1015

1116
@pytest.mark.smoke

tests/Smokescreen/test_compartment_3.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import logging
2-
from datetime import datetime
3-
4-
from my_pages import *
2+
import pytest
3+
from playwright.sync_api import Page
4+
from pages.log_out_page import Logout
55
from utils import fit_kit_logged
66
from utils.batch_processing import batch_processing
7-
from utils.fit_kit_generation import create_fit_id_df
87
from utils.fit_kit_logged import process_kit_data, update_kit_service_management_entity
98
from utils.oracle import OracleDB
109
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
10+
from utils.user_tools import UserTools
1111

1212

1313
@pytest.mark.smokescreen
@@ -27,15 +27,15 @@ def test_compartment_3(page: Page) -> None:
2727
nhs_numbers.append(nhs_number)
2828
normal_flags.append(is_normal) # Store the flag (True for normal, False for abnormal)
2929

30-
# (STEP - 4) Run two stored procedures to process any kit queue records at status BCSS_READY
30+
# (STEP 4) Run two stored procedures to process any kit queue records at status BCSS_READY
3131
try:
3232
fit_kit_logged.execute_stored_procedures()
3333
logging.info("Stored procedures executed successfully.")
3434
except Exception as e:
3535
logging.error(f"Error executing stored procedures: {str(e)}")
3636
raise
3737

38-
# (STEP - 5) Check the results of the processed FIT kits have correctly updated the status of the associated subjects
38+
# (STEP 5) Check the results of the processed FIT kits have correctly updated the status of the associated subjects
3939
# Verify subject event status based on normal or abnormal classification
4040
for nhs_number, is_normal in zip(nhs_numbers, normal_flags):
4141
expected_status = "S2 - Normal" if is_normal else "A8 - Abnormal" # S2 for normal, A8 for abnormal

tests/test_call_and_recall_page.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from sys import platform
23
from playwright.sync_api import Page, expect
34
from pages.bcss_home_page import MainMenu
45
from utils.user_tools import UserTools
@@ -15,8 +16,12 @@ def tests_properties() -> dict:
1516
dict: A dictionary containing the values loaded from the 'bcss_tests.properties' file.
1617
"""
1718
configs = Properties()
18-
with open('bcss_tests.properties', 'rb') as read_prop:
19-
configs.load(read_prop)
19+
if platform == "win32": # File path from content root is required on Windows OS
20+
with open('tests/bcss_tests.properties', 'rb') as read_prop:
21+
configs.load(read_prop)
22+
elif platform == "darwin": # Only the filename is required on macOS
23+
with open('bcss_tests.properties', 'rb') as read_prop:
24+
configs.load(read_prop)
2025
return configs.properties
2126

2227

tests/test_organisations_page.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from sys import platform
23
from playwright.sync_api import Page, expect
34
from pages.bcss_home_page import MainMenu
45
from utils.user_tools import UserTools
@@ -15,8 +16,12 @@ def tests_properties() -> dict:
1516
dict: A dictionary containing the values loaded from the 'bcss_tests.properties' file.
1617
"""
1718
configs = Properties()
18-
with open('bcss_tests.properties', 'rb') as read_prop:
19-
configs.load(read_prop)
19+
if platform == "win32": # File path from content root is required on Windows OS
20+
with open('tests/bcss_tests.properties', 'rb') as read_prop:
21+
configs.load(read_prop)
22+
elif platform == "darwin": # Only the filename is required on macOS
23+
with open('bcss_tests.properties', 'rb') as read_prop:
24+
configs.load(read_prop)
2025
return configs.properties
2126

2227

tests/test_screening_subject_search_page.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from sys import platform
23
from playwright.sync_api import Page, expect
34
from pages.bcss_home_page import MainMenu
45
from pages.screening_subject_search_page import ScreeningStatusSearchOptions, LatestEpisodeStatusSearchOptions, \
@@ -17,8 +18,12 @@ def tests_properties() -> dict:
1718
dict: A dictionary containing the values loaded from the 'bcss_tests.properties' file.
1819
"""
1920
configs = Properties()
20-
with open('bcss_tests.properties', 'rb') as read_prop:
21-
configs.load(read_prop)
21+
if platform == "win32": # File path from content root is required on Windows OS
22+
with open('tests/bcss_tests.properties', 'rb') as read_prop:
23+
configs.load(read_prop)
24+
elif platform == "darwin": # Only the filename is required on macOS
25+
with open('bcss_tests.properties', 'rb') as read_prop:
26+
configs.load(read_prop)
2227
return configs.properties
2328

2429

0 commit comments

Comments
 (0)