Skip to content

Commit 42a94a9

Browse files
Commented sections of the code that can be improved/altered
1 parent 4c3e254 commit 42a94a9

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

pages/generate_invitations_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def wait_for_invitation_generation_complete(self):
3232
elapsed = 0
3333

3434
# Loop until the table no longer contains "Queued"
35-
while elapsed < timeout:
35+
while elapsed < timeout: # there may be a stored procedure to speed this process up
3636
table_text = self.displayRS.text_content()
3737
if "Queued" in table_text or "In Progress" in table_text:
3838
# Click the Refresh button

tests/Smokescreen/test_compartment_1.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
# To Do:
88
# Create a common click() function -> this aims to solve an issue where sometimes it thinks it has clicked the element but the page does not change
9-
# playwright._impl._errors.Error: Dialog.accept: Cannot accept dialog which is already handled! - Have a look at removing this error (probably from line 67 of batch_processing)
109

1110
@pytest.mark.smoke
1211
@pytest.mark.smokescreen
@@ -17,7 +16,7 @@ def test_compartment_1(page: Page) -> None:
1716
# Create plan
1817
MainMenu(page).go_to_call_and_recall_page()
1918
CallAndRecall(page).go_to_planning_and_monitoring_page()
20-
InvitationsMonitoring(page).go_to_bcss001_invitations_plan_page()
19+
InvitationsMonitoring(page).go_to_bcss001_invitations_plan_page() # Replicate this for bcss009 (IOM) TODO
2120
InvitationsPlans(page).go_to_create_a_plan_page()
2221
CreateAPlan(page).click_set_all_button()
2322
CreateAPlan(page).fill_daily_invitation_rate_field("10")
@@ -36,15 +35,15 @@ def test_compartment_1(page: Page) -> None:
3635
GenerateInvitations(page).wait_for_invitation_generation_complete()
3736

3837
# Print the batch of Pre-Invitation Letters
39-
s1_nhs_numbers = batch_processing(page, "S1", "Pre-invitation (FIT)", "S9 - Pre-invitation Sent")
4038
batch_processing(page, "S1", "Pre-invitation (FIT) (digital leaflet)", "S9 - Pre-invitation Sent")
41-
for nhs_no in range(len(s1_nhs_numbers)):
39+
s1_nhs_numbers = batch_processing(page, "S1", "Pre-invitation (FIT)", "S9 - Pre-invitation Sent") # New batch processing for S1 IOM TODO
40+
for nhs_no in range(len(s1_nhs_numbers)): # Change this to get nhs numbers from DF instead of list TODO
4241
OracleDB().exec_bcss_timed_events(s1_nhs_numbers[nhs_no-1])
4342

4443
# Print the batch of Invitation & Test Kit Letters
45-
s9_nhs_numbers = batch_processing(page, "S9", "Invitation & Test Kit (FIT)", "S10 - Invitation & Test Kit Sent")
44+
s9_nhs_numbers = batch_processing(page, "S9", "Invitation & Test Kit (FIT)", "S10 - Invitation & Test Kit Sent") # New batch processing for S9 IOM TODO
4645
for nhs_no in range(len(s9_nhs_numbers)):
47-
OracleDB().exec_bcss_timed_events(s9_nhs_numbers[nhs_no-1])
46+
OracleDB().exec_bcss_timed_events(s9_nhs_numbers[nhs_no-1]) # Change this to get nhs numbers from DF instead of list TODO
4847

4948
# Print a set of reminder letters
5049
batch_processing(page, "S10", "Test Kit Reminder", "S19 - Reminder of Initial Test Sent")

utils/batch_processing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
2828
row = batch_description_cells.nth(i).locator("..") # Get the parent row
2929

3030
# Check if the row contains "Prepared" or "Open"
31-
if row.locator("td", has_text="Prepared").count() > 0 or row.locator("td", has_text="Open").count() > 0:
31+
if row.locator("td", has_text="Prepared").count() > 0 or row.locator("td", has_text="Open").count() > 0: #Within if statement get nhs_number from DB TODO
3232
# Find the first link in that row and click it
3333
link = row.locator("a").first
3434
link_text = link.inner_text() # Get the batch id dynamically
35+
# new code here query DB (getSubjectsFromLetterBatchID function in selenium code) passing in a batch id to get the nhs numbers of the subjects TODO
3536
link.click()
3637
break
3738
else:
@@ -54,7 +55,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
5455
# Wait for the download process to complete and save the downloaded file in a temp folder
5556
download_file.save_as(file)
5657
if file.endswith(".pdf"):
57-
nhs_numbers = extract_nhs_no_from_pdf(file)
58+
nhs_numbers = extract_nhs_no_from_pdf(file) # Remove pdf_reader TODO
5859
first_nhs_no = nhs_numbers[0]
5960
os.remove(file) # Deletes the file after extracting the necessary data
6061
elif file.endswith(".csv"):
@@ -73,5 +74,5 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
7374
ArchivedBatchList(page).enter_id_filter(link_text)
7475
ArchivedBatchList(page).verify_table_data(link_text)
7576

76-
verify_subject_event_status_by_nhs_no(page, first_nhs_no, latest_event_status)
77+
verify_subject_event_status_by_nhs_no(page, first_nhs_no, latest_event_status) # This needs to be changed to pass an NHS number from the new DF first_nhs_no = df["COL NAME"].iloc[0] TODO
7778
return nhs_numbers

0 commit comments

Comments
 (0)