Show running and failed run counts independently

Give the Runs tab separate activity and failure indicators so neither suppresses the other. Reuse known summaries and pushed updates, keep failed states separate from decisions and dismissal counts, and update across tabs even when total attention is unchanged.
This commit is contained in:
2026-11-11 22:10:37 +00:00
parent 9551eceaed
commit efca56e4e4
13 changed files with 415 additions and 99 deletions
+3 -3
View File
@@ -7,8 +7,8 @@ import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
/// bar at full width on a phone and right-aligned on a wide window. Zero draws
/// the bare icon with no count and no attention semantics.
void main() {
final needingAttention = RegExp('Notifications, 3 needing attention');
final anyAttention = RegExp('needing attention');
final needingAttention = RegExp('3 failed runs');
final anyAttention = RegExp('failed runs');
Future<void> pumpShell(
WidgetTester tester, {
@@ -19,7 +19,7 @@ void main() {
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final shell = AdaptiveShell(attentionCount: count);
final shell = AdaptiveShell(failedRunCount: count);
await tester.pumpWidget(MaterialApp(home: shell));
}
+5 -4
View File
@@ -66,9 +66,10 @@ void main() {
),
);
Widget shell({int attention = 0}) {
Widget shell({int attention = 0, int failed = 0}) {
final app = AdaptiveShell(
attentionCount: attention,
failedRunCount: failed,
destinationBodies: {
AppDestination.runs: (_) => ShellBadge(
kind: ShellBadgeKind.running,
@@ -218,15 +219,15 @@ void main() {
);
});
testWidgets('the Runs tab shows one indicator: attention outranks running', (
testWidgets('the Runs tab shows running and failed indicators together', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(attention: 2));
await tester.pumpWidget(shell(attention: 2, failed: 2));
await tester.pump();
await tester.pump();
expect(find.text('2'), findsOneWidget);
expect(find.text('4'), findsNothing);
expect(find.text('4'), findsOneWidget);
await tester.pumpWidget(shell());
await tester.pump();
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
void main() {
for (final width in [390.0, 1000.0]) {
for (final brightness in Brightness.values) {
testWidgets('running and failed are distinct at $width $brightness', (
tester,
) async {
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final semantics = tester.ensureSemantics();
final theme = ThemeData(brightness: brightness);
await tester.pumpWidget(
MaterialApp(
theme: theme,
home: const AdaptiveShell(runningRunCount: 2, failedRunCount: 3),
),
);
await tester.pumpAndSettle();
final failed = find.byKey(const ValueKey('shell.badge.runs.failed'));
final running = find.byKey(const ValueKey('shell.badge.runs.running'));
expect(
find.descendant(of: failed, matching: find.text('3')),
findsOneWidget,
);
expect(
find.descendant(of: running, matching: find.text('2')),
findsOneWidget,
);
expect(
tester.widget<Badge>(failed).backgroundColor,
theme.colorScheme.error,
);
expect(
tester.getRect(find.text('3')).bottom,
lessThan(tester.getRect(find.text('2')).top),
);
expect(
find.bySemanticsLabel(RegExp('2 runs in progress, 3 failed runs')),
findsOneWidget,
);
expect(tester.takeException(), isNull);
semantics.dispose();
});
}
}
}