Files
pipelines/app/test/features/chat/ui/sessions/chat_toolbar_test.dart
T

40 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/ui/sessions/chat_sessions_screen.dart';
import 'chat_test_harness.dart';
import 'fake_chat_gateway.dart';
void main() {
testWidgets('embedded, New chat and Refresh share one actions row', (
tester,
) async {
final gateway = FakeChatGateway()
..sessionsReply = {'chat_sessions': sampleSessions()};
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(
body: ChatSessionsScreen(
gateway: gateway,
onOpen: (_) {},
embedded: true,
localStore: MemoryChatSessionLocalStore(),
),
),
),
);
await tester.pumpAndSettle();
// No search field: New chat and Refresh share one actions row.
expect(find.byType(TextField), findsNothing);
final create = find.byKey(const Key('chat-new-chat'));
final refresh = find.byKey(const Key('chat-refresh'));
expect(create, findsOneWidget);
expect(
(tester.getCenter(create).dy - tester.getCenter(refresh).dy).abs(),
lessThan(4),
);
});
}