Skip to content
Merged
Prev Previous commit
Next Next commit
- updated the example tests
  • Loading branch information
vlazdra committed Apr 7, 2023
commit b95a06ed7484e9595a0f28217c8f040c0bc17a31
22 changes: 21 additions & 1 deletion packages/go_router_builder/example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:go_router_builder_example/main.dart';

Expand All @@ -12,13 +13,24 @@ void main() {
await tester.tap(find.text('Login'));
await tester.pumpAndSettle();

await tester.tap(find.text('Push a route'));
await _openPopupMenu(tester);

await tester.tap(find.text('Push w/o return value'));
await tester.pumpAndSettle();
expect(find.text('Chris'), findsOneWidget);

await tester.pageBack();
await tester.pumpAndSettle();

await _openPopupMenu(tester);

await tester.tap(find.text('Push w/ return value'));
await tester.pumpAndSettle();
expect(find.text('Family Count'), findsOneWidget);

await tester.pageBack();
await tester.pumpAndSettle();

await tester.tap(find.text('Sells'));
await tester.pumpAndSettle();

Expand All @@ -39,3 +51,11 @@ void main() {
expect(find.text('Extra click count: 1'), findsOneWidget);
});
}

Future _openPopupMenu(WidgetTester tester) async {
final moreButton = find.byIcon(Icons.more_vert);
expect(moreButton, findsOneWidget);

await tester.tap(moreButton);
await tester.pumpAndSettle();
}