File tree 2 files changed +24
-10
lines changed
catalyst_voices/apps/voices
2 files changed +24
-10
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import 'package:catalyst_voices/configs/bootstrap.dart';
3
3
import 'package:catalyst_voices/routes/routes.dart' ;
4
4
import 'package:catalyst_voices_models/catalyst_voices_models.dart' ;
5
5
import 'package:flutter_test/flutter_test.dart' ;
6
+ import 'package:go_router/go_router.dart' ;
6
7
import 'package:integration_test/integration_test.dart' ;
7
8
import 'package:patrol_finders/patrol_finders.dart' ;
8
9
@@ -11,12 +12,17 @@ import 'pageobject/spaces_drawer_page.dart';
11
12
12
13
void main () async {
13
14
IntegrationTestWidgetsFlutterBinding .ensureInitialized ();
15
+ late final GoRouter router;
16
+
17
+ setUpAll (() async {
18
+ router = buildAppRouter (initialLocation: const DiscoveryRoute ().location);
19
+
20
+ await bootstrap (router: router);
21
+ });
14
22
15
23
patrolWidgetTest ('Spaces drawer guest menu renders correctly' ,
16
24
(PatrolTester $) async {
17
- final args =
18
- await bootstrap (initialLocation: const DiscoveryRoute ().location);
19
- await $.pumpWidgetAndSettle (App (routerConfig: args.routerConfig));
25
+ await $.pumpWidgetAndSettle (App (routerConfig: router));
20
26
await $(DashboardPage .guestShortcutBtn).tap ();
21
27
await $.pumpAndSettle ();
22
28
await Future <void >.delayed (const Duration (seconds: 5 ));
Original file line number Diff line number Diff line change @@ -74,14 +74,27 @@ Future<void> _doBootstrapAndRun(BootstrapWidgetBuilder builder) async {
74
74
await _runApp (app);
75
75
}
76
76
77
+ GoRouter buildAppRouter ({
78
+ String ? initialLocation,
79
+ }) {
80
+ return AppRouter .init (
81
+ initialLocation: initialLocation,
82
+ guards: const [
83
+ MilestoneGuard (),
84
+ ],
85
+ );
86
+ }
87
+
77
88
/// Initializes the application before it can be run. Should setup all
78
89
/// the things which are necessary before the actual app is run,
79
90
/// either via [runApp] or injected into a test environment during
80
91
/// integration tests.
81
92
///
82
93
/// Initialization logic that is relevant for [runApp] scenario
83
94
/// only should be added to [_doBootstrapAndRun] , not here.
84
- Future <BootstrapArgs > bootstrap ({String ? initialLocation}) async {
95
+ Future <BootstrapArgs > bootstrap ({
96
+ GoRouter ? router,
97
+ }) async {
85
98
_loggingService
86
99
..level = kDebugMode ? Level .FINER : Level .OFF
87
100
..printLogs = kDebugMode;
@@ -94,12 +107,7 @@ Future<BootstrapArgs> bootstrap({String? initialLocation}) async {
94
107
// Key derivation needs to be initialized before it can be used
95
108
await CatalystKeyDerivation .init ();
96
109
97
- final router = AppRouter .init (
98
- initialLocation: initialLocation,
99
- guards: const [
100
- MilestoneGuard (),
101
- ],
102
- );
110
+ router ?? = buildAppRouter ();
103
111
104
112
Bloc .observer = AppBlocObserver ();
105
113
You can’t perform that action at this time.
0 commit comments