@@ -27,23 +27,57 @@ def test_example(page: Page) -> None:
2727 page .get_by_placeholder ("Enter note" ).fill ("test data" )
2828 page .locator ("#saveNote" ).get_by_role ("button" , name = "Save" ).click ()
2929
30- # Generate Invitations
30+ # Generate Invitations
3131 page .get_by_role ("link" , name = "Main Menu" ).click ()
3232 page .get_by_role ("link" , name = "Call and Recall" ).click ()
3333 page .get_by_role ("link" , name = "Generate Invitations" ).click ()
3434 page .get_by_role ("button" , name = "Generate Invitations" ).click ()
3535 # #TODO Add loop for below steps
36+ # expect(page.locator("#displayRS")).to_contain_text("Queued")
37+ # page.get_by_role("button", name="Refresh").click()
38+ # expect(page.locator("#displayRS")).to_contain_text("Completed")
39+
40+ page .wait_for_selector ("#displayRS" , timeout = 5000 )
41+
42+ # Initially, ensure the table contains "Queued"
3643 expect (page .locator ("#displayRS" )).to_contain_text ("Queued" )
37- page .get_by_role ("button" , name = "Refresh" ).click ()
38- expect (page .locator ("#displayRS" )).to_contain_text ("Completed" )
3944
45+ # Set timeout parameters
46+ timeout = 120000 # Total timeout of 120 seconds (in milliseconds)
47+ wait_interval = 10000 # Wait 10 seconds between refreshes (in milliseconds)
48+ elapsed = 0
4049
41- #Print the batch of Pre-Invitation Letters
50+ # Loop until the table no longer contains "Queued"
51+ while elapsed < timeout :
52+ table_text = page .locator ("#displayRS" ).text_content ()
53+ if "Queued" in table_text :
54+ # Click the Refresh button
55+ page .get_by_role ("button" , name = "Refresh" ).click ()
56+ page .wait_for_timeout (wait_interval )
57+ elapsed += wait_interval
58+ else :
59+ break
60+
61+ # Final check: ensure that the table now contains "Completed"
62+ expect (page .locator ("#displayRS" )).to_contain_text ("Completed" )
63+
64+ # Print the batch of Pre-Invitation Letters
65+ page .get_by_role ("link" , name = "Main Menu" ).click ()
4266 page .get_by_role ("link" , name = "Communications Production" ).click ()
4367 page .get_by_role ("link" , name = "Active Batch List" ).click ()
4468 page .locator ("#eventCodeFilter" ).click ()
4569 page .locator ("#eventCodeFilter" ).fill ("S1" )
4670 page .locator ("#eventCodeFilter" ).press ("Enter" )
47- page .get_by_role ("link" , name = "8843" ).click ()
71+ pre_invitation_cells = page .locator ("//td[text()='Pre-invitation (FIT)']" )
72+
73+ for i in range (pre_invitation_cells .count ()):
74+ row = pre_invitation_cells .nth (i ).locator (".." ) # Get the parent row
75+
76+ # Check if the row contains "Prepared" or "Open"
77+ if row .locator ("td" , has_text = "Prepared" ).count () > 0 or row .locator ("td" , has_text = "Open" ).count () > 0 :
78+ # Find the first link in that row and click it
79+ link = row .locator ("a" ).first
80+ link_text = link .inner_text () # Get the link text dynamically
81+ link .click ()
4882 page .get_by_text ("Open In-Queue Processing Prepared Type : Original Priority : High Deadline : 17" ).click ()
4983
0 commit comments