From a1f6a64d4a1b71846d01d2c30cf42e431121d853 Mon Sep 17 00:00:00 2001 From: Guillem Hermida Date: Fri, 23 Oct 2026 12:49:33 +0200 Subject: [PATCH] tests: the pending-open control test waits for the worker by time, not by 30 frames --- crates/ui-egui/tests/it/control.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/tests/it/control.rs b/crates/ui-egui/tests/it/control.rs index 54bfe2fa3..aa71d411b 100644 --- a/crates/ui-egui/tests/it/control.rs +++ b/crates/ui-egui/tests/it/control.rs @@ -1672,15 +1672,19 @@ fn control_open_replies_pending_while_the_worker_opens_and_focuses_once_it_has() assert_eq!(first["pending"], true, "{first}"); // The worker completes the open on later frames; the tab shows, and only then does a - // repeated open focus it instead of reporting another pending open. + // repeated open focus it instead of reporting another pending open. The worker is a thread + // of its own, so the wait is bounded by time: a busy runner can draw 30 frames before it has + // read the file. + let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30); let mut documents = 0; - for _ in 0..30 { + while std::time::Instant::now() < deadline { h.run_steps(1); let state = ok(&mut h, &c, "ui.state", json!({})); documents = state["documents"].as_array().map(|d| d.len()).unwrap_or_default(); if documents == 1 { break; } + std::thread::sleep(std::time::Duration::from_millis(5)); } assert_eq!(documents, 1, "the pending open completed into a tab");