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.

test(desktop): align release checks with split and Linux controls (#499)

Dee8023d56c1809
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index eb549bea4..8c86cdc75 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -230,6 +230,8 @@ void main() {
final field = find.byKey(const ValueKey('swarm-search-input'));
if (entry == 'Open') {
await openHarnessPicker(tester);
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ await chord(tester, LogicalKeyboardKey.keyN);
} else {
await chord(tester, LogicalKeyboardKey.keyP, shift: true);
await tester.enterText(field, '> $entry');
@@ -237,8 +239,6 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
}
- expect(find.byType(SwarmSearchResults), findsOneWidget);
- await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.byType(SwarmSearchResults), findsNothing);
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 031329b87..fa8aba3c3 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:file_selector_platform_interface/file_selector_platform_interface.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -23,7 +24,7 @@ import 'support/agent_picker.dart';
import 'swarm_screen_test.dart' show mount, terminal;
import 'swarm_interactions_test.dart' show chord;
-import 'keymap_host_test.dart' show MemoryKeymap;
+import 'keymap_host_test.dart' show MemoryKeymap, key;
import 'keymap_runtime_test.dart' as runtime;
final _newHarness = find.byKey(const ValueKey('harness-start-new-pane'));
@@ -599,7 +600,8 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ final linux = defaultTargetPlatform == TargetPlatform.linux;
+ await key(tester, LogicalKeyboardKey.keyN, cmd: !linux, alt: linux);
await tester.pump();
// The dialog opens with focus on the harness bar, ready to type.
diff --git a/desktop/test/resource_picker_test.dart b/desktop/test/resource_picker_test.dart
index daf6c3d7b..1c9bacf09 100644
--- a/desktop/test/resource_picker_test.dart
+++ b/desktop/test/resource_picker_test.dart
@@ -997,7 +997,7 @@ void main() {
await configured.mount(tester, app, keymap);
final mac = defaultTargetPlatform == TargetPlatform.macOS;
final pane = app.focusedPaneId;
- await key(tester, LogicalKeyboardKey.keyI, cmd: mac, ctrl: !mac);
+ await key(tester, LogicalKeyboardKey.keyI, cmd: mac, alt: !mac);
expect(search(tester).isModelMode, isTrue);
expect(tester.widget<TextField>(field).controller!.text, ':');
expect(
@@ -1016,7 +1016,7 @@ void main() {
expect(find.text('mac.lan'), findsOneWidget);
if (mac) await capture(tester, 'own-machine-model');
await key(tester, LogicalKeyboardKey.escape);
- await key(tester, LogicalKeyboardKey.keyO, cmd: mac, ctrl: !mac);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: mac, alt: !mac);
expect(field, findsOneWidget);
expect(search(tester).scopePrefix, '#');
final editor = tester.widget<TextField>(field).controller!;
@@ -1028,7 +1028,13 @@ void main() {
expect(search(tester).hint, 'Search harnesses');
expect(search(tester).rows.any((row) => row.isCreate), isFalse);
await key(tester, LogicalKeyboardKey.escape);
- await key(tester, LogicalKeyboardKey.keyP, cmd: mac, ctrl: !mac);
+ await key(
+ tester,
+ LogicalKeyboardKey.keyP,
+ cmd: mac,
+ alt: !mac,
+ shift: !mac,
+ );
expect(search(tester).scopePrefix, '');
expect(tester.widget<TextField>(field).controller!.text, isEmpty);
expect(tester.widget<TextField>(field).cursorWidth, 2);
@@ -1046,9 +1052,15 @@ void main() {
expect(hints, findsOneWidget);
expect(search(tester).isModelMode, isTrue);
await key(tester, LogicalKeyboardKey.escape);
- await key(tester, LogicalKeyboardKey.keyP, cmd: mac, ctrl: !mac);
+ await key(
+ tester,
+ LogicalKeyboardKey.keyP,
+ cmd: mac,
+ alt: !mac,
+ shift: !mac,
+ );
final origin = search(tester);
- await key(tester, LogicalKeyboardKey.keyI, cmd: mac, ctrl: !mac);
+ await key(tester, LogicalKeyboardKey.keyI, cmd: mac, alt: !mac);
expect(search(tester), same(origin));
expect(search(tester).isModelMode, isTrue);
expect(tester.widget<TextField>(field).controller!.text, ':');
diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dart
index f0d79eada..11f1ff325 100644
--- a/desktop/test/swarm_add_agent_test.dart
+++ b/desktop/test/swarm_add_agent_test.dart
@@ -9,7 +9,6 @@ import 'package:harness/state/swarm_search.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:xterm/xterm.dart';
-import 'swarm_interactions_test.dart' show chord;
import 'swarm_screen_test.dart' show mount, terminal;
import 'swarm_state_test.dart' show createApp;
@@ -52,7 +51,7 @@ void main() {
for (final axis in PaneResizeAxis.values) {
testWidgets(
- 'split ${axis.name} chooses an existing agent and preserves its neighbors',
+ 'placing an existing agent into a ${axis.name} split preserves its neighbors',
(tester) async {
final app = createApp();
final input = <TerminalBinaryFrame>[];
@@ -69,21 +68,16 @@ void main() {
await tester.pump();
final neighborRect = tester.getRect(find.byKey(neighbor.cellKey));
final expected = app.preparePaneSplit(axis)!;
- await chord(tester, LogicalKeyboardKey.keyP, shift: true);
- final inputField = find.byKey(const ValueKey('swarm-search-input'));
- await tester.enterText(
- inputField,
- axis == PaneResizeAxis.x ? '> split right' : '> split down',
+ // Split commands now create a new harness directly. Existing sessions
+ // still use this placement path when assigned to a split destination.
+ await app.assignAgentToPane(
+ null,
+ 'm',
+ 'a2',
+ swarmId: target.id,
+ split: expected,
);
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.pump();
- expect(find.byType(AlertDialog), findsNothing);
- expect(app.panes, [first, neighbor]);
- await tester.enterText(inputField, 'Agent 2');
- await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.pump();
expect(app.panes, [first, shared, neighbor]);
expect(source.panes, [shared]);
expect(app.activeSwarm.manualLayout!.tiles, expected.after.tiles);
diff --git a/desktop/test/terminal_clipboard_test.dart b/desktop/test/terminal_clipboard_test.dart
index 1177109f0..1cd4cb600 100644
--- a/desktop/test/terminal_clipboard_test.dart
+++ b/desktop/test/terminal_clipboard_test.dart
@@ -279,7 +279,7 @@ void main() {
expect(frames, isEmpty);
expect(
kTerminalOwnedKeys.firstWhere((item) => item.label == 'Paste').chord,
- apple ? ['⌘', 'V'] : ['⌃', '⇧', 'V'],
+ apple ? ['⌘', 'V'] : ['Ctrl', 'Shift', 'V'],
);
await tester.pumpWidget(const SizedBox());
session.dispose();
diff --git a/desktop/test/terminal_tail_lifecycle_test.dart b/desktop/test/terminal_tail_lifecycle_test.dart
index 07fa8c0eb..a2d4e1a5d 100644
--- a/desktop/test/terminal_tail_lifecycle_test.dart
+++ b/desktop/test/terminal_tail_lifecycle_test.dart
@@ -3,6 +3,7 @@ import 'support/open_harness.dart';
import 'dart:async';
import 'dart:convert';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -12,6 +13,7 @@ import 'package:harness/terminal/terminal_font_store.dart';
import 'package:harness/terminal/terminal_session.dart';
import 'swarm_interactions_test.dart' show chord;
+import 'keymap_host_test.dart' show key;
import 'swarm_screen_test.dart' show mount, terminal;
import 'swarm_state_test.dart' show createApp;
import 'terminal_find_test.dart' show terminalView;
@@ -159,7 +161,14 @@ void main() {
PanePreset.columns,
PanePreset.rows,
]) {
- await chord(tester, LogicalKeyboardKey.keyL, shift: true);
+ final linux = defaultTargetPlatform == TargetPlatform.linux;
+ await key(
+ tester,
+ LogicalKeyboardKey.keyL,
+ cmd: !linux,
+ alt: linux,
+ shift: true,
+ );
await tester.pump(const Duration(milliseconds: 200));
await tester.tap(find.text(preset.label));
await tester.pump();
diff --git a/desktop/test/workspace_context_navigation_test.dart b/desktop/test/workspace_context_navigation_test.dart
index 732e15d56..5221131e3 100644
--- a/desktop/test/workspace_context_navigation_test.dart
+++ b/desktop/test/workspace_context_navigation_test.dart
@@ -14,8 +14,8 @@ import 'package:harness/widgets/workspace_bar_control.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'support/resource_picker.dart';
+import 'support/open_harness.dart';
import 'swarm_screen_test.dart' show mount, terminal;
-import 'swarm_interactions_test.dart' show chord;
import 'swarm_state_test.dart' show createApp;
AppNotifier fixture() {
@@ -262,8 +262,8 @@ void main() {
await mount(tester, app, nativeTabs: native);
for (final field in StatusLineField.values) {
if (field == StatusLineField.machine) {
- await chord(tester, LogicalKeyboardKey.keyR);
- expect(resourceSearch(tester).split, isNotNull);
+ await openHarnessPicker(tester);
+ expect(resourceSearch(tester).scopePrefix, isEmpty);
// Flutter's modal barrier covers its bar; AppKit's native bar
// remains available while a picker is open.
if (!native) {