@@ -96,6 +96,20 @@ async def wait_for_table(pilot) -> None:
9696 raise AssertionError ("data table never finished loading" )
9797
9898
99+ async def wait_until (pilot , predicate , * , message = "condition not met in time" ) -> None :
100+ """Pump the event loop until *predicate* holds.
101+
102+ Setting ``Input.value`` posts an ``Input.Changed`` that rebuilds dependent widgets
103+ asynchronously; a single ``pilot.pause()`` is not always enough on slower/loaded CI
104+ (e.g. Windows), so poll until the resulting state settles.
105+ """
106+ for _ in range (100 ):
107+ await pilot .pause ()
108+ if predicate ():
109+ return
110+ raise AssertionError (message )
111+
112+
99113async def focus_data_table (pilot ) -> DataTable :
100114 table = pilot .app .query_one ("#data-table" , DataTable )
101115 table .focus ()
@@ -655,11 +669,11 @@ async def submit_filter(expr: str) -> None:
655669
656670 # Typing narrows the candidate list (substring, case-insensitive).
657671 app .screen .query_one ("#colfilter-input" , Input ).value = "v1"
658- await pilot . pause ( )
672+ await wait_until ( pilot , lambda : sel . option_count == 10 , message = "list did not narrow" )
659673 assert sel .option_count == 10 # v10..v19
660674 # Clear the filter again so the first column ('a') is reachable.
661675 app .screen .query_one ("#colfilter-input" , Input ).value = ""
662- await pilot . pause ( )
676+ await wait_until ( pilot , lambda : sel . option_count == ncols , message = "list did not reset" )
663677
664678 # ↓ moves focus into the list; Space unchecks the highlighted ('a');
665679 # Enter applies the remaining set.
0 commit comments