Unify flexible list-detail panes and highlight active pipelines and runs

This commit is contained in:
2026-10-25 21:04:12 +00:00
parent 6501d3e12e
commit 7e9ba9ac25
23 changed files with 579 additions and 146 deletions
@@ -0,0 +1,234 @@
import 'dart:ui' show Tristate;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:pipelines_app/features/chat/screen.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/features/runs/screen.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
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]) {
testWidgets('shared equal panes and selected rows: $cupertino '
'$brightness at $width', (tester) async {
SharedPreferences.setMockInitialValues({});
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
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'},
},
},
'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': []},
},
_ => {},
},
);
final shell = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.pipelines: (_) =>
PipelinesScreen(gateway: gateway, embedded: true),
AppDestination.runs: (_) => RunsScreen(gateway: gateway),
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
},
);
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>[];
for (final destination in ['Pipelines', 'Runs', 'Chat']) {
if (destination != 'Pipelines') {
await tester.tap(find.text(destination).first);
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;
paneWidths.add(before);
expect(before, closeTo(tester.getSize(detail).width, 0.01));
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.
await tester.tap(
destination == 'Chat'
? find.descendant(
of: target,
matching: find.text('Chat item ${key.split('-').last}'),
)
: target,
);
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(before, 0.01));
expect(
tester.state<NavigatorState>(find.byType(Navigator)).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',
);
final context = tester.element(row);
if (cupertino) {
final color = destination == 'Runs'
? tester.widget<CupertinoButton>(row).color
: tester.widget<CupertinoListTile>(row).backgroundColor;
expect(
color,
selected
? CupertinoColors.tertiarySystemFill.resolveFrom(
context,
)
: isNull,
);
} else if (destination == 'Runs') {
final id = rowKey.split('-').last;
expect(
tester
.widget<Material>(
find.byKey(ValueKey('run-row-surface-$id')),
)
.color,
selected
? Theme.of(context).colorScheme.secondaryContainer
: Colors.transparent,
);
} else {
final tile = tester.widget<ListTile>(row);
expect(tile.selected, selected);
expect(
tile.selectedTileColor,
Theme.of(context).colorScheme.secondaryContainer,
);
}
}
}
// 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)).canPop(),
isTrue,
reason: '$destination should push its selected item on a phone',
);
expect(
find.byKey(const ValueKey('list-detail-list')),
findsNothing,
);
tester.view.physicalSize = Size(width, 900);
await tester.pumpAndSettle();
expect(
tester.state<NavigatorState>(find.byType(Navigator)).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);
await tester.pumpWidget(const SizedBox.shrink());
});
}
}
}
}
+9 -3
View File
@@ -143,6 +143,9 @@ void main() {
testWidgets('a /runs/1 boot link opens that run and Back returns to /runs', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(channelFactory: (_) => channel);
final provider = PlatformRouteInformationProvider(
@@ -159,6 +162,7 @@ void main() {
],
);
await replyDetail(tester, channel, 1);
await tester.pumpAndSettle();
expect(find.text('Run 1'), findsWidgets);
expect(findNativeBack(), findsOneWidget);
@@ -166,7 +170,7 @@ void main() {
expect(find.text('Pipelines — Not implemented'), findsNothing);
await tester.tap(findNativeBack());
await tester.pump();
await tester.pumpAndSettle();
expect(provider.value.uri.path, '/runs');
expect(find.text('Deep-linked run'), findsWidgets);
});
@@ -259,7 +263,8 @@ void main() {
await tester.pump();
expect(provider.value.uri.path, '/runs/2');
await replyDetail(tester, channel, 2);
expect(findNativeBack(), findsOneWidget);
expect(findNativeBack(), findsNothing);
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
// The engine's browser Back arrives as new route information.
await provider.didPushRouteInformation(
@@ -278,7 +283,8 @@ void main() {
await tester.pump();
await replyDetail(tester, channel, 2);
await tester.pump();
expect(findNativeBack(), findsOneWidget);
expect(findNativeBack(), findsNothing);
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
});
testWidgets('a malformed boot path is corrected to /pipelines', (
@@ -10,6 +10,7 @@ import 'package:pipelines_app/core/transport/pipelines_client.dart';
import 'package:pipelines_app/features/runs/screen.dart';
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
import '../features/runs/ui/run_detail_finders.dart';
ServerEndpoint webServer() => ServerEndpoint.resolve(
base: Uri.parse('http://127.0.0.1:8096/'),
@@ -228,13 +229,13 @@ void main() {
}),
);
await tester.pump();
expect(find.text('Open run'), findsOneWidget);
expect(find.text('Back to list'), findsOneWidget);
expect(runDetailText('Open run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
first.incoming.addError(StateError('network drop'));
await tester.pump();
expect(find.byType(RunsScreen), findsOneWidget);
expect(find.text('Open run'), findsOneWidget);
expect(runDetailText('Open run'), findsOneWidget);
expect(find.text('Reconnecting to Pipelines…'), findsOneWidget);
for (
@@ -262,7 +263,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 10));
}
final refreshed = detailRequests(second, 1).single;
expect(find.text('Open run'), findsOneWidget);
expect(runDetailText('Open run'), findsOneWidget);
second.incoming.add(
jsonEncode({
'id': refreshed['id'],
@@ -271,8 +272,8 @@ void main() {
}),
);
await tester.pump();
expect(find.text('Open run'), findsOneWidget);
expect(find.text('Back to list'), findsOneWidget);
expect(runDetailText('Open run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
},
);
+9 -5
View File
@@ -324,7 +324,8 @@ void main() {
expect(provider.value.uri.path, '/runs/2');
expect(find.byType(SearchScreen), findsNothing);
expect(findNativeBack(), findsOneWidget);
expect(findNativeBack(), findsNothing);
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
expect(find.text('Run 2'), findsWidgets);
// The shell was never remounted, so the open run was not re-read.
expect(requestsOf(channel, 'get_run'), hasLength(1));
@@ -409,7 +410,8 @@ void main() {
expect(provider.value.uri.path, '/runs/7');
await replyRunDetail(tester, channel, 7, index: 1);
expect(find.byType(SearchScreen), findsNothing);
expect(findNativeBack(), findsOneWidget);
expect(findNativeBack(), findsNothing);
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
expect(find.text('Run 7'), findsWidgets);
// One app socket carried the search and the run reads.
expect(sockets, 1);
@@ -651,8 +653,8 @@ void main() {
// leaves from the loading placeholder instead.
await openArtifactHit(tester, channel);
expect(provider.value.uri.path, '/runs/7');
expect(findNativeBack(), findsOneWidget);
await tester.tap(findNativeBack());
expect(find.byKey(const ValueKey('run-detail-pane')), findsOneWidget);
await tester.tap(find.text('Back to list'));
await tester.pump();
await tester.pump();
expect(provider.value.uri.path, '/runs');
@@ -711,7 +713,9 @@ void main() {
await tester.tap(find.byKey(const Key('run-visit-back')));
await tester.pumpAndSettle();
await tester.tap(findNativeBack());
await provider.didPushRouteInformation(
RouteInformation(uri: Uri.parse('/runs')),
);
await tester.pump();
await tester.pump();
expect(provider.value.uri.path, '/runs');
@@ -115,8 +115,8 @@ void main() {
await tester.pump();
await tester.pumpAndSettle();
await tester.tap(find.text(native ? 'Back' : 'Back to list'));
await tester.pump();
// The wide list and its bell stay available beside the open detail.
expect(find.byKey(const ValueKey('run-row-2')), findsOneWidget);
await openAttentionSheet(tester);
await tester.tap(find.byKey(attentionRowKey('2:Failed')));
await tester.pump();
@@ -79,8 +79,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.byKey(cancelActionKey), findsNothing);
expect(find.text('canceled'), findsOneWidget);
await tester.tap(find.text(cupertino ? 'Back' : 'Back to list'));
await tester.pumpAndSettle();
// The held list is already visible beside the detail.
expect(
find.byWidgetPredicate(
(widget) => widget is RunStatusIcon && widget.label == 'canceled',
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/runs/actions/decision_wording.dart';
import 'package:pipelines_app/features/runs/screen.dart';
@@ -120,7 +121,7 @@ void main() {
await tester.tap(find.text(decisionCancelLabel));
await tester.pumpAndSettle();
expect(find.byKey(decisionFeedbackKey), findsNothing);
expect(find.text('Human checkpoint'), findsOneWidget);
expect(runDetailText('Human checkpoint'), findsOneWidget);
expect(find.byKey(decisionActionKey), findsOneWidget);
});
}
@@ -134,7 +135,7 @@ void main() {
expect(find.byKey(decisionFeedbackKey), findsNothing);
expect(find.byKey(decisionActionKey), findsNothing);
expect(find.text('Human checkpoint'), findsOneWidget);
expect(runDetailText('Human checkpoint'), findsOneWidget);
});
testWidgets('a route without decide keeps the plain waiting detail', (
@@ -145,7 +146,7 @@ void main() {
await _pump(tester, gateway, decide: false);
expect(find.byKey(decisionFeedbackKey), findsNothing);
expect(find.text('Human checkpoint'), findsOneWidget);
expect(runDetailText('Human checkpoint'), findsOneWidget);
expect(find.byKey(decisionActionKey), findsOneWidget);
// The landed button still opens the same prompt deliberately.
@@ -79,7 +79,7 @@ void main() {
);
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
expect(banner.left, tabs.left);
expect(banner.width, greaterThan(tabs.width));
expect(banner.width, greaterThanOrEqualTo(tabs.width));
expect(
tester.getCenter(find.byKey(decisionActionKey)).dx,
greaterThan(banner.center.dx),
@@ -0,0 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
/// Wide screens deliberately repeat the selected title in the visible list.
Finder runDetailText(String text) =>
find.descendant(of: find.byType(RunDetailView), matching: find.text(text));
@@ -5,6 +5,7 @@ import 'package:pipelines_app/core/transport/connection_state.dart';
import 'package:pipelines_app/features/runs/actions/retry_wording.dart';
import 'run_retry_wiring_support.dart';
import 'run_detail_finders.dart';
void main() {
testWidgets('a reply without an id never opens a guessed run', (
@@ -27,7 +28,7 @@ void main() {
await tester.pumpAndSettle();
expect(opened, isEmpty);
expect(find.text(retryFailedTitle), findsOneWidget);
expect(runDetailText(retryFailedTitle), findsOneWidget);
expect(find.text('Unknown run'), findsNothing);
expect(gateway.calls.where((call) => call.type == 'get_run'), hasLength(1));
});
@@ -49,7 +50,7 @@ void main() {
expect(find.text('the run is still executing'), findsOneWidget);
expect(opened, isEmpty);
expect(find.text(retryFailedTitle), findsOneWidget);
expect(runDetailText(retryFailedTitle), findsOneWidget);
await tester.tap(find.byKey(retryKeepKey));
await tester.pumpAndSettle();
expect(await retryOffered(tester), isTrue);
@@ -97,7 +98,7 @@ void main() {
// The accepted detail still folds, but its id is the source run, so there
// is no new run to open and no second read.
expect(opened, isEmpty);
expect(find.text(retryCreatedTitle), findsOneWidget);
expect(runDetailText(retryCreatedTitle), findsOneWidget);
expect(gateway.calls.where((call) => call.type == 'get_run'), hasLength(1));
});
@@ -4,6 +4,7 @@ import 'package:pipelines_app/features/runs/actions/cancel_wording.dart';
import 'package:pipelines_app/features/runs/actions/retry_wording.dart';
import 'run_retry_wiring_support.dart';
import 'run_detail_finders.dart';
void main() {
for (final cupertino in [false, true]) {
@@ -20,7 +21,7 @@ void main() {
onRunSelected: opened.add,
);
expect(find.text(retryFailedTitle), findsOneWidget);
expect(runDetailText(retryFailedTitle), findsOneWidget);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
expect(await retryOffered(tester), isTrue);
expect(find.byKey(cancelActionKey), findsNothing);
@@ -49,14 +50,14 @@ void main() {
);
// The prompt closes only from server truth; no navigation is guessed.
expect(opened, isEmpty);
expect(find.text(retryFailedTitle), findsOneWidget);
expect(runDetailText(retryFailedTitle), findsOneWidget);
gateway.acceptRetry(retryCreatedDetail());
await tester.pumpAndSettle();
expect(opened, [8]);
expect(find.text(retryCreatedTitle), findsOneWidget);
expect(find.text(retryFailedTitle), findsNothing);
expect(runDetailText(retryCreatedTitle), findsOneWidget);
expect(runDetailText(retryFailedTitle), findsNothing);
expect(await retryOffered(tester), isFalse);
expect(
gateway.calls.where((call) => call.type == 'get_run').last.fields,
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/core/transport/connection_state.dart';
@@ -100,7 +101,7 @@ void main() {
'only the server reply into the detail and list', (tester) async {
final gateway = await _mount(tester, cupertino: false);
expect(find.text('Nightly build'), findsOneWidget);
expect(runDetailText('Nightly build'), findsOneWidget);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
expect(gateway.saves, isEmpty);
@@ -114,7 +115,7 @@ void main() {
await tester.tap(find.byKey(runTitleCancelKey));
await tester.pumpAndSettle();
expect(gateway.saves, isEmpty);
expect(find.text('Nightly build'), findsOneWidget);
expect(runDetailText('Nightly build'), findsOneWidget);
await _openRename(tester);
await tester.enterText(find.byKey(runTitleFieldKey), ' Release build ');
@@ -126,18 +127,23 @@ void main() {
'title': ' Release build ',
});
// Still the stored title: nothing is applied before the server replies.
expect(find.text('Nightly build'), findsOneWidget);
expect(runDetailText('Nightly build'), findsOneWidget);
expect(find.text('Release build'), findsNothing);
gateway.accept('Release build');
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsNothing);
expect(find.text('Release build'), findsOneWidget);
expect(runDetailText('Release build'), findsOneWidget);
expect(find.text('Nightly build'), findsNothing);
await tester.tap(find.text('Back to list'));
await tester.pump();
expect(find.text('Release build'), findsOneWidget);
// The list stays visible, and its row follows the accepted rename too.
expect(
find.descendant(
of: find.byKey(const ValueKey('run-row-1')),
matching: find.text('Release build'),
),
findsOneWidget,
);
});
testWidgets('cupertino detail shows the native rename entry point', (
@@ -162,7 +168,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.byType(CupertinoAlertDialog), findsNothing);
expect(find.text('Release build'), findsOneWidget);
expect(runDetailText('Release build'), findsOneWidget);
});
testWidgets('a refused rename keeps the typed title and the stored detail', (
@@ -180,6 +186,6 @@ void main() {
expect(find.text('rename refused by the server'), findsOneWidget);
expect(_fieldText(tester, cupertino: false), ' locked ');
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('Nightly build'), findsOneWidget);
expect(runDetailText('Nightly build'), findsOneWidget);
});
}
+37 -19
View File
@@ -6,6 +6,8 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../native_back.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/runs/screen.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
import 'run_detail_finders.dart';
class _Gateway implements ApiGateway {
final framesController = StreamController<JsonMap>.broadcast();
@@ -88,7 +90,11 @@ void main() {
expect(gateway.detailRequests[1], hasLength(1));
expect(find.text('Loading run details…'), findsOneWidget);
expect(find.text('Back to list'), findsOneWidget);
expect(find.text('Alpha run'), findsNothing);
expect(
find.text('Alpha run'),
findsOneWidget,
reason: 'the list stays visible',
);
await tester.tap(find.text('Back to list'));
await tester.pump();
@@ -113,7 +119,7 @@ void main() {
});
await tester.pump();
expect(find.text('Alpha run'), findsOneWidget);
expect(runDetailText('Alpha run'), findsOneWidget);
expect(find.text('Input'), findsOneWidget);
expect(find.text('Loading run details…'), findsNothing);
});
@@ -126,7 +132,13 @@ void main() {
gateway.failDetail(2, 0, StateError('server unavailable'));
await tester.pump();
expect(find.textContaining('server unavailable'), findsOneWidget);
expect(
find.descendant(
of: find.byType(RunDetailView),
matching: find.textContaining('server unavailable'),
),
findsOneWidget,
);
expect(find.text('Back to list'), findsOneWidget);
await tester.tap(find.text('Back to list'));
@@ -146,13 +158,16 @@ void main() {
expect(gateway.detailRequests[2], hasLength(1));
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
expect(find.text('Beta run'), findsOneWidget);
expect(find.text('Back to list'), findsOneWidget);
expect(runDetailText('Beta run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
});
testWidgets('selection and Back report route changes to the host', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
int? selected;
int? backedPipeline;
await tester.pumpWidget(
@@ -168,10 +183,10 @@ void main() {
await tester.pump();
expect(selected, 2);
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
await tester.pumpAndSettle();
await tester.tap(find.text('Back to list'));
await tester.pump();
await tester.tap(findNativeBack());
await tester.pumpAndSettle();
expect(backedPipeline, isNull);
expect(find.text('Alpha run'), findsOneWidget);
});
@@ -201,6 +216,9 @@ void main() {
testWidgets('run detail keeps the pipeline filter for Back routing', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
int? backPipeline;
await tester.pumpWidget(
_materialScreen(
@@ -219,10 +237,10 @@ void main() {
);
await tester.pump();
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
await tester.pumpAndSettle();
await tester.tap(find.text('Back to list'));
await tester.pump();
await tester.tap(findNativeBack());
await tester.pumpAndSettle();
expect(backPipeline, 3);
});
@@ -232,14 +250,14 @@ void main() {
expect(gateway.detailRequests[2], hasLength(1));
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
expect(find.text('Beta run'), findsOneWidget);
expect(runDetailText('Beta run'), findsOneWidget);
await tester.pumpWidget(_materialScreen(gateway, initialRunId: 1));
await tester.pump();
expect(gateway.detailRequests[1], hasLength(1));
gateway.replyDetail(1, 0, {'id': 1, 'title': 'Alpha run'});
await tester.pump();
expect(find.text('Alpha run'), findsOneWidget);
expect(runDetailText('Alpha run'), findsOneWidget);
await tester.pumpWidget(_materialScreen(gateway));
await tester.pump();
@@ -255,7 +273,7 @@ void main() {
await _mountList(tester, gateway);
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
expect(find.text('Beta run'), findsOneWidget);
expect(runDetailText('Beta run'), findsOneWidget);
await tester.pumpWidget(
_materialScreen(gateway, initialRunId: 2, syncToken: 1),
@@ -272,12 +290,12 @@ void main() {
'status': 'succeeded',
});
await tester.pump();
expect(find.text('Beta run'), findsOneWidget);
expect(find.text('Back to list'), findsOneWidget);
expect(runDetailText('Beta run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
});
testWidgets(
'Cupertino host keeps exactly one navigation bar while pending',
'wide Cupertino host keeps list and detail bars while pending',
(tester) async {
await tester.pumpWidget(
CupertinoApp(
@@ -291,8 +309,8 @@ void main() {
);
await _mountList(tester, gateway);
expect(find.byType(CupertinoPageScaffold), findsOneWidget);
expect(find.byType(CupertinoNavigationBar), findsOneWidget);
expect(find.byType(CupertinoPageScaffold), findsNWidgets(2));
expect(find.byType(CupertinoNavigationBar), findsNWidgets(2));
expect(find.text('Loading run details…'), findsOneWidget);
expect(find.byType(CupertinoActivityIndicator), findsOneWidget);
expect(find.text('Back to list'), findsOneWidget);