@@ -31,6 +31,7 @@ def test_example(page: Page) -> None:
3131 CreateAPlan (page ).click_save_button ()
3232 CreateAPlan (page ).fill_note_field ("test data" )
3333 CreateAPlan (page ).click_saveNote_button ()
34+ expect (page ).to_have_url ("https://bcss-bcss-18680-ddc-bcss.k8s-nonprod.texasplatform.uk/invitation/plan/23159/23162/" )
3435
3536 # Generate Invitations
3637 NavigationBar (page ).click_main_menu_link ()
@@ -45,7 +46,7 @@ def test_example(page: Page) -> None:
4546
4647 # Set timeout parameters
4748 timeout = 120000 # Total timeout of 120 seconds (in milliseconds)
48- wait_interval = 10000 # Wait 10 seconds between refreshes (in milliseconds)
49+ wait_interval = 5000 # Wait 5 seconds between refreshes (in milliseconds)
4950 elapsed = 0
5051
5152 # Loop until the table no longer contains "Queued"
@@ -106,19 +107,13 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
106107 else :
107108 pytest .fail (f"No open/prepared '{ batch_type } - { batch_description } ' batch found" )
108109
109- # Checks to see if batch is already prepared
110- page .wait_for_timeout (3000 ) # Without this timeout prepare_button is always set to false
111- prepare_button = ManageActiveBatch (page ).prepare_button_text .is_visible ()
112-
113- #If not prepared it will click on the prepare button
114- if prepare_button :
115- ManageActiveBatch (page ).click_prepare_button ()
116-
117- ManageActiveBatch (page ).retrieve_button_text .nth (0 ).wait_for ()
118- page .wait_for_timeout (5000 ) # This 5 second wait is to allow other Retrieve buttons to show as they do not show up at the same time
110+ ManageActiveBatch (page ).click_prepare_button ()
119111
112+ ManageActiveBatch (page ).reprepare_batch_text .wait_for ()
113+ retrieve_button_count = 0
120114 # This loops through each Retrieve button and clicks each one
121115 for retrieve_button in range (ManageActiveBatch (page ).retrieve_button .count ()):
116+ retrieve_button_count += 1
122117 # Start waiting for the pdf download
123118 with page .expect_download () as download_info :
124119 # Perform the action that initiates download
@@ -127,24 +122,19 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
127122 file = download_file .suggested_filename
128123 # Wait for the download process to complete and save the downloaded file in a temp folder
129124 download_file .save_as (file )
130- page .wait_for_timeout (1000 )
131125 if file .endswith (".pdf" ):
132126 nhs_no = pdf_Reader (file )
133127 os .remove (file ) # Deletes the file after extracting the necessary data
134128 elif file .endswith (".csv" ):
135129 csv_df = csv_Reader (file ) # Currently no use in compartment 1, will be necessary for future compartments
136130 os .remove (file ) # Deletes the file after extracting the necessary data
137131
138- ManageActiveBatch (page ).confirm_button_text .nth (0 ).wait_for ()
139- page .wait_for_timeout (1000 ) # This 1 second wait is to allow other Confirm printed buttons to show as they do not show up at the same time
140-
141132 # This loops through each Confirm printed button and clicks each one
142- for _ in range (ManageActiveBatch ( page ). confirm_button . count () ):
133+ for _ in range (retrieve_button_count ):
143134 page .on ("dialog" , lambda dialog : dialog .accept ())
144135 ManageActiveBatch (page ).confirm_button .nth (0 ).click ()
145- page .wait_for_timeout (1000 )
146136
147- # Add wait for batch successfully archived
137+ page . locator ( 'text="Batch Successfully Archived and Printed"' ). wait_for ()
148138
149139 NavigationBar (page ).click_main_menu_link ()
150140 MainMenu (page ).go_to_communications_production_page ()
0 commit comments