Skip to content

Commit

Permalink
Run async test code directly
Browse files Browse the repository at this point in the history
Without the use of tester.runAsync
  • Loading branch information
stephanmantel committed May 28, 2024
1 parent 0b87d8f commit 6c736b6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions example/test/main_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ void main() {
});

testWidgets('Tapping save stores task in database', (tester) async {
await tester.runAsync(() async {
await tester.pumpWidget(FloorApp(taskDao));
final textFieldFinder = find.byType(TextField);
final raisedButtonFinder = find.byType(OutlinedButton);
await tester.pumpWidget(FloorApp(taskDao));
final textFieldFinder = find.byType(TextField);
final raisedButtonFinder = find.byType(OutlinedButton);

await tester.enterText(textFieldFinder, 'Hello world!');
await tester.tap(raisedButtonFinder);
await tester.enterText(textFieldFinder, 'Hello world!');
await tester.tap(raisedButtonFinder);

final tasks = await taskDao.findAllTasks();
expect(tasks, isNotEmpty);
});
final tasks = await taskDao.findAllTasks();
expect(tasks, isNotEmpty);
});

testWidgets('Tapping save clears text input field', (tester) async {
Expand Down

0 comments on commit 6c736b6

Please sign in to comment.