Remove Cupertino shell branches
Keep the Material-only shell path while preserving public cupertino parameters for callers. Narrow matching tests to Material hosts and behavior because the app always runs under MaterialApp.
This commit is contained in:
@@ -30,102 +30,95 @@ Map<String, dynamic> _results(String kind, List<Map<String, dynamic>> hits) => {
|
||||
/// chat search the app sends after it, then a tap on the chat hit opens that
|
||||
/// chat in the Chat tab with its session selected.
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('${cupertino ? 'Cupertino' : 'Material'}: a chat hit opens '
|
||||
'its chat in the Chat tab', (tester) async {
|
||||
tester.view.physicalSize = const Size(900, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
await pumpApp(
|
||||
tester,
|
||||
channel: channel,
|
||||
client: PipelinesClient(channelFactory: (_) => channel),
|
||||
provider: provider,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
await replyRunList(tester, channel);
|
||||
testWidgets('a chat hit opens its chat in the Chat tab', (tester) async {
|
||||
tester.view.physicalSize = const Size(900, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
await pumpApp(
|
||||
tester,
|
||||
channel: channel,
|
||||
client: PipelinesClient(channelFactory: (_) => channel),
|
||||
provider: provider,
|
||||
);
|
||||
await replyRunList(tester, channel);
|
||||
|
||||
await tapTab(tester, 'Search');
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 600));
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
await tester.enterText(
|
||||
find.byKey(const ValueKey('search.field')),
|
||||
'flaky',
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
await tapTab(tester, 'Search');
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 600));
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
await tester.enterText(find.byKey(const ValueKey('search.field')), 'flaky');
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
|
||||
final runs = await waitForSearch(tester, channel);
|
||||
channel.incoming.add(jsonEncode({'id': runs['id'], ..._results('', [])}));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
final chats = await waitForSearch(tester, channel, chats: true);
|
||||
expect(chats['search'], {'query': 'flaky', 'kind': 'chat', 'limit': 0});
|
||||
channel.incoming.add(
|
||||
jsonEncode({
|
||||
'id': chats['id'],
|
||||
..._results('chat', [
|
||||
{
|
||||
'kind': 'chat',
|
||||
'target': 'chat:$_session',
|
||||
'score': 1,
|
||||
'matched_field': 'message',
|
||||
'chat': {
|
||||
'session_id': _session,
|
||||
'title': 'Fix CI',
|
||||
'directory': '/work/api',
|
||||
'backend': 'claude',
|
||||
'message_id': 'm2',
|
||||
'snippet': 'the flaky retry loop',
|
||||
},
|
||||
},
|
||||
]),
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(find.text('Chats (1)'), findsOneWidget);
|
||||
expect(find.textContaining('the flaky retry loop'), findsOneWidget);
|
||||
|
||||
await tester.tap(
|
||||
find.byKey(const ValueKey('search.result.chat:$_session')),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
|
||||
expect(provider.value.uri.path, '/chat/$_session');
|
||||
expect(find.byType(SearchScreen), findsNothing);
|
||||
final screen = tester.widget<ChatScreen>(find.byType(ChatScreen));
|
||||
expect(screen.initialSessionId, _session);
|
||||
|
||||
await reply(
|
||||
tester,
|
||||
channel,
|
||||
'chat_sessions',
|
||||
body: {
|
||||
'type': 'chat_sessions',
|
||||
'chat_sessions': [
|
||||
{
|
||||
'id': _session,
|
||||
final runs = await waitForSearch(tester, channel);
|
||||
channel.incoming.add(jsonEncode({'id': runs['id'], ..._results('', [])}));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
final chats = await waitForSearch(tester, channel, chats: true);
|
||||
expect(chats['search'], {'query': 'flaky', 'kind': 'chat', 'limit': 0});
|
||||
channel.incoming.add(
|
||||
jsonEncode({
|
||||
'id': chats['id'],
|
||||
..._results('chat', [
|
||||
{
|
||||
'kind': 'chat',
|
||||
'target': 'chat:$_session',
|
||||
'score': 1,
|
||||
'matched_field': 'message',
|
||||
'chat': {
|
||||
'session_id': _session,
|
||||
'title': 'Fix CI',
|
||||
'directory': '/work/api',
|
||||
'backend': 'claude',
|
||||
'message_id': 'm2',
|
||||
'snippet': 'the flaky retry loop',
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
expect(find.text('Fix CI'), findsWidgets);
|
||||
},
|
||||
]),
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(find.text('Chats (1)'), findsOneWidget);
|
||||
expect(find.textContaining('the flaky retry loop'), findsOneWidget);
|
||||
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
});
|
||||
}
|
||||
await tester.tap(
|
||||
find.byKey(const ValueKey('search.result.chat:$_session')),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
|
||||
expect(provider.value.uri.path, '/chat/$_session');
|
||||
expect(find.byType(SearchScreen), findsNothing);
|
||||
final screen = tester.widget<ChatScreen>(find.byType(ChatScreen));
|
||||
expect(screen.initialSessionId, _session);
|
||||
|
||||
await reply(
|
||||
tester,
|
||||
channel,
|
||||
'chat_sessions',
|
||||
body: {
|
||||
'type': 'chat_sessions',
|
||||
'chat_sessions': [
|
||||
{
|
||||
'id': _session,
|
||||
'title': 'Fix CI',
|
||||
'directory': '/work/api',
|
||||
'backend': 'claude',
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
expect(find.text('Fix CI'), findsWidgets);
|
||||
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user