Files
pipelines/app/test/shell/attention_badge_test.dart
alan fa95c2fcae Remove the Runs error counter for now
Keep the running indicator and Needs you flow, but remove the failed-count badge and its tab count plumbing until unseen-state behavior is addressed. Preserve the unfinished seen-state work separately. Verify application, Runs, attention and shell regressions.
2026-11-11 23:18:30 +00:00

83 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
/// The Runs tab keeps running work visible without an error counter.
void main() {
final needingAttention = RegExp('3 runs in progress');
final anyAttention = RegExp('runs in progress');
Future<void> pumpShell(
WidgetTester tester, {
required double width,
required int count,
}) async {
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final shell = AdaptiveShell(runningRunCount: count, attentionCount: 99);
await tester.pumpWidget(MaterialApp(home: shell));
}
for (final width in [390.0, 1000.0]) {
final mount = width < 600 ? 'bottom bar' : 'wide bar';
testWidgets('$mount shows the count on the Runs tab', (tester) async {
final semantics = tester.ensureSemantics();
await pumpShell(tester, width: width, count: 3);
expect(find.byType(FloatingDestinationBar), findsOneWidget);
expect(find.byType(NavigationRail), findsNothing);
final badge = find.byKey(const ValueKey('shell.badge.runs.running'));
expect(badge, findsOneWidget);
expect(
find.byKey(const ValueKey('shell.badge.runs.failed')),
findsNothing,
);
expect(
find.descendant(of: badge, matching: find.text('3')),
findsOneWidget,
);
expect(find.bySemanticsLabel(needingAttention), findsOneWidget);
semantics.dispose();
});
testWidgets('$mount hides the badge at zero', (tester) async {
final semantics = tester.ensureSemantics();
await pumpShell(tester, width: width, count: 0);
final badge = find.byKey(const ValueKey('shell.badge.runs.running'));
expect(badge, findsOneWidget);
expect(
find.byKey(const ValueKey('shell.badge.runs.failed')),
findsNothing,
);
expect(
find.descendant(
of: badge,
matching: find.textContaining(RegExp(r'\d')),
),
findsNothing,
);
expect(find.bySemanticsLabel(anyAttention), findsNothing);
semantics.dispose();
});
}
testWidgets('the badge stays visible from every destination', (tester) async {
await pumpShell(tester, width: 1000, count: 2);
for (final name in ['runs', 'chat', 'search']) {
await tester.tap(find.byKey(ValueKey('shell.destination.$name')));
await tester.pumpAndSettle();
expect(
find.descendant(
of: find.byKey(const ValueKey('shell.badge.runs.running')),
matching: find.text('2'),
),
findsOneWidget,
reason: 'badge missing on $name',
);
}
});
}