Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Use the Cmd-P terminal layout for command search (#345)

Dee7c00f75ddf83
diff --git a/desktop/design/images/terminal-search-commands.png b/desktop/design/images/terminal-search-commands.png
new file mode 100644
index 000000000..6c6e93e2d
Binary files /dev/null and b/desktop/design/images/terminal-search-commands.png differ
diff --git a/desktop/design/terminal-dialogs.md b/desktop/design/terminal-dialogs.md
index cad040d92..3b4c4a9b7 100644
--- a/desktop/design/terminal-dialogs.md
+++ b/desktop/design/terminal-dialogs.md
@@ -140,6 +140,15 @@ Page Up/Down pages the result list; Shift-Up/Down scrolls the preview by one
measured terminal row. These keys preserve the input's focus and query. Preview
scrolling keeps the selected result and result-list scroll position unchanged.
+Cmd-Shift-P opens this same picker with editable `>` text. Commands and `?` help
+keep the same input, frame, terminal metrics, and two-pane arrangement as Cmd-P;
+changing a prefix must not replace the editor or move it. Command names occupy
+one row with their live shortcut aligned right. The preview shows the selected
+command's name, category, and shortcut, without session-text placeholders. Empty
+matches clear the preview. Omit the older title/count row and key-hint footer.
+
+![Commands in the shared terminal picker](images/terminal-search-commands.png)
+
Open dialogs must follow live terminal font and theme changes while preserving
the input controller, query, selection, focus, and scroll state. Wire the font,
palette, and terminal-theme dependencies as the reference dialogs do. Settings
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dart
index 6281784d4..f124f5ba8 100644
--- a/desktop/lib/state/swarm_search.dart
+++ b/desktop/lib/state/swarm_search.dart
@@ -99,7 +99,8 @@ class SwarmSearchController extends ChangeNotifier {
/// Cmd-P starts without a choice; typing or navigating activates a result.
final bool selectOnEmptyQuery;
- bool get setupLayout => activityFirst && !isCommandMode && !isHelpMode;
+ // Prefixes change the catalog, never the Cmd-P dialog's layout.
+ bool get setupLayout => activityFirst;
final bool commandsOnly;
SessionFilter sessionFilter = SessionFilter.all;
SessionSort sessionSort = SessionSort.recent;
@@ -281,7 +282,8 @@ class SwarmSearchController extends ChangeNotifier {
bool _previewVisible;
bool get previewVisible => _previewVisible;
- bool get supportsPreview => !isCommandMode && !isHelpMode && history == null;
+ bool get supportsPreview =>
+ history == null && (setupLayout || !isCommandMode && !isHelpMode);
bool get canPreview =>
supportsPreview &&
selected != null &&
diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dart
index 81b35ae7d..aeed3024b 100644
--- a/desktop/lib/widgets/swarm_search_preview.dart
+++ b/desktop/lib/widgets/swarm_search_preview.dart
@@ -104,6 +104,7 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
_selectedId = row?.id;
setState(() {});
_warm?.cancel();
+ if (row?.isCommand == true || row?.pickerQuery != null) return;
_warm = Timer(const Duration(milliseconds: 140), () {
if (!mounted || row == null) return;
final selected = _agents(app, row);
@@ -147,6 +148,39 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
builder: (context, _) {
final row = widget.search.selected;
if (row == null) return const SizedBox.shrink();
+ if (row.isCommand || row.pickerQuery != null) {
+ return Semantics(
+ container: true,
+ label: 'Command preview',
+ child: ListView(
+ key: ValueKey('preview-content:${row.id}'),
+ controller: _scroll,
+ padding: padding,
+ children: [
+ Text(
+ row.title,
+ style: terminalContentStyle(color: theme.foreground),
+ ),
+ if (row.detail.isNotEmpty)
+ Text(
+ row.detail,
+ style: terminalContentStyle(
+ color: theme.foreground.withValues(alpha: .54),
+ ),
+ ),
+ if (row.shortcut case final shortcut?) ...[
+ SizedBox(height: cell.height),
+ Text(
+ shortcut,
+ style: terminalContentStyle(
+ color: theme.foreground.withValues(alpha: .54),
+ ),
+ ),
+ ],
+ ],
+ ),
+ );
+ }
final agents = _agents(app, row);
return Semantics(
container: true,
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 27f4232cc..cf426666e 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -1250,6 +1250,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
? '${row.title}\n$detail'
: '${row.title}\n${row.terminalDetail ?? row.detail}'
'${widget.unavailableReason == null ? '' : ', ${widget.unavailableReason}'}'
+ '${row.shortcut == null ? '' : ', Shortcut ${row.shortcut}'}'
'${widget.activityAge == null ? '' : ', Last active ${widget.activityAge} ago'}',
excludeSemantics: true,
child: Column(
@@ -1260,40 +1261,56 @@ class _SearchRowContentState extends State<_SearchRowContent> {
height: cell.height,
color: widget.highlighted ? theme.selection : Colors.transparent,
padding: EdgeInsets.symmetric(horizontal: cell.width),
- child: Row(
- children: [
- // Match Cmd-N's empty two-cell gutter.
- SizedBox(width: cell.width * 2),
- Expanded(
- child: row.isCreate
- ? Text(row.title, style: style, maxLines: 1)
- : SearchResultText(
- row.title,
- matches: matches.where((match) => match.title),
- style: style,
- ),
- ),
- if (widget.unavailableReason case final reason?) ...[
+ child: LayoutBuilder(
+ builder: (context, constraints) => Row(
+ children: [
+ // Match Cmd-N's empty two-cell gutter.
SizedBox(width: cell.width * 2),
- Text(
- reason,
- maxLines: 1,
- style: terminalContentStyle(color: muted),
+ Expanded(
+ child: row.isCreate
+ ? Text(row.title, style: style, maxLines: 1)
+ : SearchResultText(
+ row.title,
+ matches: matches.where((match) => match.title),
+ style: style,
+ ),
),
- ] else if (widget.activityAge case final age?) ...[
- SizedBox(width: cell.width * 2),
- Tooltip(
- message: 'Last active ${row.lastActivityAt!.toLocal()}',
- child: Text(
- age,
+ if (widget.unavailableReason case final reason?) ...[
+ SizedBox(width: cell.width * 2),
+ Text(
+ reason,
maxLines: 1,
- style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .38),
+ style: terminalContentStyle(color: muted),
+ ),
+ ] else if (row.shortcut case final shortcut?) ...[
+ SizedBox(width: cell.width * 2),
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: constraints.maxWidth * .4,
+ ),
+ child: Text(
+ shortcut,
+ key: ValueKey('swarm-search-shortcut:${row.id}'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: terminalContentStyle(color: muted),
),
),
- ),
+ ] else if (widget.activityAge case final age?) ...[
+ SizedBox(width: cell.width * 2),
+ Tooltip(
+ message: 'Last active ${row.lastActivityAt!.toLocal()}',
+ child: Text(
+ age,
+ maxLines: 1,
+ style: terminalContentStyle(
+ color: theme.foreground.withValues(alpha: .38),
+ ),
+ ),
+ ),
+ ],
],
- ],
+ ),
),
),
if (!widget.singleLine && !row.isCommand && detail.isNotEmpty)
diff --git a/desktop/test/bios_navigation_test.dart b/desktop/test/bios_navigation_test.dart
index 40d126d00..04de241a7 100644
--- a/desktop/test/bios_navigation_test.dart
+++ b/desktop/test/bios_navigation_test.dart
@@ -106,7 +106,7 @@ void main() {
expect(search.rows.skip(1).map((row) => row.agentId), ['a1', 'a11']);
expect(search.selected!.agentId, 'a11');
search.setQuery('>');
- expect(search.setupLayout, isFalse);
+ expect(search.setupLayout, isTrue);
});
test(
diff --git a/desktop/test/command_picker_rendering_test.dart b/desktop/test/command_picker_rendering_test.dart
new file mode 100644
index 000000000..fd29ade32
--- /dev/null
+++ b/desktop/test/command_picker_rendering_test.dart
@@ -0,0 +1,330 @@
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shared/theme/color_palette.dart';
+import 'package:harness/shortcuts/app_keymap.dart';
+import 'package:harness/state/app_state.dart';
+import 'package:harness/state/swarm_catalog.dart';
+import 'package:harness/terminal/terminal_binary.dart';
+import 'package:harness/terminal/terminal_text.dart';
+import 'package:harness/terminal/terminal_theme_store.dart';
+import 'package:harness/widgets/search_result_text.dart';
+import 'package:harness/widgets/swarm_switcher.dart';
+import 'package:xterm/xterm.dart';
+
+import 'keymap_host_test.dart' show MemoryKeymap, key;
+import 'box_render_preview_test.dart' show loadPreviewFonts;
+import 'support/open_harness.dart';
+import 'support/real_fonts.dart';
+import 'swarm_screen_test.dart' show terminal;
+import 'swarm_state_test.dart' show createApp;
+
+final _input = find.byKey(const ValueKey('swarm-search-input'));
+final _panel = find.byKey(const ValueKey('swarm-search-results'));
+final _preview = find.byKey(const ValueKey('swarm-search-preview'));
+
+Future<void> _mount(
+ WidgetTester tester,
+ AppNotifier app,
+ MemoryKeymap map,
+) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1280, 800);
+ addTearDown(tester.view.resetPhysicalSize);
+ addTearDown(tester.view.resetDevicePixelRatio);
+ final projects = SwarmProjectStore();
+ addTearDown(projects.dispose);
+ app.machineStates['m']!.nodeOnline = true;
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ builder: (_, child) => grid.BrightnessScope(
+ child: KeymapProvider(keymap: map, child: child!),
+ ),
+ home: SwarmScreen(
+ notifier: app,
+ nativeTabs: false,
+ projectStore: projects,
+ ),
+ ),
+ );
+ await tester.pump(const Duration(milliseconds: 100));
+}
+
+void main() {
+ setUpAll(
+ Platform.environment['HARNESS_COMMAND_CAPTURE_DIR'] == null
+ ? loadRealFonts
+ : loadPreviewFonts,
+ );
+
+ testWidgets(
+ 'commands retain the Cmd-P terminal grid, editor and live appearance',
+ (tester) async {
+ final originalFont = terminalFontStore.value;
+ final originalPalette = grid.AppTheme.palette.value;
+ final originalTheme = terminalThemeStore.value;
+ addTearDown(() {
+ terminalFontStore.value = originalFont;
+ grid.AppTheme.palette.value = originalPalette;
+ terminalThemeStore.value = originalTheme;
+ });
+ final app = createApp();
+ final map = MemoryKeymap();
+ addTearDown(app.dispose);
+ addTearDown(map.dispose);
+ final frames = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a0', frames));
+ await _mount(tester, app, map);
+ await openHarnessPicker(tester);
+ final bounds = tester.getRect(_panel);
+ final inputBounds = tester.getRect(_input);
+ final editor = tester.state<EditableTextState>(
+ find.descendant(of: _input, matching: find.byType(EditableText)),
+ );
+ final controller = tester.widget<TextField>(_input).controller!;
+ final terminalBuffer = tester
+ .widget<TerminalView>(find.byType(TerminalView))
+ .terminal;
+
+ // Typing a prefix and using the launch shortcut reach the same surface.
+ await tester.enterText(_input, '>');
+ await tester.pumpAndSettle();
+ final search = tester
+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
+ .search;
+ expect(search.isCommandMode, isTrue);
+ expect(search.hasPreview, isTrue);
+ expect(tester.getRect(_panel), bounds);
+ expect(tester.getRect(_input), inputBounds);
+ expect(
+ tester.state<EditableTextState>(
+ find.descendant(of: _input, matching: find.byType(EditableText)),
+ ),
+ same(editor),
+ );
+ expect(find.byType(SwarmSearchHints), findsNothing);
+ expect(find.byType(SwarmSearchCount), findsNothing);
+ expect(
+ find.descendant(of: _panel, matching: find.byType(Icon)),
+ findsNothing,
+ );
+ expect(
+ find.descendant(of: _panel, matching: find.byType(ListTile)),
+ findsNothing,
+ );
+
+ await tester.enterText(_input, '> new harness');
+ await tester.pumpAndSettle();
+ final selected = search.selected!;
+ expect(selected.commandId, 'agent.new');
+ final editing = controller.value;
+
+ void checkAppearance() {
+ final field = tester.widget<TextField>(_input);
+ final pane = tester.widget<TerminalView>(find.byType(TerminalView));
+ final cell = terminalCellSizeOf(tester.element(_input));
+ final line = find.byKey(ValueKey('swarm-search-line:${selected.id}'));
+ expect(tester.getSize(line).height, closeTo(cell.height, .01));
+ expect(tester.widget<Container>(line).color, pane.theme.selection);
+ expect(tester.widget<Material>(_panel).color, pane.theme.background);
+ expect(field.cursorWidth, 2);
+ expect(field.cursorColor, pane.theme.cursor);
+ final title = find.descendant(
+ of: line,
+ matching: find.byType(SearchResultText),
+ );
+ expect(
+ tester.getTopLeft(title).dx,
+ closeTo(tester.getTopLeft(_input).dx, .01),
+ );
+ final shortcut = find.byKey(
+ ValueKey('swarm-search-shortcut:${selected.id}'),
+ );
+ expect(tester.widget<Text>(shortcut).data, selected.shortcut);
+ final previewText = tester.widgetList<Text>(
+ find.descendant(of: _preview, matching: find.byType(Text)),
+ );
+ expect(previewText.map((text) => text.data), [
+ selected.title,
+ selected.detail,
+ selected.shortcut,
+ ]);
+ for (final style in [
+ field.style!,
+ tester.widget<SearchResultText>(title).style,
+ tester.widget<Text>(shortcut).style!,
+ ...previewText.map((text) => text.style!),
+ ]) {
+ expect(style.fontFamily, pane.textStyle.fontFamily);
+ expect(style.fontFamilyFallback, pane.textStyle.fontFamilyFallback);
+ expect(style.fontSize, pane.textStyle.fontSize);
+ expect(style.fontWeight, pane.textStyle.toTextStyle().fontWeight);
+ expect(style.height, pane.textStyle.height);
+ expect(style.letterSpacing, 0);
+ expect(style.wordSpacing, 0);
+ }
+ expect(field.controller, same(controller));
+ expect(controller.value, editing);
+ expect(field.focusNode!.hasFocus, isTrue);
+ expect(search.selected!.id, selected.id);
+ expect(pane.terminal, same(terminalBuffer));
+ expect(frames, isEmpty);
+ expect(tester.takeException(), isNull);
+ }
+
+ terminalThemeStore.value = TerminalThemeChoice.matchApp;
+ for (final palette in HarnessPalette.values) {
+ grid.AppTheme.palette.value = palette;
+ await tester.pumpAndSettle();
+ checkAppearance();
+ }
+ terminalThemeStore.value = TerminalThemeChoice.tango;
+ terminalFontStore.value = const TerminalStyle(
+ fontSize: 18,
+ fontFamily: 'Menlo',
+ fontFamilyFallback: ['monospace'],
+ height: 1.4,
+ );
+ await tester.pumpAndSettle();
+ checkAppearance();
+
+ // Empty results never show a stale command preview or execute it.
+ await tester.enterText(_input, '> no-such-command-923');
+ await tester.pumpAndSettle();
+ expect(search.selected, isNull);
+ expect(find.text('No matching commands'), findsOneWidget);
+ expect(
+ find.descendant(of: _preview, matching: find.byType(Text)),
+ findsNothing,
+ );
+ await key(tester, LogicalKeyboardKey.enter);
+ expect(_input, findsOneWidget);
+ await tester.enterText(_input, '');
+ await tester.pumpAndSettle();
+ expect(search.isCommandMode, isFalse);
+ expect(tester.getRect(_panel), bounds);
+ expect(controller.text, isEmpty);
+ expect(
+ find.byKey(const ValueKey('swarm-search-type-hints')),
+ findsOneWidget,
+ );
+ await key(tester, LogicalKeyboardKey.escape);
+ final linux = defaultTargetPlatform == TargetPlatform.linux;
+ await key(
+ tester,
+ LogicalKeyboardKey.keyP,
+ cmd: !linux,
+ ctrl: linux,
+ shift: true,
+ );
+ expect(tester.widget<TextField>(_input).controller!.text, '>');
+ expect(
+ tester.widget<SwarmSearchResults>(find.byType(SwarmSearchResults)).bios,
+ isTrue,
+ );
+ expect(tester.getRect(_panel), bounds);
+ expect(frames, isEmpty);
+ await tester.pumpWidget(const SizedBox());
+ },
+ variant: TargetPlatformVariant({
+ TargetPlatform.macOS,
+ TargetPlatform.linux,
+ }),
+ );
+
+ for (final size in [const Size(1280, 800), const Size(400, 600)]) {
+ testWidgets('commands page and preview on the terminal grid at $size', (
+ tester,
+ ) async {
+ final originalFont = terminalFontStore.value;
+ addTearDown(() => terminalFontStore.value = originalFont);
+ if (size.width < 800) {
+ terminalFontStore.value = const TerminalStyle(
+ fontSize: 22,
+ fontFamily: 'Menlo',
+ height: 1.4,
+ );
+ }
+ final app = createApp();
+ final map = MemoryKeymap();
+ addTearDown(app.dispose);
+ addTearDown(map.dispose);
+ app.adoptSessionForTest(terminal('a0', []));
+ await _mount(tester, app, map);
+ tester.view.physicalSize = size;
+ await tester.pump();
+ await key(tester, LogicalKeyboardKey.keyP, cmd: true, shift: true);
+ final search = tester
+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
+ .search;
+ final field = tester.widget<TextField>(_input);
+ final value = field.controller!.value;
+ final first = search.cursor;
+ await key(tester, LogicalKeyboardKey.pageDown);
+ expect(search.cursor, greaterThan(first + 1));
+ await key(tester, LogicalKeyboardKey.pageUp);
+ expect(search.cursor, first);
+ await key(tester, LogicalKeyboardKey.tab);
+ expect(search.cursor, first + 1);
+ expect(field.controller!.value, value);
+ expect(field.focusNode!.hasFocus, isTrue);
+ final list = find.byKey(const ValueKey('swarm-search-result-list'));
+ expect(
+ size.width > 800
+ ? tester.getRect(_preview).left > tester.getRect(list).right
+ : tester.getRect(_preview).top > tester.getRect(list).bottom,
+ isTrue,
+ );
+ await tester.enterText(_input, '> new harness');
+ await tester.pumpAndSettle();
+ map.apply('''{"bindings":[
+ {"keys":"cmd+n","command":null},
+ {"keys":"ctrl+shift+alt+x ctrl+shift+alt+y","command":"agent.new"}
+ ]}''');
+ await tester.pumpAndSettle();
+ final shortcut = map.hint('agent.new');
+ expect(search.selected!.shortcut, shortcut);
+ expect(
+ find.descendant(of: _preview, matching: find.text(shortcut!)),
+ findsOneWidget,
+ );
+ expect(field.controller!.text, '> new harness');
+ expect(tester.takeException(), isNull);
+ map.apply('{"bindings":[]}');
+ await tester.enterText(_input, '?');
+ await tester.pumpAndSettle();
+ expect(search.hasPreview, isTrue);
+ expect(find.text('No recent session text available.'), findsNothing);
+ expect(
+ tester.widget<TextField>(_input).controller,
+ same(field.controller),
+ );
+ await tester.enterText(_input, '> new');
+ await tester.pumpAndSettle();
+ final directory = Platform.environment['HARNESS_COMMAND_CAPTURE_DIR'];
+ if (directory != null) {
+ final layer =
+ tester.binding.renderViews.first.debugLayer! as OffsetLayer;
+ final rect = tester.getRect(_panel);
+ await tester.runAsync(() async {
+ final image = await layer.toImage(rect);
+ final data = await image.toByteData(format: ui.ImageByteFormat.png);
+ await Directory(directory).create(recursive: true);
+ await File('$directory/commands-${size.width.toInt()}.png')
+ .writeAsBytes(data!.buffer.asUint8List());
+ image.dispose();
+ });
+ }
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ });
+ }
+}
diff --git a/desktop/test/search_workspace_test.dart b/desktop/test/search_workspace_test.dart
index 3ddc3d5c7..2faed666d 100644
--- a/desktop/test/search_workspace_test.dart
+++ b/desktop/test/search_workspace_test.dart
@@ -1,4 +1,5 @@
import 'support/open_harness.dart';
+
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -41,14 +42,14 @@ void main() {
await key(tester, LogicalKeyboardKey.keyP, cmd: true, shift: true);
final controller = tester.widget<TextField>(field).controller!;
final focus = tester.widget<TextField>(field).focusNode!;
- final selected = find.byWidgetPredicate(
- (w) => w is ListTile && w.selected,
- );
- final first = tester.widget<ListTile>(selected).key;
+ final search = tester
+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
+ .search;
+ final first = search.selected!.id;
await key(tester, LogicalKeyboardKey.arrowUp);
- expect(tester.widget<ListTile>(selected).key, isNot(first));
+ expect(search.selected!.id, isNot(first));
await key(tester, LogicalKeyboardKey.arrowDown);
- expect(tester.widget<ListTile>(selected).key, first);
+ expect(search.selected!.id, first);
await tester.enterText(field, '> new');
await key(tester, LogicalKeyboardKey.keyA, cmd: true);
expect(controller.selection.textInside(controller.text), '> new');
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index a7169327e..9c41e4ccf 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -33,6 +33,10 @@ void main() {
expect(tester.widget<TextField>(_input).controller!.text, '>');
expect(
find.textContaining('run command', findRichText: true),
+ findsNothing,
+ );
+ expect(
+ find.byKey(const ValueKey('swarm-search-preview')),
findsOneWidget,
);
expect(find.widgetWithText(ListTile, 'Agent 0'), findsNothing);
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 1e4906a26..5f4214a4f 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -109,7 +109,12 @@ void main() {
find.byKey(const ValueKey('swarm-navigation-locations')),
findsNothing,
);
- expect(find.byKey(const ValueKey('swarm-search-preview')), findsNothing);
+ final preview = find.byKey(const ValueKey('swarm-search-preview'));
+ expect(preview, findsOneWidget);
+ expect(
+ find.descendant(of: preview, matching: find.byType(Text)),
+ search.selected == null ? findsNothing : findsWidgets,
+ );
}
await tester.enterText(field, '');
await tester.pump();
diff --git a/desktop/test/toolbar_onboarding_test.dart b/desktop/test/toolbar_onboarding_test.dart
index 37431ea0b..9c193d5dc 100644
--- a/desktop/test/toolbar_onboarding_test.dart
+++ b/desktop/test/toolbar_onboarding_test.dart
@@ -292,7 +292,13 @@ void main() {
'> Open Models',
);
await tester.pumpAndSettle();
- expect(find.text('Open Models'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('command:models.list')),
+ matching: find.text('Open Models'),
+ ),
+ findsOneWidget,
+ );
await key(tester, LogicalKeyboardKey.enter);
await tester.pumpAndSettle();
expect(resourceScope(':'), findsOneWidget);