diff --git a/crates/ui-egui/src/prefs/prefs_ui/shortcut_set_tests.rs b/crates/ui-egui/src/prefs/prefs_ui/shortcut_set_tests.rs index e6db6061c7..860ef35521 100644 --- a/crates/ui-egui/src/prefs/prefs_ui/shortcut_set_tests.rs +++ b/crates/ui-egui/src/prefs/prefs_ui/shortcut_set_tests.rs @@ -149,16 +149,19 @@ fn an_edit_still_marks_the_set_modified_and_sets_save_no_action_keys() { #[test] fn deleting_a_custom_set_waits_for_confirmation_and_dialog_ok() { - use egui_kittest::kittest::Queryable; + use egui_kittest::kittest::{NodeT, Queryable}; let mut h = harness(); h.state_mut().run("edit.keyboardShortcuts", json!({"set":{"edit.copy":"F9"},"saveSet":"Painting"})).unwrap(); open(&mut h); h.run_steps(4); h.get_by_label("Delete").click(); h.run_steps(3); - assert!(h.query_by_label("Delete the set “Painting”?").is_some()); + let question = h.get_by_label("Delete the set “Painting”?"); assert!(h.state().prefs_rt.shortcuts.as_ref().unwrap().profiles.sets().contains_key("Painting")); - h.get_by_label("Cancel").click(); + let cancel = std::iter::successors(question.parent(), |node| node.parent()) + .find_map(|scope| scope.query_by_label("Cancel")) + .expect("the confirmation offers Cancel"); + cancel.click(); h.run_steps(3); assert!(h.state().prefs_rt.shortcuts.as_ref().unwrap().profiles.sets().contains_key("Painting")); }