mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Merge commit 'e5d30a9f6d0854e20049309333c2f637cd03025c' as 'frontend'
This commit is contained in:
24
frontend/test/new_task_button_test.dart
Normal file
24
frontend/test/new_task_button_test.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user