From e8c6624960800ee8ac9fd5957e71f2f7067e35ed Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 2 Dec 2026 11:13:10 +0100 Subject: [PATCH] test(ui): wait for an encrypted document's view before reading its text layer harness_clip's wait read app.views[0] on its first check. An encrypted document opens in the background after setup submits its password, so on a slow or busy machine the view did not exist yet and the closure panicked with an index out of bounds instead of waiting. --- crates/ui-egui/tests/it/text_select.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/tests/it/text_select.rs b/crates/ui-egui/tests/it/text_select.rs index 064bd0d956..251f822b37 100644 --- a/crates/ui-egui/tests/it/text_select.rs +++ b/crates/ui-egui/tests/it/text_select.rs @@ -59,8 +59,11 @@ fn harness_clip( app } }); - // Wait for the text layer itself (#1277), not for a fixed second. - crate::support::wait_until(&mut h, "the page's text layer", |app| app.views[0].glyph_screen_pos(0, 5).is_some() && !app.render_pending()); + // Wait for the text layer itself (#1277), not for a fixed second. An encrypted document opens + // in the background after `setup` submits its password, so its view may not exist yet. + crate::support::wait_until(&mut h, "the page's text layer", |app| { + app.views.first().is_some_and(|view| view.glyph_screen_pos(0, 5).is_some()) && !app.render_pending() + }); let at = h.state().views[0].glyph_screen_pos(0, 5).expect("text layer loaded"); h.hover_at(at); h.run_steps(1);