Retain boot chat deep links for Chats tab restore

This commit is contained in:
2026-11-08 00:18:59 +00:00
parent fa95bf57ff
commit 1a674297c1
3 changed files with 55 additions and 2 deletions
@@ -658,4 +658,52 @@ void main() {
expect(tester.takeException(), isNull);
},
);
testWidgets('Chats retap restores a boot deep link after folding and Back', (
tester,
) async {
SharedPreferences.setMockInitialValues({});
tester.view.physicalSize = const Size(1000, 1000);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(channelFactory: (_) => channel);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/a')),
);
addTearDown(provider.dispose);
addTearDown(client.dispose);
await tester.pumpWidget(
PipelinesApp(
server: webServer(),
client: client,
cupertino: false,
routeInformationProvider: provider,
),
);
await tester.pump();
await replyChatSessions(tester, channel, ['a']);
await replyChatHistory(tester, channel, subscribeIndex: 0, historyIndex: 0);
await tester.pumpAndSettle();
await tester.enterText(
find.byKey(const Key('chat-composer-field')),
'deep link draft',
);
tester.view.physicalSize = const Size(560, 1000);
await tester.pumpAndSettle();
await tester.tap(find.byTooltip('Back').hitTestable());
await tester.pumpAndSettle();
expect(provider.value.uri.path, '/chat');
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
await tester.pumpAndSettle();
expect(provider.value.uri.path, '/chat/a');
expect(find.byType(ChatThreadView), findsOneWidget);
expect(
tester
.widget<TextField>(find.byKey(const Key('chat-composer-field')))
.controller!
.text,
'deep link draft',
);
expect(tester.takeException(), isNull);
});
}