From 290b6d905dca9adec64874005f47d1468d559f80 Mon Sep 17 00:00:00 2001 From: Xun Lu Date: Fri, 6 Nov 2026 11:54:26 +0800 Subject: [PATCH] test(desktop): reveal the models row before pressing it in narrow layouts Since #6609 added the server-side compaction toggle, the models row of the connection settings page starts under the fixed footer in the narrow visual cases (720px), so the test pressed the footer and failed with "no single control labelled Edit model gpt-4.1". Scroll the page until the row ends above the footer before pressing it. The wide cases need no scroll and are unchanged. Generated-by: Claude Code --- .../tests/real_host/desktop_new_session.rs | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/products/maka/terminal-shell/tests/real_host/desktop_new_session.rs b/products/maka/terminal-shell/tests/real_host/desktop_new_session.rs index ea3a74a4f1..dee9baee63 100644 --- a/products/maka/terminal-shell/tests/real_host/desktop_new_session.rs +++ b/products/maka/terminal-shell/tests/real_host/desktop_new_session.rs @@ -22,8 +22,8 @@ use base64::{Engine as _, engine::general_purpose::STANDARD}; use gpui::{ AppContext, Application, ApplicationHandle, Bounds, EntityInputHandler, ExternalPaths, FileDropEvent, Focusable, Keystroke, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, - MouseUpEvent, PlatformInput, TextInputTarget, WindowBounds, WindowHandle, WindowOptions, point, - px, size, + MouseUpEvent, PlatformInput, ScrollDelta, ScrollWheelEvent, TextInputTarget, TouchPhase, + WindowBounds, WindowHandle, WindowOptions, point, px, size, }; use maka_app_client::Client; use maka_workbench::bindings::Bindings; @@ -480,6 +480,36 @@ impl Desktop { self.click_at(position, MouseButton::Left); } + /// Scrolls whatever is under `position` down by `distance`. + fn scroll_at(&self, position: gpui::Point, distance: gpui::Pixels) { + self.platform + .dispatch_input(PlatformInput::ScrollWheel(ScrollWheelEvent { + position, + delta: ScrollDelta::Pixels(point(px(0.0), -distance)), + modifiers: Modifiers::default(), + touch_phase: TouchPhase::Moved, + })) + .unwrap(); + self.pump(); + } + + /// Scrolls the page until the control labelled `label` ends above the one + /// labelled `footer`, as a person reveals a row a fixed footer covers. + async fn reveal_above(&self, label: &str, footer: &str) { + let limit = self.control(footer).await.top(); + let x = self.control(label).await.center().x; + self.retry( + &format!("{label} stayed under {footer}"), + || { + self.controls(label) + .first() + .is_some_and(|row| row.bottom() <= limit) + }, + || self.scroll_at(point(x, limit - px(40.0)), px(120.0)), + ) + .await; + } + fn click_at(&self, position: gpui::Point, button: MouseButton) { for input in [ PlatformInput::MouseMove(MouseMoveEvent { @@ -1618,6 +1648,9 @@ async fn desktop_model_settings_keeps_successful_sign_in_and_retries_models() { assert_eq!(outcome["discoveries"], 2); } desktop.artifact(&format!("connection-ready-{theme}-{layout}")); + desktop + .reveal_above("Manage models", "Delete connection") + .await; desktop.press("Manage models").await; desktop.control("Edit model gpt-4.1").await; desktop.press("Set default gpt-4.1").await;