From 1bc064d84a8f81e515ca075efd5006b61afa09f1 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 15 Oct 2026 03:00:20 -0400 Subject: [PATCH] Tests: the viewer find test waits for results by a deadline, not a frame count (#779) Under a full workspace test run the background find could still be searching after 60 short frames: 12 of 15 matches were in when the assertion ran. The PAGE re-run had the same race. Co-authored-by: Claude Opus 5.5 --- crates/ui-egui/tests/viewer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/tests/viewer.rs b/crates/ui-egui/tests/viewer.rs index 90e1b524b..06e22fe3b 100644 --- a/crates/ui-egui/tests/viewer.rs +++ b/crates/ui-egui/tests/viewer.rs @@ -128,7 +128,11 @@ fn view_history_select_all_and_find_options() { assert_eq!(h.state().views[0].find.as_ref().unwrap().matches.len(), 0, "\"page\" alone, lower case, appears nowhere"); h.state_mut().views[0].find.as_mut().unwrap().query = "PAGE".into(); h.state_mut().views[0].rerun_find(); - h.run_steps(2); + let deadline = std::time::Instant::now() + std::time::Duration::from_secs(20); + while std::time::Instant::now() < deadline && h.state().views[0].find.as_ref().unwrap().matches.len() < 5 { + h.run_steps(2); + std::thread::sleep(std::time::Duration::from_millis(5)); + } assert_eq!(h.state().views[0].find.as_ref().unwrap().matches.len(), 5); }