Skip to content

Commit

Permalink
feat: Adding tests to navigation. #4
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed May 12, 2023
1 parent ff90bee commit b920387
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,43 @@ void main() {
expect(dynamicMenuItemList, findsOneWidget);
});

testWidgets('Navigating into dynamic menu page', (WidgetTester tester) async {
// Initialize app
await tester.pumpWidget(const ProviderScope(child: App()));
await tester.pumpAndSettle();

final menuButton = find.byKey(iconKey);
final todoItem = find.byKey(todoItemKey);

// Tap on todo item
await tester.tap(todoItem);
await tester.pumpAndSettle();

// Tap menu icon
await tester.tap(menuButton);
await tester.pumpAndSettle();

// Click on second menu item which should navigate into a page
final potaroMenuItem = find.text("Potaro");
var dynamicMenuItemPage = find.byKey(dynamicMenuPageKey);

expect(potaroMenuItem, findsOneWidget);
expect(dynamicMenuItemPage, findsNothing);

// Tap on "people" menu item
await tester.tap(potaroMenuItem);
await tester.pumpAndSettle();

dynamicMenuItemPage = find.byKey(dynamicMenuPageKey);

// Should show page
expect(dynamicMenuItemPage, findsOneWidget);

final goBackButton = find.text("Go back");
await tester.tap(goBackButton);
await tester.pumpAndSettle();
});

testWidgets('Click on first expandable menu item', (WidgetTester tester) async {
// Initialize app
await tester.pumpWidget(const ProviderScope(child: App()));
Expand Down

0 comments on commit b920387

Please sign in to comment.