@@ -49,6 +49,23 @@ void main () {
49
49
await tester.pump ();
50
50
}
51
51
52
+ void checkOnLoadingPage () {
53
+ check (find.byType (CircularProgressIndicator ).hitTestable ()).findsOne ();
54
+ check (find.byType (ChooseAccountPage )).findsNothing ();
55
+ check (find.byType (HomePage )).findsNothing ();
56
+ }
57
+
58
+ ModalRoute <void >? getRouteOf (WidgetTester tester, Finder finder) =>
59
+ ModalRoute .of (tester.element (finder));
60
+
61
+ void checkOnHomePage (WidgetTester tester, {required Account expectedAccount}) {
62
+ check (find.byType (CircularProgressIndicator )).findsNothing ();
63
+ check (find.byType (ChooseAccountPage )).findsNothing ();
64
+ check (find.byType (HomePage ).hitTestable ()).findsOne ();
65
+ check (getRouteOf (tester, find.byType (HomePage )))
66
+ .isA <MaterialAccountWidgetRoute >().accountId.equals (expectedAccount.id);
67
+ }
68
+
52
69
group ('bottom nav navigation' , () {
53
70
testWidgets ('preserve states when switching between views' , (tester) async {
54
71
await prepare (tester);
@@ -255,30 +272,13 @@ void main () {
255
272
const loadPerAccountDuration = Duration (seconds: 30 );
256
273
assert (loadPerAccountDuration > kTryAnotherAccountWaitPeriod);
257
274
258
- void checkOnLoadingPage () {
259
- check (find.byType (CircularProgressIndicator ).hitTestable ()).findsOne ();
260
- check (find.byType (ChooseAccountPage )).findsNothing ();
261
- check (find.byType (HomePage )).findsNothing ();
262
- }
263
-
264
275
void checkOnChooseAccountPage () {
265
276
// Ignore the possible loading page in the background.
266
277
check (find.byType (CircularProgressIndicator ).hitTestable ()).findsNothing ();
267
278
check (find.byType (ChooseAccountPage )).findsOne ();
268
279
check (find.byType (HomePage )).findsNothing ();
269
280
}
270
281
271
- ModalRoute <void >? getRouteOf (WidgetTester tester, Finder finder) =>
272
- ModalRoute .of (tester.element (finder));
273
-
274
- void checkOnHomePage (WidgetTester tester, {required Account expectedAccount}) {
275
- check (find.byType (CircularProgressIndicator )).findsNothing ();
276
- check (find.byType (ChooseAccountPage )).findsNothing ();
277
- check (find.byType (HomePage ).hitTestable ()).findsOne ();
278
- check (getRouteOf (tester, find.byType (HomePage )))
279
- .isA <MaterialAccountWidgetRoute >().accountId.equals (expectedAccount.id);
280
- }
281
-
282
282
Future <void > prepare (WidgetTester tester) async {
283
283
addTearDown (testBinding.reset);
284
284
await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
0 commit comments