Files
Auto-GPT/test/new_task_button_test.dart
hunteraraujo d7b6d1e49a Implement and Test Chat Input Field Widget
This commit introduces the ChatInputField widget, a custom text input field designed for use within the ChatView. The ChatInputField widget handles varying screen sizes and gracefully resizes itself according to the available width. It starts with a height of 50 and can expand up to 400 as the user types more lines of text.

In addition to the implementation, this commit also includes widget tests to ensure the ChatInputField behaves as expected.

- Add ChatInputField widget with dynamic resizing
- Include IconButton for sending messages
- Add widget tests for ChatInputField
- Handle edge cases and overflows
2023-08-24 11:55:05 -07:00

25 lines
754 B
Dart

import 'package:auto_gpt_flutter_client/views/task/new_task_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('NewTaskButton triggers callback on press',
(WidgetTester tester) async {
bool wasPressed = false;
// Build our widget.
await tester.pumpWidget(MaterialApp(
home: Scaffold(
body: NewTaskButton(onPressed: () => wasPressed = true),
),
));
// Verify if the button with the text 'New Task' is displayed.
expect(find.text('New Task'), findsOneWidget);
// Tap the button and verify if the onPressed callback is triggered.
await tester.tap(find.byType(ElevatedButton));
expect(wasPressed, true);
});
}