1+ import logging
2+ from sys import platform
13import pytest
24from 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
513from 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
4864def 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" )
0 commit comments