|
import 'package:auto_gpt_flutter_client/views/chat/agent_message_tile.dart'; |
|
import 'package:auto_gpt_flutter_client/views/chat/json_code_snippet_view.dart'; |
|
import 'package:flutter/material.dart'; |
|
import 'package:flutter_test/flutter_test.dart'; |
|
|
|
void main() { |
|
|
|
testWidgets('Renders AgentMessageTile', (WidgetTester tester) async { |
|
await tester.pumpWidget(const MaterialApp( |
|
home: Scaffold( |
|
body: AgentMessageTile(message: 'Test Message'), |
|
), |
|
)); |
|
|
|
|
|
expect(find.text('Agent'), findsOneWidget); |
|
|
|
expect(find.text('Test Message'), findsOneWidget); |
|
}); |
|
|
|
|
|
testWidgets('Toggle Expand/Collapse', (WidgetTester tester) async { |
|
await tester.pumpWidget(const MaterialApp( |
|
home: Scaffold( |
|
body: AgentMessageTile(message: 'Test Message'), |
|
), |
|
)); |
|
|
|
|
|
expect(find.byType(JsonCodeSnippetView), findsNothing); |
|
|
|
|
|
await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); |
|
await tester.pumpAndSettle(); |
|
|
|
|
|
expect(find.byType(JsonCodeSnippetView), findsOneWidget); |
|
|
|
|
|
await tester.tap(find.byIcon(Icons.keyboard_arrow_up)); |
|
await tester.pumpAndSettle(); |
|
|
|
|
|
expect(find.byType(JsonCodeSnippetView), findsNothing); |
|
}); |
|
} |
|
|