Skip to content

Commit c9bc82b

Browse files
Added docstrings to both functions.
1 parent 1872d01 commit c9bc82b

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

pages/generate_invitations_page.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ def click_generate_invitations_button(self):
1919
def click_refresh_button(self):
2020
click(self.page, self.refresh_button)
2121

22-
def wait_for_invitation_generation_complete(self):
22+
def wait_for_invitation_generation_complete(self) -> bool:
23+
"""
24+
This function is used to wait for the invitations to be generated.
25+
Every 5 seconds it refreshes the table and checks to see if the invitations have been generated.
26+
It also checks that enough invitations were generated and checks to see if self referrals are present
27+
"""
2328
self.page.wait_for_selector("#displayRS", timeout=5000)
2429

2530
if self.planned_invitations_total == "0":
@@ -55,12 +60,13 @@ def wait_for_invitation_generation_complete(self):
5560
except Exception as e:
5661
pytest.fail("Invitations not generated successfully")
5762

63+
value = self.planned_invitations_total.text_content().strip() # Get text and remove extra spaces
64+
if int(value) < 5:
65+
pytest.fail("There are less than 5 invitations generated")
66+
5867
self_referrals_total = int(self.self_referrals_total.text_content().strip())
5968
if self_referrals_total >= 1:
6069
return True
6170
else:
6271
logging.warning("No S1 Digital Leaflet batch will be generated")
63-
64-
value = self.planned_invitations_total.text_content().strip() # Get text and remove extra spaces
65-
if int(value) < 5:
66-
pytest.fail("There are less than 5 invitations generated")
72+
return False

utils/batch_processing.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@
1212
from playwright.sync_api import Page
1313
import logging
1414

15-
def batch_processing(page: Page, batch_type: str, batch_description: str, latest_event_status: str, run_timed_events: bool = False):
15+
def batch_processing(page: Page, batch_type: str, batch_description: str, latest_event_status: str, run_timed_events: bool = False) -> None:
16+
"""
17+
This util is used to process batches. It expects the following inputs:
18+
- page: This is playwright page variable
19+
- batch_type: This is the event code of the batch. E.g. S1 or S9
20+
- batch_description: This is the description of the batch. E.g. Pre-invitation (FIT)
21+
- latest_event_status: This is the status the subject will get updated to after the batch has been processed.
22+
- run_timed_events: This is an optional input that executes bcss_timed_events if set to True
23+
"""
1624
logging.info(f"Processing {batch_type} - {batch_description} batch")
1725
NavigationBar(page).click_main_menu_link()
1826
MainMenu(page).go_to_communications_production_page()

0 commit comments

Comments
 (0)