From 5b2d2a67fa2b8c3e4f34247e6aafbd21ba491ea6 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sun, 18 Oct 2026 09:11:18 +0700 Subject: [PATCH] test(linux): drop imported open times and fix two test races --- linux/crates/app/src/ui/browse_tab/tests.rs | 2 ++ linux/crates/app/src/ui/workspace/status_pages.rs | 9 +++++++++ linux/crates/storage/tests/stored_formats.rs | 10 +++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/linux/crates/app/src/ui/browse_tab/tests.rs b/linux/crates/app/src/ui/browse_tab/tests.rs index 0ee68ebc1e..57c426fb03 100644 --- a/linux/crates/app/src/ui/browse_tab/tests.rs +++ b/linux/crates/app/src/ui/browse_tab/tests.rs @@ -3141,6 +3141,8 @@ fn a_keyed_table_pages_by_the_edge_rows_key_not_by_offset() { #[gtk4::test] fn a_sorted_table_pages_by_offset() { let mut script = serving_table(); + // A count below the second page would move it back to the first. + script.count_rows.always(FakeReply::ok(1_000)); script.query_bound.always(FakeReply::ok(full_page(0))); let harness = Harness::open(script, []); wait_until(WAIT, || harness.shown().len() == 100).expect("the first page"); diff --git a/linux/crates/app/src/ui/workspace/status_pages.rs b/linux/crates/app/src/ui/workspace/status_pages.rs index 7c7cafb374..13789d750f 100644 --- a/linux/crates/app/src/ui/workspace/status_pages.rs +++ b/linux/crates/app/src/ui/workspace/status_pages.rs @@ -287,6 +287,15 @@ mod tests { ("win.show-history", "Query History Unavailable"), ("win.show-saved-queries", "Saved Queries Unavailable"), ] { + // The action follows the window's own history, which may still + // be opening. + let name = action.trim_start_matches("win."); + wait_until(WAIT, || { + test.window + .lookup_action(name) + .is_some_and(|action| action.is_enabled()) + }) + .unwrap_or_else(|_| panic!("{action} stayed off")); WidgetExt::activate_action(&test.window, action, None).expect(action); wait_until(WAIT, || { visible_alert(&test.window).is_some_and(|alert| alert.heading().as_deref() == Some(heading)) diff --git a/linux/crates/storage/tests/stored_formats.rs b/linux/crates/storage/tests/stored_formats.rs index 3001cb8f1e..20e8431ff7 100644 --- a/linux/crates/storage/tests/stored_formats.rs +++ b/linux/crates/storage/tests/stored_formats.rs @@ -226,6 +226,14 @@ fn a_version_1_connection_list_imports_as_it_was_written() -> TestResult { let report = store.import_blocking(Path::new("/tmp/connections-v1.json"), CONNECTIONS_V1)?; assert_eq!(report.total(), connections_v1_model()?.len()); - assert_eq!(store.load_blocking()?.as_ref(), connections_v1_model()?.as_slice()); + // An import never takes the file's last-opened times. + let imported: Vec = connections_v1_model()? + .into_iter() + .map(|connection| SavedConnection { + last_opened_at: None, + ..connection + }) + .collect(); + assert_eq!(store.load_blocking()?.as_ref(), imported.as_slice()); Ok(()) }