From 927a2c425df310dfa5353b7f69ab1d6782d09206 Mon Sep 17 00:00:00 2001 From: kuddev Date: Mon, 21 Sep 2026 19:53:06 +0800 Subject: [PATCH] test: stabilize native identity and settings fixtures Keep the owned GUI test executable attached to its CMD or PowerShell parent, control the font layout fixture independently of host preferences, and gate the exit-prompt UI test on GPUI test support. --- .../src/gpui_shell/settings_pane/font_picker.rs | 15 +++++++++++---- nebula_app/src/gpui_shell/workspace/closing.rs | 2 +- .../platform/ai_session_identity/windows/tests.rs | 12 ++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/nebula_app/src/gpui_shell/settings_pane/font_picker.rs b/nebula_app/src/gpui_shell/settings_pane/font_picker.rs index 3edbd62..4754df9 100644 --- a/nebula_app/src/gpui_shell/settings_pane/font_picker.rs +++ b/nebula_app/src/gpui_shell/settings_pane/font_picker.rs @@ -612,9 +612,12 @@ mod interaction_tests { ) { cx.update(|cx| { gpui_component::init(cx); - cx.set_global(crate::gpui_shell::config::Settings::load( - nebula_settings::ThemeName::Nord, - )); + let mut settings = + crate::gpui_shell::config::Settings::load(nebula_settings::ThemeName::Nord); + // This layout fixture controls its font chain; installed/user + // preferences must not decide its expected field contents. + settings.font_family = REQUIRED_FONT_FAMILY.to_owned(); + cx.set_global(settings); }); let mut pane = None; let (_, cx) = cx.add_window_view(|window, cx| { @@ -642,7 +645,11 @@ mod interaction_tests { ); assert_eq!( pane.read_with(cx, |pane, cx| pane.font_family_cjk_input.read(cx).value().to_string()), - REQUIRED_FONT_FAMILY + pane.read_with(cx, |pane, _| pane + .runtime + .font_family_cjk + .clone() + .unwrap_or_else(|| REQUIRED_FONT_FAMILY.to_owned())) ); let bounds = cx.debug_bounds("font-picker-chevron").expect("font field exposes a dropdown arrow"); diff --git a/nebula_app/src/gpui_shell/workspace/closing.rs b/nebula_app/src/gpui_shell/workspace/closing.rs index d9fe80a..1958834 100644 --- a/nebula_app/src/gpui_shell/workspace/closing.rs +++ b/nebula_app/src/gpui_shell/workspace/closing.rs @@ -205,7 +205,7 @@ pub(super) async fn wait_for_session_ids( } } -#[cfg(test)] +#[cfg(all(test, feature = "gpui-test-support"))] mod tests { use super::*; use gpui::TestAppContext; diff --git a/nebula_app/src/platform/ai_session_identity/windows/tests.rs b/nebula_app/src/platform/ai_session_identity/windows/tests.rs index a63a67e..06d8160 100644 --- a/nebula_app/src/platform/ai_session_identity/windows/tests.rs +++ b/nebula_app/src/platform/ai_session_identity/windows/tests.rs @@ -57,14 +57,18 @@ impl Fixture { "-NoProfile", "-NonInteractive", "-Command", - &format!("& $env:PEBREL_TEST_ROLLOUT_EXE --exact {HOLDER} --nocapture"), + &format!("& $env:PEBREL_TEST_ROLLOUT_EXE --exact {HOLDER} --nocapture | Out-Null"), ]); command } else { let mut command = Command::new("cmd.exe"); - command - .args(["/d", "/s", "/c"]) - .raw_arg(format!("\"\"{}\" --exact {HOLDER} --nocapture\"", executable.display())); + // The product test binary is a GUI executable. Unlike real Codex, + // CMD will not wait for it implicitly, so keep this shell alive + // explicitly until the owned stand-in exits. + command.args(["/d", "/s", "/c"]).raw_arg(format!( + "start \"\" /b /wait \"{}\" --exact {HOLDER} --nocapture", + executable.display() + )); command }; command