@@ -37,33 +37,8 @@ def test_example(page: Page) -> None:
3737 NavigationBar (page ).click_main_menu_link ()
3838 MainMenu (page ).go_to_call_and_recall_page ()
3939 CallAndRecall (page ).go_to_generate_invitations_page ()
40- page .get_by_role ("button" , name = "Generate Invitations" ).click ()
41-
42- page .wait_for_selector ("#displayRS" , timeout = 5000 )
43-
44- # Initially, ensure the table contains "Queued"
45- expect (page .locator ("#displayRS" )).to_contain_text ("Queued" )
46-
47- # Set timeout parameters
48- timeout = 120000 # Total timeout of 120 seconds (in milliseconds)
49- wait_interval = 5000 # Wait 5 seconds between refreshes (in milliseconds)
50- elapsed = 0
51-
52- # Loop until the table no longer contains "Queued"
53- while elapsed < timeout :
54- table_text = page .locator ("#displayRS" ).text_content ()
55- if "Queued" in table_text or "In Progress" in table_text :
56- # Click the Refresh button
57- page .get_by_role ("button" , name = "Refresh" ).click ()
58- page .wait_for_timeout (wait_interval )
59- elapsed += wait_interval
60- elif "Failed" in table_text :
61- pytest .fail ("Invitation has failed to generate" )
62- else :
63- break
64-
65- # Final check: ensure that the table now contains "Completed"
66- expect (page .locator ("#displayRS" )).to_contain_text ("Completed" )
40+ GenerateInvitations (page ).click_generate_invitations_button ()
41+ GenerateInvitations (page ).wait_for_invitation_generation_complete ()
6742
6843 # Print the batch of Pre-Invitation Letters
6944 batch_processing (page , "S1" , "Pre-invitation (FIT)" , "S9 - Pre-invitation Sent" )
@@ -86,16 +61,17 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
8661 MainMenu (page ).go_to_communications_production_page ()
8762 CommunicationsProduction (page ).go_to_active_batch_list_page ()
8863 ActiveBatchList (page ).enter_event_code_filter (batch_type )
89- pre_invitation_cells = page .locator (f"//td[text()='{ batch_description } ']" )
9064
91- if pre_invitation_cells .count () == 0 and batch_description == "Pre-invitation (FIT) (digital leaflet)" :
65+ batch_description_cells = page .locator (f"//td[text()='{ batch_description } ']" )
66+
67+ if batch_description_cells .count () == 0 and batch_description == "Pre-invitation (FIT) (digital leaflet)" :
9268 print (f"No S1 Pre-invitation (FIT) (digital leaflet) batch found. Skipping to next step" )
9369 return
94- elif pre_invitation_cells .count () == 0 and page .locator ("td" , has_text = "No matching records found" ):
70+ elif batch_description_cells .count () == 0 and page .locator ("td" , has_text = "No matching records found" ):
9571 pytest .fail (f"No { batch_type } { batch_description } batch found" )
9672
97- for i in range (pre_invitation_cells .count ()):
98- row = pre_invitation_cells .nth (i ).locator (".." ) # Get the parent row
73+ for i in range (batch_description_cells .count ()):
74+ row = batch_description_cells .nth (i ).locator (".." ) # Get the parent row
9975
10076 # Check if the row contains "Prepared" or "Open"
10177 if row .locator ("td" , has_text = "Prepared" ).count () > 0 or row .locator ("td" , has_text = "Open" ).count () > 0 :
@@ -110,8 +86,9 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
11086 ManageActiveBatch (page ).click_prepare_button ()
11187
11288 ManageActiveBatch (page ).reprepare_batch_text .wait_for ()
113- retrieve_button_count = 0
89+
11490 # This loops through each Retrieve button and clicks each one
91+ retrieve_button_count = 0
11592 for retrieve_button in range (ManageActiveBatch (page ).retrieve_button .count ()):
11693 retrieve_button_count += 1
11794 # Start waiting for the pdf download
@@ -126,7 +103,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
126103 nhs_no = pdf_Reader (file )
127104 os .remove (file ) # Deletes the file after extracting the necessary data
128105 elif file .endswith (".csv" ):
129- csv_df = csv_Reader (file ) # Currently no use in compartment 1, will be necessary for future compartments
106+ # csv_df = csv_Reader(file) # Currently no use in compartment 1, will be necessary for future compartments
130107 os .remove (file ) # Deletes the file after extracting the necessary data
131108
132109 # This loops through each Confirm printed button and clicks each one
0 commit comments