@@ -20,10 +20,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
2020
2121 batch_description_cells = page .locator (f"//td[text()='{ batch_description } ']" )
2222
23- if batch_description_cells .count () == 0 and batch_description == "Pre-invitation (FIT) (digital leaflet)" :
24- logging .warning ("No S1 Pre-invitation (FIT) (digital leaflet) batch found. Skipping to next step" )
25- return
26- elif batch_description_cells .count () == 0 and page .locator ("td" , has_text = "No matching records found" ):
23+ if batch_description_cells .count () == 0 and page .locator ("td" , has_text = "No matching records found" ):
2724 pytest .fail (f"No { batch_type } { batch_description } batch found" )
2825
2926 for i in range (batch_description_cells .count ()):
@@ -58,8 +55,8 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
5855 logging .info (f"Clicking retrieve button { retrieve_button_count } " )
5956 # Start waiting for the pdf download
6057 with page .expect_download () as download_info :
61- # Perform the action that initiates download
62- ManageActiveBatch (page ).retrieve_button .nth (retrieve_button - 1 ).click ()
58+ # Perform the action that initiates download. The line below is running in a FOR loop to click every retrieve button as in some cases more than 1 is present
59+ ManageActiveBatch (page ).retrieve_button .nth (retrieve_button ).click ()
6360 download_file = download_info .value
6461 file = download_file .suggested_filename
6562 # Wait for the download process to complete and save the downloaded file in a temp folder
@@ -99,4 +96,4 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
9996 logging .info (f"Successfully verified NHS number { first_nhs_no } with status { latest_event_status } " )
10097 except Exception as e :
10198 pytest .fail (f"Verification failed for NHS number { first_nhs_no } : { str (e )} " )
102- return nhs_no_df
99+ return nhs_no_df
0 commit comments