1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 06:48:26 +00:00

testing_app code review and improvements (#960)

This commit is contained in:
Miguel Beltran
2021-12-11 07:39:07 +01:00
committed by GitHub
parent 664b63c03c
commit ea624af0f9
4 changed files with 22 additions and 14 deletions

View File

@@ -53,15 +53,17 @@ void main() {
await tester.pumpAndSettle();
// Get the total number of items available.
var totalItems = tester.widgetList(find.byIcon(Icons.close)).length;
final totalItems = tester.widgetList(find.byIcon(Icons.close)).length;
// Remove one item.
await tester.tap(find.byIcon(Icons.close).first);
await tester.pumpAndSettle();
// Check if removed properly.
expect(tester.widgetList(find.byIcon(Icons.close)).length,
lessThan(totalItems));
expect(
tester.widgetList(find.byIcon(Icons.close)).length,
lessThan(totalItems),
);
// Verify if the appropriate message is shown.
expect(find.text('Removed from favorites.'), findsOneWidget);