@@ -39,7 +39,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
3939 nhs_no_df = get_nhs_no_from_batch_id (link_text )
4040 logging .info (f"Successfully retrieved NHS Numbers from batch: { link_text } " )
4141 except Exception as e :
42- logging . error (f"Failed to retrieve NHS Numbers from batch: { link_text } " )
42+ pytest . fail (f"Failed to retrieve NHS Numbers from batch: { link_text } , { str ( e ) } " )
4343 link .click ()
4444 break
4545 else :
@@ -65,7 +65,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
6565 download_file .save_as (file )
6666 os .remove (file ) # Deletes the file after extracting the necessary data
6767 except Exception as e :
68- logging . error (f"No retrieve button available to click: { str (e )} " )
68+ pytest . fail (f"No retrieve button available to click: { str (e )} " )
6969
7070 # This loops through each Confirm printed button and clicks each one
7171 try :
@@ -74,13 +74,13 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
7474 page .once ("dialog" , lambda dialog : dialog .accept ())
7575 ManageActiveBatch (page ).confirm_button .nth (0 ).click ()
7676 except Exception as e :
77- logging . error (f"No confirm printed button available to click: { str (e )} " )
77+ pytest . fail (f"No confirm printed button available to click: { str (e )} " )
7878
7979 try :
8080 ActiveBatchList (page ).batch_successfully_archived_msg .wait_for ()
8181 logging .info (f"Batch { link_text } successfully archived" )
8282 except Exception as e :
83- logging . error (f"Batch successfully archived message is not shown: { str (e )} " )
83+ pytest . fail (f"Batch successfully archived message is not shown: { str (e )} " )
8484
8585 NavigationBar (page ).click_main_menu_link ()
8686 MainMenu (page ).go_to_communications_production_page ()
@@ -89,13 +89,13 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
8989 try :
9090 ArchivedBatchList (page ).verify_table_data (link_text )
9191 logging .info (f"Batch { link_text } visible in archived batch list" )
92- except Exception :
93- logging .error (f"Batch { link_text } not visible in archived batch list" )
92+ except Exception as e :
93+ logging .error (f"Batch { link_text } not visible in archived batch list: { str ( e ) } " )
9494
9595 first_nhs_no = nhs_no_df ["subject_nhs_number" ].iloc [0 ]
9696 try :
9797 verify_subject_event_status_by_nhs_no (page , first_nhs_no , latest_event_status )
9898 logging .info (f"Successfully verified NHS number { first_nhs_no } with status { latest_event_status } " )
9999 except Exception as e :
100- logging . error (f"Verification failed for NHS number { first_nhs_no } with status { latest_event_status } : { str (e )} " )
100+ pytest . fail (f"Verification failed for NHS number { first_nhs_no } : { str (e )} " )
101101 return nhs_no_df
0 commit comments