Merge branch 'worktree-agent-a785be85dc8fbff78'

This commit is contained in:
2026-12-02 20:15:14 +00:00
26 changed files with 1105 additions and 96 deletions
@@ -0,0 +1,86 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'chat_composer_bar_fixtures.dart';
final _send = find.byKey(const Key('chat-composer-primary'));
Future<ComposerBarGateway> _pumpDraft(WidgetTester tester, String text) async {
final gateway = ComposerBarGateway()..page = fixtureTurn();
addTearDown(gateway.close);
await tester.pumpWidget(
composerThread(gateway, newOperationId: () => 'op/1'),
);
await tester.pumpAndSettle();
await tester.enterText(find.byKey(const Key('chat-composer-field')), text);
await tester.pump();
return gateway;
}
void main() {
testWidgets('right-click on Send schedules the message with send_at', (
tester,
) async {
final gateway = await _pumpDraft(tester, 'Check the deploy');
final before = DateTime.now();
await tester.tap(_send, buttons: kSecondaryButton);
await tester.pumpAndSettle();
expect(find.text('Send later…'), findsOneWidget);
expect(find.text('Tomorrow at 9:00'), findsOneWidget);
// No usage report: no reset time to offer.
expect(find.byKey(const Key('chat-send-later-usageReset')), findsNothing);
await tester.tap(find.byKey(const Key('chat-send-later-hour')));
await tester.pumpAndSettle();
final body = gateway.promptBodies.single;
expect(body['text'], 'Check the deploy');
final sendAt = DateTime.fromMillisecondsSinceEpoch(body['send_at'] as int);
expect(sendAt.difference(before).inMinutes, inInclusiveRange(59, 61));
expect(fieldText(tester), isEmpty);
});
testWidgets('long-press opens it on touch, and Send still sends now', (
tester,
) async {
final gateway = await _pumpDraft(tester, 'Now please');
await tester.longPress(_send);
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-send-later-halfHour')), findsOneWidget);
await tester.tapAt(const Offset(5, 5));
await tester.pumpAndSettle();
await tester.tap(_send);
await tester.pumpAndSettle();
expect(gateway.promptBodies.single.containsKey('send_at'), isFalse);
});
testWidgets('the keyboard opens it from Send with Shift+F10', (tester) async {
final gateway = await _pumpDraft(tester, 'Later');
// Focus the Send button itself, as Tab would.
Focus.of(tester.element(find.byIcon(Icons.arrow_upward))).requestFocus();
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.f10);
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-send-later-tomorrowMorning')), findsOne);
await tester.tap(find.byKey(const Key('chat-send-later-tomorrowMorning')));
await tester.pumpAndSettle();
final at = DateTime.fromMillisecondsSinceEpoch(
gateway.promptBodies.single['send_at'] as int,
);
expect((at.hour, at.minute), (9, 0));
});
testWidgets('a slash command cannot be scheduled', (tester) async {
final gateway = await _pumpDraft(tester, '/compact');
await tester.tap(_send, buttons: kSecondaryButton);
await tester.pumpAndSettle();
final item = tester.widget<MenuItemButton>(
find.byKey(const Key('chat-send-later-hour')),
);
expect(item.onPressed, isNull);
expect(gateway.promptBodies, isEmpty);
});
}