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:
2026-11-11 03:48:41 +00:00
parent baac6eca9a
commit 9bdabb32d9
33 changed files with 1646 additions and 2326 deletions
@@ -2,7 +2,6 @@ import 'dart:math' as math;
import 'dart:ui' show Tristate;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/list_detail.dart';
@@ -18,266 +17,247 @@ import 'package:pipelines_app/ui/theme/app_theme.dart';
import '../features/pipelines/fixtures.dart';
void main() {
for (final cupertino in [false, true]) {
for (final brightness in Brightness.values) {
for (final width in [640.0, 840.0, 1280.0]) {
for (final scale in [1.0, 2.0]) {
testWidgets('shared body-priority panes and selected rows: $cupertino '
'$brightness at $width @${scale}x', (tester) async {
SharedPreferences.setMockInitialValues({});
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
tester.platformDispatcher.textScaleFactorTestValue = scale;
addTearDown(
tester.platformDispatcher.clearTextScaleFactorTestValue,
);
final fixture = PipelineFixture();
final gateway = FakeGateway(
(type, fields) => switch (type) {
'list_pipelines' => pipelineListReply(fixture.summaries),
'get_pipeline' => pipelineDetailReply(
fixture.detailFor(
fields['pipeline_id'] as int,
fields['version'] as int,
)!,
),
'list_runs' => {
'runs': [
for (final id in [1, 2])
{
'id': id,
'title': 'Run item $id',
'status': 'succeeded',
},
],
for (final brightness in Brightness.values) {
for (final width in [640.0, 840.0, 1280.0]) {
for (final scale in [1.0, 2.0]) {
testWidgets('shared body-priority panes and selected rows: '
'$brightness at $width @${scale}x', (tester) async {
SharedPreferences.setMockInitialValues({});
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
tester.platformDispatcher.textScaleFactorTestValue = scale;
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
final fixture = PipelineFixture();
final gateway = FakeGateway(
(type, fields) => switch (type) {
'list_pipelines' => pipelineListReply(fixture.summaries),
'get_pipeline' => pipelineDetailReply(
fixture.detailFor(
fields['pipeline_id'] as int,
fields['version'] as int,
)!,
),
'list_runs' => {
'runs': [
for (final id in [1, 2])
{'id': id, 'title': 'Run item $id', 'status': 'succeeded'},
],
},
'get_run' => {
'run_detail': {
'id': fields['run_id'],
'title': 'Run item ${fields['run_id']}',
'status': 'succeeded',
'input': {'prompt': 'Recorded input'},
},
'get_run' => {
'run_detail': {
'id': fields['run_id'],
'title': 'Run item ${fields['run_id']}',
'status': 'succeeded',
'input': {'prompt': 'Recorded input'},
},
'chat_sessions' => {
'chat_sessions': [
{
'id': 'a',
'title': 'Chat item a',
'backend': 'claude',
'model': 'claude-opus',
'mode': 'auto',
'mode_name': 'Auto',
},
},
'chat_sessions' => {
'chat_sessions': [
{
'id': 'a',
'title': 'Chat item a',
'backend': 'claude',
'model': 'claude-opus',
'mode': 'auto',
'mode_name': 'Auto',
},
{
'id': 'b',
'title': 'Chat item b',
'backend': 'claude',
'model': 'claude-opus',
'mode': 'auto',
'mode_name': 'Auto',
},
],
},
'chat_messages' => {
'chat_history': {'messages': []},
},
_ => {},
{
'id': 'b',
'title': 'Chat item b',
'backend': 'claude',
'model': 'claude-opus',
'mode': 'auto',
'mode_name': 'Auto',
},
],
},
);
final shell = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.pipelines: (_) =>
PipelinesScreen(gateway: gateway, embedded: true),
AppDestination.runs: (_) => RunsScreen(gateway: gateway),
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
'chat_messages' => {
'chat_history': {'messages': []},
},
);
await tester.pumpWidget(
cupertino
? CupertinoApp(
theme: CupertinoThemeData(brightness: brightness),
home: shell,
)
: MaterialApp(
theme: brightness == Brightness.dark
? appDarkTheme()
: appLightTheme(),
home: shell,
),
);
await tester.pumpAndSettle();
final paneWidths = <double>[];
final bodyWidths = <double>[];
for (final destination in ['Pipelines', 'Runs', 'Chat']) {
if (destination != 'Pipelines') {
await tester.tap(
find.byKey(
ValueKey('shell.destination.${destination.toLowerCase()}'),
),
);
await tester.pumpAndSettle();
expect(
tester.takeException(),
isNull,
reason: '$destination list',
);
}
final list = find.byKey(const ValueKey('list-detail-list'));
final detail = find.byKey(const ValueKey('list-detail-body'));
expect(list, findsOneWidget);
expect(detail, findsOneWidget);
final before = tester.getSize(list).width;
final bodyBefore = tester.getSize(detail).width;
paneWidths.add(before);
bodyWidths.add(bodyBefore);
expect(bodyBefore, greaterThanOrEqualTo(width * 0.5));
// 60% of the window, or more once the list reaches its cap.
expect(
bodyBefore,
lessThanOrEqualTo(
math.max(width * 0.6, width - 1 - kListPaneMaxWidth) + 0.5,
_ => {},
},
);
final shell = AdaptiveShell(
destinationBodies: {
AppDestination.pipelines: (_) =>
PipelinesScreen(gateway: gateway, embedded: true),
AppDestination.runs: (_) => RunsScreen(gateway: gateway),
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
},
);
await tester.pumpWidget(
MaterialApp(
theme: brightness == Brightness.dark
? appDarkTheme()
: appLightTheme(),
home: shell,
),
);
await tester.pumpAndSettle();
final paneWidths = <double>[];
final bodyWidths = <double>[];
for (final destination in ['Pipelines', 'Runs', 'Chat']) {
if (destination != 'Pipelines') {
await tester.tap(
find.byKey(
ValueKey('shell.destination.${destination.toLowerCase()}'),
),
);
expect(bodyBefore, greaterThan(before));
final rowKeys = switch (destination) {
'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'],
'Runs' => ['run-row-1', 'run-row-2'],
_ => ['chat-row-a', 'chat-row-b'],
};
for (final key in rowKeys) {
final target = find.byKey(ValueKey(key));
// In a narrow Cupertino list the row center can be a star/menu
// control. Open the chat through its title, not a trailing action.
final opener = destination == 'Chat'
? find.descendant(
of: target,
matching: find.text('Chat item ${key.split('-').last}'),
)
: target;
await tester.ensureVisible(opener);
await tester.tap(opener);
await tester.pumpAndSettle();
expect(
tester.takeException(),
isNull,
reason: '$destination after opening $key',
);
expect(tester.getSize(list).width, closeTo(before, 0.01));
expect(tester.getSize(detail).width, closeTo(bodyBefore, 0.01));
expect(
tester
.state<NavigatorState>(find.byType(Navigator).first)
.canPop(),
isFalse,
);
for (final rowKey in rowKeys) {
final row = find.byKey(ValueKey(rowKey));
expect(
row,
findsOneWidget,
reason: 'the list must remain visible',
);
final selected = rowKey == key;
expect(
tester.getSemantics(row).flagsCollection.isSelected ==
Tristate.isTrue,
selected,
reason: '$destination: $rowKey after opening $key',
);
// Every list retains shared row semantics; features may supply their own fill.
final context = tester.element(row);
expect(tester.widget<AppListRow>(row).selected, selected);
final surface = find.descendant(
of: row,
matching: find.byKey(appListRowSurfaceKey),
);
expect(
cupertino
? tester.widget<ColoredBox>(surface).color
: tester.widget<Material>(surface).color,
selected
? tester.widget<AppListRow>(row).selectedFill ??
AppListRow.selectedColor(
context,
cupertino: cupertino,
)
: const Color(0x00000000),
);
}
}
if (destination == 'Chat') {
// Starring lives in the row's actions menu.
final menu = find.byKey(const Key('chat-actions-b'));
await tester.ensureVisible(menu);
await tester.tap(menu);
await tester.pumpAndSettle();
await tester.tap(find.text('Star'));
await tester.pumpAndSettle();
expect(
gateway
.callsOf('chat_star')
.last
.fields['chat_query']['session_id'],
'b',
);
final actions = find.byKey(const Key('chat-actions-b'));
await tester.ensureVisible(actions);
await tester.tap(actions);
await tester.pumpAndSettle();
expect(find.text('Rename…'), findsOneWidget);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
}
// A phone still uses stock page navigation; returning to a wide
// window must keep the selected item without clearing its route.
tester.view.physicalSize = const Size(390, 900);
await tester.pumpAndSettle();
expect(
tester
.state<NavigatorState>(find.byType(Navigator).first)
.canPop(),
isTrue,
reason: '$destination should push its selected item on a phone',
tester.takeException(),
isNull,
reason: '$destination list',
);
expect(
find.byKey(const ValueKey('list-detail-list')),
findsNothing,
);
tester.view.physicalSize = Size(width, 900);
}
final list = find.byKey(const ValueKey('list-detail-list'));
final detail = find.byKey(const ValueKey('list-detail-body'));
expect(list, findsOneWidget);
expect(detail, findsOneWidget);
final before = tester.getSize(list).width;
final bodyBefore = tester.getSize(detail).width;
paneWidths.add(before);
bodyWidths.add(bodyBefore);
expect(bodyBefore, greaterThanOrEqualTo(width * 0.5));
// 60% of the window, or more once the list reaches its cap.
expect(
bodyBefore,
lessThanOrEqualTo(
math.max(width * 0.6, width - 1 - kListPaneMaxWidth) + 0.5,
),
);
expect(bodyBefore, greaterThan(before));
final rowKeys = switch (destination) {
'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'],
'Runs' => ['run-row-1', 'run-row-2'],
_ => ['chat-row-a', 'chat-row-b'],
};
for (final key in rowKeys) {
final target = find.byKey(ValueKey(key));
// The row center can be a star/menu control. Open the chat
// through its title, not a trailing action.
final opener = destination == 'Chat'
? find.descendant(
of: target,
matching: find.text('Chat item ${key.split('-').last}'),
)
: target;
await tester.ensureVisible(opener);
await tester.tap(opener);
await tester.pumpAndSettle();
expect(
tester.takeException(),
isNull,
reason: '$destination after opening $key',
);
expect(tester.getSize(list).width, closeTo(before, 0.01));
expect(tester.getSize(detail).width, closeTo(bodyBefore, 0.01));
expect(
tester
.state<NavigatorState>(find.byType(Navigator).first)
.canPop(),
isFalse,
);
expect(tester.getSize(list).width, closeTo(before, 0.01));
expect(
tester
.getSemantics(find.byKey(ValueKey(rowKeys.last)))
.flagsCollection
.isSelected,
Tristate.isTrue,
);
for (final rowKey in rowKeys) {
final row = find.byKey(ValueKey(rowKey));
expect(
row,
findsOneWidget,
reason: 'the list must remain visible',
);
final selected = rowKey == key;
expect(
tester.getSemantics(row).flagsCollection.isSelected ==
Tristate.isTrue,
selected,
reason: '$destination: $rowKey after opening $key',
);
// Every list retains shared row semantics; features may supply their own fill.
final context = tester.element(row);
expect(tester.widget<AppListRow>(row).selected, selected);
final surface = find.descendant(
of: row,
matching: find.byKey(appListRowSurfaceKey),
);
expect(
tester.widget<Material>(surface).color,
selected
? tester.widget<AppListRow>(row).selectedFill ??
AppListRow.selectedColor(context, cupertino: false)
: const Color(0x00000000),
);
}
}
if (destination == 'Chat') {
// Starring lives in the row's actions menu.
final menu = find.byKey(const Key('chat-actions-b'));
await tester.ensureVisible(menu);
await tester.tap(menu);
await tester.pumpAndSettle();
await tester.tap(find.text('Star'));
await tester.pumpAndSettle();
expect(
gateway
.callsOf('chat_star')
.last
.fields['chat_query']['session_id'],
'b',
);
final actions = find.byKey(const Key('chat-actions-b'));
await tester.ensureVisible(actions);
await tester.tap(actions);
await tester.pumpAndSettle();
expect(find.text('Rename…'), findsOneWidget);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
}
// A phone still uses stock page navigation; returning to a wide
// window must keep the selected item without clearing its route.
tester.view.physicalSize = const Size(390, 900);
await tester.pumpAndSettle();
expect(
paneWidths,
everyElement(closeTo(paneWidths.first, 0.01)),
reason: 'Pipelines, Runs and Chat must use identical pane widths',
tester
.state<NavigatorState>(find.byType(Navigator).first)
.canPop(),
isTrue,
reason: '$destination should push its selected item on a phone',
);
expect(tester.takeException(), isNull);
expect(
bodyWidths,
everyElement(closeTo(bodyWidths.first, 0.01)),
reason:
'Every destination must share the body-priority sizing policy',
find.byKey(const ValueKey('list-detail-list')),
findsNothing,
);
await tester.pumpWidget(const SizedBox.shrink());
});
}
tester.view.physicalSize = Size(width, 900);
await tester.pumpAndSettle();
expect(
tester
.state<NavigatorState>(find.byType(Navigator).first)
.canPop(),
isFalse,
);
expect(tester.getSize(list).width, closeTo(before, 0.01));
expect(
tester
.getSemantics(find.byKey(ValueKey(rowKeys.last)))
.flagsCollection
.isSelected,
Tristate.isTrue,
);
}
expect(
paneWidths,
everyElement(closeTo(paneWidths.first, 0.01)),
reason: 'Pipelines, Runs and Chat must use identical pane widths',
);
expect(tester.takeException(), isNull);
expect(
bodyWidths,
everyElement(closeTo(bodyWidths.first, 0.01)),
reason:
'Every destination must share the body-priority sizing policy',
);
await tester.pumpWidget(const SizedBox.shrink());
});
}
}
}
@@ -26,9 +26,8 @@ import 'search_wiring_test.dart'
void main() {
Future<PlatformRouteInformationProvider> openPhoneApp(
WidgetTester tester,
FakeChannel channel, {
required bool cupertino,
}) async {
FakeChannel channel,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
@@ -42,77 +41,65 @@ void main() {
channel: channel,
client: PipelinesClient(channelFactory: (_) => channel),
provider: provider,
cupertino: cupertino,
);
await replyRunList(tester, channel);
return provider;
}
for (final cupertino in [false, true]) {
final platform = cupertino ? 'Cupertino' : 'Material';
testWidgets('phone: an artifact hit opens that artifact in the '
'viewer, and Back shows it on the run Artifacts tab', (tester) async {
final channel = FakeChannel()..readyCompleter.complete();
final provider = await openPhoneApp(tester, channel);
testWidgets('$platform phone: an artifact hit opens that artifact in the '
'viewer, and Back shows it on the run Artifacts tab', (tester) async {
final channel = FakeChannel()..readyCompleter.complete();
final provider = await openPhoneApp(
tester,
channel,
cupertino: cupertino,
);
await openArtifactHit(tester, channel);
expect(provider.value.uri.path, '/runs/7');
await replyRunDetailFor(tester, channel, searchSelectionDetail());
await tester.pumpAndSettle();
await openArtifactHit(tester, channel);
expect(provider.value.uri.path, '/runs/7');
await replyRunDetailFor(tester, channel, searchSelectionDetail());
await tester.pumpAndSettle();
expect(find.byType(SearchScreen), findsNothing);
final viewer = tester.widget<ArtifactViewerPage>(
find.byType(ArtifactViewerPage),
);
expect(viewer.selectedIdentity, contains('report.txt'));
expect(find.text('report.txt'), findsWidgets);
expect(find.byType(SearchScreen), findsNothing);
final viewer = tester.widget<ArtifactViewerPage>(
find.byType(ArtifactViewerPage),
);
expect(viewer.selectedIdentity, contains('report.txt'));
expect(find.text('report.txt'), findsWidgets);
await closeViewer(tester);
expectArtifactsTabSelecting(tester, '/artifacts/7/2/report.txt');
await closeViewer(tester);
expectArtifactsTabSelecting(tester, '/artifacts/7/2/report.txt');
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
});
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
});
testWidgets('phone: an artifact the run no longer lists opens '
'its Artifacts tab with a notice', (tester) async {
final channel = FakeChannel()..readyCompleter.complete();
await openPhoneApp(tester, channel);
testWidgets('$platform phone: an artifact the run no longer lists opens '
'its Artifacts tab with a notice', (tester) async {
final channel = FakeChannel()..readyCompleter.complete();
await openPhoneApp(tester, channel, cupertino: cupertino);
await openArtifactHit(tester, channel);
final detail = searchSelectionDetail();
final steps = [
for (final step in detail['steps'] as List)
Map<String, dynamic>.from(step as Map),
];
steps[1]['artifacts'] = <JsonMap>[
{
'name': 'other.txt',
'content_type': 'text/plain',
'size_bytes': 3,
'url': '/artifacts/7/2/other.txt',
},
];
await replyRunDetailFor(tester, channel, {...detail, 'steps': steps});
await tester.pumpAndSettle();
await openArtifactHit(tester, channel);
final detail = searchSelectionDetail();
final steps = [
for (final step in detail['steps'] as List)
Map<String, dynamic>.from(step as Map),
];
steps[1]['artifacts'] = <JsonMap>[
{
'name': 'other.txt',
'content_type': 'text/plain',
'size_bytes': 3,
'url': '/artifacts/7/2/other.txt',
},
];
await replyRunDetailFor(tester, channel, {...detail, 'steps': steps});
await tester.pumpAndSettle();
expect(find.byType(ArtifactViewerPage), findsNothing);
expect(
find.byKey(const ValueKey('run-detail-artifacts-7')),
findsOneWidget,
);
expect(find.text('That artifact is no longer available.'), findsOneWidget);
expect(find.byType(ArtifactViewerPage), findsNothing);
expect(
find.byKey(const ValueKey('run-detail-artifacts-7')),
findsOneWidget,
);
expect(
find.text('That artifact is no longer available.'),
findsOneWidget,
);
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
});
}
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
});
}
+84 -91
View File
@@ -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();
});
}
+5 -99
View File
@@ -332,14 +332,12 @@ Future<void> pumpApp(
required FakeChannel channel,
required PipelinesClient client,
required PlatformRouteInformationProvider provider,
required bool cupertino,
}) async {
await tester.pumpWidget(
PipelinesApp(
androidSupported: false,
server: webServer(),
client: client,
cupertino: cupertino,
routeInformationProvider: provider,
),
);
@@ -373,7 +371,6 @@ void main() {
channel: channel,
client: client,
provider: provider,
cupertino: false,
);
await replyRunList(tester, channel);
await replyRunDetail(tester, channel, 2);
@@ -439,13 +436,7 @@ void main() {
);
addTearDown(provider.dispose);
await pumpApp(
tester,
channel: channel,
client: client,
provider: provider,
cupertino: false,
);
await pumpApp(tester, channel: channel, client: client, provider: provider);
await replyRunList(tester, channel);
await replyRunDetail(tester, channel, 2);
@@ -519,13 +510,7 @@ void main() {
);
addTearDown(provider.dispose);
await pumpApp(
tester,
channel: channel,
client: client,
provider: provider,
cupertino: false,
);
await pumpApp(tester, channel: channel, client: client, provider: provider);
await replyRunList(tester, channel);
await replyRunDetailFor(tester, channel, searchSelectionDetail());
expect(find.text('Run 7'), findsWidgets);
@@ -631,13 +616,7 @@ void main() {
);
addTearDown(provider.dispose);
await pumpApp(
tester,
channel: channel,
client: client,
provider: provider,
cupertino: false,
);
await pumpApp(tester, channel: channel, client: client, provider: provider);
await replyRunList(tester, channel);
await tapTab(tester, 'Search');
@@ -706,13 +685,7 @@ void main() {
);
addTearDown(provider.dispose);
await pumpApp(
tester,
channel: channel,
client: client,
provider: provider,
cupertino: false,
);
await pumpApp(tester, channel: channel, client: client, provider: provider);
await replyRun7List(tester, channel);
// The hit navigates to run 7, but its detail is never loaded: the operator
@@ -763,13 +736,7 @@ void main() {
);
addTearDown(provider.dispose);
await pumpApp(
tester,
channel: channel,
client: client,
provider: provider,
cupertino: false,
);
await pumpApp(tester, channel: channel, client: client, provider: provider);
await replyRun7List(tester, channel);
await openArtifactHit(tester, channel);
@@ -801,67 +768,6 @@ void main() {
await tester.pump();
});
testWidgets('Cupertino Search is a native tab', (tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark;
addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue);
final channel = FakeChannel()..readyCompleter.complete();
var sockets = 0;
final client = PipelinesClient(
channelFactory: (_) {
sockets++;
return channel;
},
);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')),
);
addTearDown(provider.dispose);
await pumpApp(
tester,
channel: channel,
client: client,
provider: provider,
cupertino: true,
);
await replyRunList(tester, channel);
expect(find.text('Preserved run'), findsWidgets);
await tapTab(tester, 'Search');
await tester.pump();
await tester.pump(const Duration(milliseconds: 600));
await tester.pump(const Duration(milliseconds: 100));
expect(provider.value.uri.path, '/search');
expect(find.byKey(const ValueKey('search.field')), findsOneWidget);
expect(find.byType(Material), findsNothing);
final cupertinoField = tester.widget<EditableText>(
find.descendant(
of: find.byKey(const ValueKey('search.field')),
matching: find.byType(EditableText),
),
);
expect(cupertinoField.focusNode.hasFocus, isTrue);
await tapTab(tester, 'Runs');
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
await tester.pump(const Duration(milliseconds: 400));
expect(provider.value.uri.path, '/runs');
expect(find.byKey(const ValueKey('search.field')), findsNothing);
expect(find.text('Preserved run'), findsWidgets);
expect(sockets, 1);
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
});
test(
'the hit helper never guesses a route for pipeline or malformed hits',
() {