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