@@ -1176,6 +1176,49 @@ void main() {
1176
1176
takeStartingRoutes (account: accountB);
1177
1177
matchesNavigation (check (pushedRoutes).single, accountB, message);
1178
1178
});
1179
+
1180
+ testWidgets ('back navigation after opening a notification will preserve target account context' , (tester) async {
1181
+ addTearDown (testBinding.reset);
1182
+
1183
+ final accountA = eg.selfAccount;
1184
+ final accountB = eg.otherAccount;
1185
+ final message = eg.streamMessage ();
1186
+
1187
+ await testBinding.globalStore.add (accountA, eg.initialSnapshot ());
1188
+ await testBinding.globalStore.add (accountB, eg.initialSnapshot ());
1189
+
1190
+ await prepare (tester, early: true );
1191
+ await tester.pump ();
1192
+ takeStartingRoutes (account: accountA);
1193
+
1194
+ Route <dynamic >? topRoute;
1195
+ final navigator = await ZulipApp .navigator;
1196
+ navigator.popUntil ((r) {
1197
+ topRoute = r;
1198
+ return true ;
1199
+ });
1200
+ check (topRoute).isA <AccountRoute >().accountId.equals (accountA.id);
1201
+ await openNotification (tester, accountB, message);
1202
+
1203
+ navigator.popUntil ((r) {
1204
+ topRoute = r;
1205
+ return true ;
1206
+ });
1207
+ check (topRoute).isA <MaterialAccountWidgetRoute >()
1208
+ ..accountId.equals (accountB.id)
1209
+ ..page.isA <MessageListPage >();
1210
+
1211
+ navigator.pop ();
1212
+ await tester.pumpAndSettle ();
1213
+
1214
+ navigator.popUntil ((r) {
1215
+ topRoute = r;
1216
+ return true ;
1217
+ });
1218
+ check (topRoute).isA <MaterialAccountWidgetRoute >()
1219
+ ..accountId.equals (accountB.id)
1220
+ ..page.isA <HomePage >();
1221
+ });
1179
1222
});
1180
1223
1181
1224
group ('NotificationOpenPayload' , () {
0 commit comments