Open selected chats from search
Re-apply explicit chat routes after workspace restoration and repeated route notifications so search results and chat notifications open the requested session. Add regression coverage for route, registration, and workspace restore behavior.
This commit is contained in:
@@ -381,6 +381,75 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a mounted chat notification route activates a different chat',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(900, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/old')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
androidSupported: false,
|
||||
server: webServer(),
|
||||
client: client,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
await replyChatSessions(tester, channel, ['old', 'target']);
|
||||
await replyChatHistory(
|
||||
tester,
|
||||
channel,
|
||||
subscribeIndex: 0,
|
||||
historyIndex: 0,
|
||||
text: 'The retained chat.',
|
||||
);
|
||||
expect(find.text('The retained chat.'), findsOneWidget);
|
||||
|
||||
// This is the route delivered by a native chat notification, not a
|
||||
// direct ChatScreen replacement.
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/chat/target')),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/chat/target');
|
||||
|
||||
await replyChatHistory(
|
||||
tester,
|
||||
channel,
|
||||
subscribeIndex: 1,
|
||||
historyIndex: 1,
|
||||
text: 'The notified chat.',
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(requestOf(channel, 'chat_subscribe', index: 1)!['chat_subscribe'], {
|
||||
'session_id': 'target',
|
||||
});
|
||||
expect(requestOf(channel, 'chat_messages', index: 1)!['chat_query'], {
|
||||
'session_id': 'target',
|
||||
'limit': 200,
|
||||
'cursor': '',
|
||||
});
|
||||
expect(find.text('The notified chat.'), findsOneWidget);
|
||||
expect(find.text('The retained chat.'), findsNothing);
|
||||
expect(provider.value.uri.path, '/chat/target');
|
||||
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'mobile Chats retap reopens the retained multi-pane workspace after tabs',
|
||||
(tester) async {
|
||||
|
||||
Reference in New Issue
Block a user