11from pathlib import Path
22from playwright .sync_api import Page , expect
3+ import time
34
45from ..data import TestData
56from ..models import School
@@ -44,6 +45,10 @@ def __init__(self, page: Page, test_data: TestData):
4445 )
4546 self .vaccinations_card_row = vaccinations_card .get_by_role ("row" )
4647
48+ self .manually_matched_card = self .page .get_by_text (
49+ "Consent response manually matched with child record"
50+ )
51+
4752 def verify_headers (self ):
4853 expect (self .children_heading ).to_be_visible ()
4954 for header in self .children_table_headers :
@@ -118,6 +123,21 @@ def expect_text_in_main(self, text: str) -> None:
118123 def expect_text_in_heading (self , text : str ) -> None :
119124 expect (self .page .get_by_role ("heading" )).to_contain_text (text )
120125
126+ def check_log_updates_with_match (self ):
127+ self .page .wait_for_load_state ()
128+
129+ # Wait up to 10 seconds for activity log to update
130+
131+ for i in range (20 ):
132+ if self .manually_matched_card .is_visible ():
133+ break
134+
135+ time .sleep (0.5 )
136+
137+ self .page .reload ()
138+
139+ expect (self .manually_matched_card ).to_be_visible ()
140+
121141 def verify_activity_log_for_created_or_matched_child (
122142 self , child_name : str , location : str
123143 ):
@@ -128,7 +148,7 @@ def verify_activity_log_for_created_or_matched_child(
128148 self .expect_text_in_main (f"Invited to the session at { location } " )
129149
130150 # FIXME: Update this text when MAVIS-1896/MAV-253 is closed
131- self .expect_text_in_main ( "Consent response manually matched with child record" )
151+ self .check_log_updates_with_match ( )
132152
133153 def remove_child_from_cohort (self , child_name : str ):
134154 self .search_for_a_child (child_name )
0 commit comments