Skip to content

Commit 02a7ee8

Browse files
Addressing more issues mentioned by Dave in PR #6 Feature/smokescreen compartment 1
1 parent a97a1ae commit 02a7ee8

File tree

10 files changed

+28
-18
lines changed

10 files changed

+28
-18
lines changed

pages/cognito_login_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ def login_as_user(self, username: str, password: str) -> None:
2222
# Retrieve and enter password from .env file
2323
self.password.fill(password)
2424
# Click Submit
25-
self.submit_button.click()
25+
self.submit_button.click()

pages/generate_invitations_page.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ def wait_for_invitation_generation_complete(self):
5757

5858
self_referrals_total = int(self.self_referrals_total.text_content().strip())
5959
if self_referrals_total >= 1:
60-
logging.warning("No S1 Digital Leaflet batch will be generated")
6160
return True
61+
else:
62+
logging.warning("No S1 Digital Leaflet batch will be generated")
6263

6364
value = self.planned_invitations_total.text_content().strip() # Get text and remove extra spaces
6465
if int(value) < 5:

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ markers =
3030
smokescreen: all compartments to be run as part of the smokescreen
3131
compartment1: only for compartment 1
3232
compartment2: only for compartment 2
33-
compartment3: only for compartment 3
33+
compartment3: only for compartment 3

tests/Smokescreen/test_compartment_1.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
from playwright.sync_api import Page
33
from my_pages import *
44
from utils.batch_processing import batch_processing
5-
from utils.oracle import OracleDB
65

76
@pytest.mark.smoke
87
@pytest.mark.compartment1
98
def test_create_invitations_plan(page: Page) -> None:
9+
"""
10+
This is used to create the invitations plan. As it is not always needed it is separate to the main Compartment 1 function
11+
"""
1012
logging.info("Compartment 1 - Create Invitations Plan")
1113
UserTools.user_login(page, "Hub Manager State Registered")
1214
# Create plan - England
@@ -29,6 +31,13 @@ def test_create_invitations_plan(page: Page) -> None:
2931
@pytest.mark.smokescreen
3032
@pytest.mark.compartment1
3133
def test_compartment_1(page: Page) -> None:
34+
"""
35+
This is the main compartment 1 function. It covers the following:
36+
- Generating invitations based on the invitation plan
37+
- Processes S1 (FIT) batches
38+
- Processes S9 (FIT) batches
39+
- Processes S10 (FIT) batches
40+
"""
3241
logging.info("Compartment 1 - Generate Invitations")
3342
UserTools.user_login(page, "Hub Manager State Registered")
3443

@@ -42,20 +51,18 @@ def test_compartment_1(page: Page) -> None:
4251
# Print the batch of Pre-Invitation Letters - England
4352
logging.info("Compartment 1 - Process S1 Batch")
4453
if self_referrals_available:
45-
batch_processing(page, "S1", "Pre-invitation (FIT) (digital leaflet)", "S9 - Pre-invitation Sent")
54+
batch_processing(page, "S1", "Pre-invitation (FIT) (digital leaflet)", "S9 - Pre-invitation Sent", False)
4655
else:
4756
logging.warning("Skipping S1 Pre-invitation (FIT) (digital leaflet) as no self referral invitations were generated")
48-
nhs_number_df = batch_processing(page, "S1", "Pre-invitation (FIT)", "S9 - Pre-invitation Sent")
49-
OracleDB().exec_bcss_timed_events(nhs_number_df)
57+
batch_processing(page, "S1", "Pre-invitation (FIT)", "S9 - Pre-invitation Sent", True)
5058

5159
# Print the batch of Invitation & Test Kit Letters - England
5260
logging.info("Compartment 1 - Process S9 Batch")
53-
nhs_number_df = batch_processing(page, "S9", "Invitation & Test Kit (FIT)", "S10 - Invitation & Test Kit Sent")
54-
OracleDB().exec_bcss_timed_events(nhs_number_df)
61+
batch_processing(page, "S9", "Invitation & Test Kit (FIT)", "S10 - Invitation & Test Kit Sent", True)
5562

5663
# Print a set of reminder letters
5764
logging.info("Compartment 1 - Process S10 Batch")
58-
batch_processing(page, "S10", "Test Kit Reminder", "S19 - Reminder of Initial Test Sent")
65+
batch_processing(page, "S10", "Test Kit Reminder", "S19 - Reminder of Initial Test Sent", False)
5966

6067
# Log out
6168
Logout(page).log_out()

tests/Smokescreen/test_compartment_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ def test_compartment_2(page: Page) -> None:
5656
batch_processing(page, "S3", "Retest (Spoilt) (FIT)", "S11 - Retest Kit Sent (Spoilt)")
5757

5858
# Log out
59-
Logout(page).log_out()
59+
Logout(page).log_out()

tests/test_bcss_19181_users_permit_list.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
from playwright.sync_api import Page
3-
from pages import (login_page as login, bcss_home_page as bcss_home, navigation_bar_links as nav_bar_links, log_out_page as logout,
4-
login_failure_screen as login_failure)
3+
from pages import (login_page as login, bcss_home_page as bcss_home, navigation_bar_links as nav_bar_links, log_out_page as logout, login_failure_screen as login_failure)
54
from utils.oracle import OracleDB
65

76
@pytest.fixture(scope="function", autouse=True)

users.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"Screening Centre Manager for Wolverhampton, Midlands and North West"
1414
]
1515
}
16-
}
16+
}

utils/batch_processing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
from pages.archived_batch_list_page import ArchivedBatchList
77
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
88
from utils.get_nhs_no_from_batch_id import get_nhs_no_from_batch_id
9+
from utils.oracle import OracleDB
910
import os
1011
import pytest
1112
from playwright.sync_api import Page
1213
import logging
1314

14-
def batch_processing(page: Page, batch_type: str, batch_description: str, latest_event_status: str):
15+
def batch_processing(page: Page, batch_type: str, batch_description: str, latest_event_status: str, run_timed_events: bool):
1516
logging.info(f"Processing {batch_type} - {batch_description} batch")
1617
NavigationBar(page).click_main_menu_link()
1718
MainMenu(page).go_to_communications_production_page()
@@ -96,4 +97,6 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
9697
logging.info(f"Successfully verified NHS number {first_nhs_no} with status {latest_event_status}")
9798
except Exception as e:
9899
pytest.fail(f"Verification failed for NHS number {first_nhs_no}: {str(e)}")
99-
return nhs_no_df
100+
101+
if run_timed_events:
102+
OracleDB().exec_bcss_timed_events(nhs_no_df)

utils/fit_kit_generation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ def convert_kit_id_to_fit_device_id(kit_id: str):
3939
logging.info(f"Generating FIT Device ID from: {kit_id}")
4040
today = datetime.now()
4141
year = today.strftime("%y") # Get the year from todays date in YY format
42-
return f"{kit_id}12{int(year)+1}12345/KD00001"
42+
return f"{kit_id}12{int(year)+1}12345/KD00001"

utils/oracle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ def update_or_insert_data_to_table(self, statement,params): # To update or inse
139139
conn.close()
140140
logging.info("Connection Closed")
141141
except Exception as connectionError:
142-
logging.error(f"Failed to connect to the DB! with connection error {connectionError}")
142+
logging.error(f"Failed to connect to the DB! with connection error {connectionError}")

0 commit comments

Comments
 (0)