test(chat): cover rendered ignore controls after restart

This commit is contained in:
omar committed 2026-11-28 08:13:10 +03:00
1 parent c7ccea544c
commit a8157ab58d
2 files changed
+66

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# Ignored-user rendered UI evidence
## Scope
`native/src/smoke/contact_edit.rs::ignored_contact_controls_and_list_roundtrip_after_restart` exercises the native Slint UI using the existing software-renderer test platform and a temporary profile.
The test selects **Ignore User** from the visible contact context menu, restarts the app, and verifies the rendered Chats ignored-list row has the saved display name and exact UID (`NAME\nUID`). It also runs the isolated incoming-message fixture with the original UID and a different UID sharing its nickname, then selects **Stop Ignoring User** from the restored contact's visible context menu. A further restart confirms the ignored row is absent and the empty-list text is rendered. Preference bytes are checked around both writes.
Existing `ignored_users_survive_restart_and_remove_by_uid` remains unchanged and continues covering removal from the ignored-list button, failed-save atomicity, and delivery/history behavior. The runtime consumer regression also retains missing-UID roster fallback, reused client ID, late explicit ignored UID, post-unignore delivery, and history assertions.
## Verification
On the isolated `work/ignored-users` worktree, the focused Windows test command was run with `--offline --locked --target x86_64-pc-windows-msvc -p teamspeach-native --no-default-features --features webrtc,test-harness --lib -- ignored_ --test-threads=1`; it reported **5 passed, 0 failed**. The selected tests included the new rendered UI regression and the existing restart/removal UI regression.
## Limits
This is software-rendered Slint interaction with the test-harness fixture and disposable profile. It does not verify OS-native dialogs, a live server, real network traffic, or hardware behavior.
+49
View File
@@ -424,6 +424,55 @@ fn ignored_users_survive_restart_and_remove_by_uid() {
}
}
#[test]
fn ignored_contact_controls_and_list_roundtrip_after_restart() {
if !headless::install_for_test() { return; }
let temp = tempfile::tempdir().unwrap();
let root = temp.path().join("profile");
initialize_native_root(&root).unwrap();
{
let mut profile = ProfileServices::open(&root).unwrap();
profile.identities.onboard("Rendered ignored-user fixture").unwrap();
profile.prefs.set(json!({"contacts":person(ALIAS), "contactsGroupOffline":false})).unwrap();
}
let config = AppConfig::isolated(root.clone());
let ignored = || json!([{"uid":UID, "name":NAME}]);
run_ui(&config, async move |runtime, ui| {
open_contacts(runtime, ui).await?;
let row = contact_state(runtime, ui, "contact before rendered ignore", Some(ALIAS), &json!([])).await?
.ok_or("contact row missing before ignore")?;
menu(runtime, ui, row, ALIAS, Operation::ContactIgnore).await?;
contact_state(runtime, ui, "rendered contact ignore saved original name", Some(ALIAS), &ignored()).await?;
Ok(())
}).unwrap();
assert_disk(&root, &person(ALIAS), &ignored());
run_ui(&config, async move |runtime, ui| {
open_ignored_settings(runtime, ui).await?;
let _remove = ignored_row(runtime, ui, &ignored()).await?;
observe_ignored_delivery(runtime, ui, true).await?;
open_contacts(runtime, ui).await?;
let row = contact_state(runtime, ui, "ignored contact restored for rendered unignore", Some(ALIAS), &ignored()).await?
.ok_or("restored contact row missing")?;
menu(runtime, ui, row, ALIAS, Operation::ContactUnignore).await?;
contact_state(runtime, ui, "rendered contact unignore saved", Some(ALIAS), &json!([])).await?;
Ok(())
}).unwrap();
assert_disk(&root, &person(ALIAS), &json!([]));
run_ui(&config, async move |runtime, ui| {
open_ignored_settings(runtime, ui).await?;
wait(runtime, "empty ignored list restored in Chats settings", |s| {
if s.settings.prefs["chatIgnoredUsers"] != json!([])
|| super::identities::row(ui, &format!("ignored:{UID}")).is_some() { return None; }
rendered(ui, &s.catalog.text("settings.chat.ignored_users.empty"), AccessibleRole::Text)
}).await?;
Ok(())
}).unwrap();
}
#[test]
fn contact_highlight_follows_uid_and_saved_appearance_setting() {
use super::key_profiles::until;