@@ -92,7 +92,7 @@ void main() {
92
92
93
93
TestZulipBinding .ensureInitialized ();
94
94
95
- Future <void > prepareContentBare (WidgetTester tester, String html, {
95
+ Future <List < Route < dynamic >> > prepareContentBare (WidgetTester tester, String html, {
96
96
bool wrapWithScaffold = false ,
97
97
bool wrapWithPerAccountStoreWidget = false ,
98
98
}) async {
@@ -110,17 +110,28 @@ void main() {
110
110
widget = GlobalStoreWidget (child: widget);
111
111
addTearDown (testBinding.reset);
112
112
113
+ final pushedRoutes = < Route <dynamic >> [];
114
+ final testNavObserver = TestNavigatorObserver ()
115
+ ..onPushed = (route, prevRoute) => pushedRoutes.add (route);
116
+
113
117
await tester.pumpWidget (
114
118
Builder (builder: (context) =>
115
119
MaterialApp (
116
120
theme: ThemeData (typography: zulipTypography (context)),
117
121
localizationsDelegates: ZulipLocalizations .localizationsDelegates,
118
122
supportedLocales: ZulipLocalizations .supportedLocales,
123
+ navigatorObservers: [testNavObserver],
119
124
home: widget)));
120
125
await tester.pump (); // global store
121
126
if (wrapWithPerAccountStoreWidget) {
122
127
await tester.pump ();
123
128
}
129
+
130
+ // `tester.pumpWidget` introduces an initial route;
131
+ // remove it so consumers only have newly pushed routes.
132
+ assert (pushedRoutes.length == 1 );
133
+ pushedRoutes.removeLast ();
134
+ return pushedRoutes;
124
135
}
125
136
126
137
/// Test that the given content example renders without throwing an exception.
0 commit comments