From 8c6bdcc95b66481a27f08e24e8df1909d64d1b43 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 21 Nov 2026 23:57:30 -0500 Subject: [PATCH] Dismiss toasts one at a time in the script message test Notice cards are now as wide as their text, so a second card's Dismiss moves when the first closes; clicking both from one query hit a stale spot. --- crates/ui-egui/tests/it/javascript.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/tests/it/javascript.rs b/crates/ui-egui/tests/it/javascript.rs index 099f5a245a..256df99374 100644 --- a/crates/ui-egui/tests/it/javascript.rs +++ b/crates/ui-egui/tests/it/javascript.rs @@ -151,11 +151,15 @@ fn texts(h: &Harness<'static, PdfCraftApp>) -> Vec { /// The user's close action on every card, then the passes that act on it. fn dismiss_all(h: &mut Harness<'static, PdfCraftApp>) { - // Programmatic removal emits no close event; use the user's dismiss control. - for button in h.query_all_by(|node| !node.is_hidden() && node.label().as_deref() == Some("Dismiss")) { - button.click(); + // Programmatic removal emits no close event; use the user's dismiss control. The cards shown now, one at a + // time: cards are as wide as their text, so the next card's control moves once one closes. + let shown = h.query_all_by(|node| !node.is_hidden() && node.label().as_deref() == Some("Dismiss")).count(); + for _ in 0..shown { + if let Some(button) = h.query_all_by(|node| !node.is_hidden() && node.label().as_deref() == Some("Dismiss")).next() { + button.click(); + } + h.run_steps(3); } - h.run_steps(3); } /// One run's messages are all shown, in order (#4294): the first is a card with its title and tone