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.
This commit is contained in:
@@ -71,7 +71,7 @@ bool shouldReconnectOnForeground(ConnectionKind kind) =>
|
|||||||
///
|
///
|
||||||
/// Tests may inject the client and route-information provider; the session
|
/// Tests may inject the client and route-information provider; the session
|
||||||
/// owns the socket either way, so there is never a second app-level connection.
|
/// owns the socket either way, so there is never a second app-level connection.
|
||||||
typedef _RunIndicators = ({int attention, int running, int failed});
|
typedef _RunIndicators = ({int attention, int running});
|
||||||
|
|
||||||
class PipelinesApp extends StatefulWidget {
|
class PipelinesApp extends StatefulWidget {
|
||||||
const PipelinesApp({
|
const PipelinesApp({
|
||||||
@@ -209,7 +209,6 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
final _attentionCount = ValueNotifier<_RunIndicators>((
|
final _attentionCount = ValueNotifier<_RunIndicators>((
|
||||||
attention: 0,
|
attention: 0,
|
||||||
running: 0,
|
running: 0,
|
||||||
failed: 0,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
/// Android background delivery (no service elsewhere).
|
/// Android background delivery (no service elsewhere).
|
||||||
@@ -565,11 +564,9 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
/// frame arrives outside any build and applies at once.
|
/// frame arrives outside any build and applies at once.
|
||||||
void _attentionChanged() {
|
void _attentionChanged() {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
final statuses = runTabCounts(_attention.rows);
|
|
||||||
final count = (
|
final count = (
|
||||||
attention: _attention.entries.length,
|
attention: _attention.entries.length,
|
||||||
running: statuses.running,
|
running: runningRunCount(_attention.rows),
|
||||||
failed: statuses.failed,
|
|
||||||
);
|
);
|
||||||
if (count == _attentionCount.value) return;
|
if (count == _attentionCount.value) return;
|
||||||
if (SchedulerBinding.instance.schedulerPhase ==
|
if (SchedulerBinding.instance.schedulerPhase ==
|
||||||
@@ -826,7 +823,6 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
],
|
],
|
||||||
attentionCount: counts.attention,
|
attentionCount: counts.attention,
|
||||||
runningRunCount: counts.running,
|
runningRunCount: counts.running,
|
||||||
failedRunCount: counts.failed,
|
|
||||||
destination: _destinationOf(route.kind),
|
destination: _destinationOf(route.kind),
|
||||||
onDestinationSelected: _selectDestination,
|
onDestinationSelected: _selectDestination,
|
||||||
onClosePage: () => _delegate.goTo(
|
onClosePage: () => _delegate.goTo(
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
|
|
||||||
typedef RunTabCounts = ({int running, int failed});
|
/// Counts executing work without treating failed or completed runs as active.
|
||||||
|
int runningRunCount(Iterable<JsonMap> runs) {
|
||||||
/// Independent status counts from known, unfiltered server summaries.
|
|
||||||
/// Dismissing a notification does not change a run's failed status.
|
|
||||||
RunTabCounts runTabCounts(Iterable<JsonMap> runs) {
|
|
||||||
var running = 0;
|
var running = 0;
|
||||||
var failed = 0;
|
|
||||||
for (final run in runs) {
|
for (final run in runs) {
|
||||||
if (run['status'] == 'failed') failed++;
|
|
||||||
if (const {
|
if (const {
|
||||||
'succeeded',
|
'succeeded',
|
||||||
'failed',
|
'failed',
|
||||||
@@ -23,5 +18,5 @@ RunTabCounts runTabCounts(Iterable<JsonMap> runs) {
|
|||||||
running++;
|
running++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (running: running, failed: failed);
|
return running;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,19 +103,14 @@ class RunsList extends StatelessWidget {
|
|||||||
if (!ShellBar.available(context)) {
|
if (!ShellBar.available(context)) {
|
||||||
return _ownBar(context, [const Spacer(), ...actions]);
|
return _ownBar(context, [const Spacer(), ...actions]);
|
||||||
}
|
}
|
||||||
final counts = runTabCounts(controller.runs);
|
|
||||||
return ShellBar(
|
return ShellBar(
|
||||||
active: active,
|
active: active,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
// The Runs tab counts runs still executing.
|
// The Runs tab counts runs still executing.
|
||||||
child: ShellBadge(
|
child: ShellBadge(
|
||||||
kind: ShellBadgeKind.running,
|
kind: ShellBadgeKind.running,
|
||||||
count: counts.running,
|
count: runningRunCount(controller.runs),
|
||||||
child: ShellBadge(
|
child: _shortcutList(context),
|
||||||
kind: ShellBadgeKind.failed,
|
|
||||||
count: counts.failed,
|
|
||||||
child: _shortcutList(context),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class AdaptiveShell extends StatefulWidget {
|
|||||||
this.onSearch,
|
this.onSearch,
|
||||||
this.attentionCount = 0,
|
this.attentionCount = 0,
|
||||||
this.runningRunCount,
|
this.runningRunCount,
|
||||||
this.failedRunCount,
|
|
||||||
this.listPaneWidthStore = const SharedPreferencesListPaneWidthStore(),
|
this.listPaneWidthStore = const SharedPreferencesListPaneWidthStore(),
|
||||||
this.barActions = const [],
|
this.barActions = const [],
|
||||||
});
|
});
|
||||||
@@ -53,7 +52,6 @@ class AdaptiveShell extends StatefulWidget {
|
|||||||
|
|
||||||
/// App-wide counts when available; standalone screens publish their own.
|
/// App-wide counts when available; standalone screens publish their own.
|
||||||
final int? runningRunCount;
|
final int? runningRunCount;
|
||||||
final int? failedRunCount;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AdaptiveShell> createState() => _AdaptiveShellState();
|
State<AdaptiveShell> createState() => _AdaptiveShellState();
|
||||||
@@ -130,9 +128,6 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
|||||||
running:
|
running:
|
||||||
widget.runningRunCount ??
|
widget.runningRunCount ??
|
||||||
_bar.badge(destination, ShellBadgeKind.running),
|
_bar.badge(destination, ShellBadgeKind.running),
|
||||||
failed:
|
|
||||||
widget.failedRunCount ??
|
|
||||||
_bar.badge(destination, ShellBadgeKind.failed),
|
|
||||||
attention: widget.attentionCount,
|
attention: widget.attentionCount,
|
||||||
child: icon,
|
child: icon,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -44,49 +44,34 @@ class AttentionDestinationIcon extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Both status counts remain visible: failures never hide executing work.
|
/// The Runs tab shows executing work only; its error counter is removed.
|
||||||
class RunsDestinationIcon extends StatelessWidget {
|
class RunsDestinationIcon extends StatelessWidget {
|
||||||
const RunsDestinationIcon({
|
const RunsDestinationIcon({
|
||||||
super.key,
|
super.key,
|
||||||
required this.running,
|
required this.running,
|
||||||
required this.failed,
|
|
||||||
required this.child,
|
required this.child,
|
||||||
this.attention = 0,
|
this.attention = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
final int running;
|
final int running;
|
||||||
final int failed;
|
|
||||||
final int attention;
|
final int attention;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final colors = Theme.of(context).colorScheme;
|
final labels = [if (running > 0) '$running runs in progress'];
|
||||||
final labels = [
|
|
||||||
if (running > 0) '$running runs in progress',
|
|
||||||
if (failed > 0) '$failed failed runs',
|
|
||||||
if (attention > 0) attentionBadgeLabel(attention),
|
|
||||||
];
|
|
||||||
return Semantics(
|
return Semantics(
|
||||||
label: labels.join(', '),
|
label: labels.join(', '),
|
||||||
child: ExcludeSemantics(
|
child: ExcludeSemantics(
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: labels.isEmpty ? 'Runs' : 'Runs: ${labels.join(', ')}',
|
message: labels.isEmpty ? 'Runs' : 'Runs: ${labels.join(', ')}',
|
||||||
excludeFromSemantics: true,
|
excludeFromSemantics: true,
|
||||||
child: Badge.count(
|
child: ActivityBadge(
|
||||||
key: const ValueKey('shell.badge.runs.failed'),
|
key: const ValueKey('shell.badge.runs.running'),
|
||||||
count: failed,
|
count: running,
|
||||||
maxCount: 99,
|
label: 'runs in progress',
|
||||||
isLabelVisible: failed > 0,
|
bottom: true,
|
||||||
backgroundColor: colors.error,
|
child: child,
|
||||||
textColor: colors.onError,
|
|
||||||
child: ActivityBadge(
|
|
||||||
key: const ValueKey('shell.badge.runs.running'),
|
|
||||||
count: running,
|
|
||||||
label: 'runs in progress',
|
|
||||||
bottom: true,
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -357,9 +357,6 @@ enum ShellBadgeKind {
|
|||||||
/// Runs still executing.
|
/// Runs still executing.
|
||||||
running,
|
running,
|
||||||
|
|
||||||
/// Runs whose server status is failed, independent of attention dismissal.
|
|
||||||
failed,
|
|
||||||
|
|
||||||
/// Chats with messages not yet seen.
|
/// Chats with messages not yet seen.
|
||||||
unread,
|
unread,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
# Independent Runs tab indicators
|
# Independent Runs tab indicators
|
||||||
|
|
||||||
|
## Current behavior
|
||||||
|
|
||||||
|
The user requested temporary removal of the error counter. The failed badge,
|
||||||
|
its tab label/tooltip count and its tab-publication plumbing are removed. The
|
||||||
|
running indicator stays. The unfinished seen-state change was preserved outside
|
||||||
|
the checkout rather than included in this release.
|
||||||
|
|
||||||
|
Regression checks for this removal: 734 application, Runs, attention and shell
|
||||||
|
tests passed; analysis was clean. The earlier dual-counter description below is
|
||||||
|
historical and no longer describes the visible tab.
|
||||||
|
|
||||||
|
## Earlier dual-counter implementation (superseded)
|
||||||
|
|
||||||
The Runs tab now shows the executing count at the lower edge in the primary
|
The Runs tab now shows the executing count at the lower edge in the primary
|
||||||
theme colour and the failed count at the upper edge in the error colour.
|
theme colour and the failed count at the upper edge in the error colour.
|
||||||
Neither suppresses the other. Zero hides its indicator; the failed label caps
|
Neither suppresses the other. Zero hides its indicator; the failed label caps
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ void main() {
|
|||||||
Finder badgeCount(String count) =>
|
Finder badgeCount(String count) =>
|
||||||
find.descendant(of: find.byType(Badge), matching: find.text(count));
|
find.descendant(of: find.byType(Badge), matching: find.text(count));
|
||||||
|
|
||||||
testWidgets('waiting is announced without being labelled as a failed run', (
|
testWidgets('attention events do not restore the removed error counter', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
final semantics = tester.ensureSemantics();
|
final semantics = tester.ensureSemantics();
|
||||||
@@ -45,7 +45,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
expect(find.text('Nightly build'), findsWidgets);
|
expect(find.text('Nightly build'), findsWidgets);
|
||||||
expect(tester.widget<Badge>(find.byType(Badge)).isLabelVisible, isFalse);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
expect(find.bySemanticsLabel(needingAttention), findsNothing);
|
expect(find.bySemanticsLabel(needingAttention), findsNothing);
|
||||||
|
|
||||||
await tester.tap(find.byKey(const ValueKey('shell.destination.pipelines')));
|
await tester.tap(find.byKey(const ValueKey('shell.destination.pipelines')));
|
||||||
@@ -63,16 +63,16 @@ void main() {
|
|||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
expect(provider.value.uri.path, '/pipelines');
|
expect(provider.value.uri.path, '/pipelines');
|
||||||
expect(tester.widget<Badge>(find.byType(Badge)).isLabelVisible, isFalse);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
expect(
|
expect(
|
||||||
tester
|
tester
|
||||||
.widget<RunsDestinationIcon>(find.byType(RunsDestinationIcon))
|
.widget<RunsDestinationIcon>(find.byType(RunsDestinationIcon))
|
||||||
.failed,
|
.running,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
find.bySemanticsLabel(RegExp('Notifications, 1 needing attention')),
|
find.bySemanticsLabel(RegExp('Notifications, 1 needing attention')),
|
||||||
findsOneWidget,
|
findsNothing,
|
||||||
);
|
);
|
||||||
|
|
||||||
// The decision taken elsewhere clears the badge the same way.
|
// The decision taken elsewhere clears the badge the same way.
|
||||||
@@ -81,7 +81,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(tester.widget<Badge>(find.byType(Badge)).isLabelVisible, isFalse);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
expect(badgeCount('1'), findsNothing);
|
expect(badgeCount('1'), findsNothing);
|
||||||
expect(find.bySemanticsLabel(needingAttention), findsNothing);
|
expect(find.bySemanticsLabel(needingAttention), findsNothing);
|
||||||
semantics.dispose();
|
semantics.dispose();
|
||||||
@@ -98,7 +98,7 @@ void main() {
|
|||||||
addTearDown(provider.dispose);
|
addTearDown(provider.dispose);
|
||||||
|
|
||||||
await pumpApp(tester, channel: channel, client: client, provider: provider);
|
await pumpApp(tester, channel: channel, client: client, provider: provider);
|
||||||
expect(tester.widget<Badge>(find.byType(Badge)).isLabelVisible, isFalse);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
|
|
||||||
channel.incoming.add(
|
channel.incoming.add(
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@@ -119,7 +119,7 @@ void main() {
|
|||||||
expect(
|
expect(
|
||||||
tester
|
tester
|
||||||
.widget<RunsDestinationIcon>(find.byType(RunsDestinationIcon))
|
.widget<RunsDestinationIcon>(find.byType(RunsDestinationIcon))
|
||||||
.failed,
|
.running,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
|||||||
import 'pipelines_app_test.dart' show pumpApp, replyList;
|
import 'pipelines_app_test.dart' show pumpApp, replyList;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('both run counts update while another destination is visible', (
|
testWidgets('running updates across tabs without restoring the error counter', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
SharedPreferences.setMockInitialValues({});
|
SharedPreferences.setMockInitialValues({});
|
||||||
@@ -59,7 +59,7 @@ void main() {
|
|||||||
RunsDestinationIcon counts() =>
|
RunsDestinationIcon counts() =>
|
||||||
tester.widget<RunsDestinationIcon>(find.byType(RunsDestinationIcon));
|
tester.widget<RunsDestinationIcon>(find.byType(RunsDestinationIcon));
|
||||||
expect(counts().running, 1);
|
expect(counts().running, 1);
|
||||||
expect(counts().failed, 1);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
expect(counts().attention, 2);
|
expect(counts().attention, 2);
|
||||||
|
|
||||||
await tester.tap(find.byKey(const ValueKey('shell.destination.pipelines')));
|
await tester.tap(find.byKey(const ValueKey('shell.destination.pipelines')));
|
||||||
@@ -75,7 +75,7 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(provider.value.uri.path, '/pipelines');
|
expect(provider.value.uri.path, '/pipelines');
|
||||||
expect(counts().running, 1);
|
expect(counts().running, 1);
|
||||||
expect(counts().failed, 2);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
// Waiting -> failed must repaint even though total attention is unchanged.
|
// Waiting -> failed must repaint even though total attention is unchanged.
|
||||||
expect(counts().attention, 2);
|
expect(counts().attention, 2);
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(counts().running, 0);
|
expect(counts().running, 0);
|
||||||
expect(counts().failed, 2);
|
expect(find.byKey(const ValueKey('shell.badge.runs.failed')), findsNothing);
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
import 'package:pipelines_app/features/runs/domain/run_tab_counts.dart';
|
import 'package:pipelines_app/features/runs/domain/run_tab_counts.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
test('running and failed statuses are counted independently', () {
|
test('running work excludes failed and completed runs', () {
|
||||||
expect(
|
expect(
|
||||||
runTabCounts([
|
runningRunCount([
|
||||||
{'status': 'running', 'executing': true},
|
{'status': 'running', 'executing': true},
|
||||||
{'status': 'queued', 'executing': true},
|
{'status': 'queued', 'executing': true},
|
||||||
{'status': 'failed', 'executing': false},
|
{'status': 'failed', 'executing': false},
|
||||||
@@ -12,30 +12,30 @@ void main() {
|
|||||||
{'status': 'canceled'},
|
{'status': 'canceled'},
|
||||||
{'status': 'interrupted'},
|
{'status': 'interrupted'},
|
||||||
]),
|
]),
|
||||||
(running: 2, failed: 1),
|
2,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('terminal statuses override stale execution flags', () {
|
test('terminal statuses override stale execution flags', () {
|
||||||
expect(
|
expect(
|
||||||
runTabCounts([
|
runningRunCount([
|
||||||
{'status': 'failed', 'executing': true},
|
{'status': 'failed', 'executing': true},
|
||||||
{'status': 'succeeded', 'executing': true},
|
{'status': 'succeeded', 'executing': true},
|
||||||
]),
|
]),
|
||||||
(running: 0, failed: 1),
|
0,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('older running summaries work without inventing other live states', () {
|
test('older running summaries work without inventing other live states', () {
|
||||||
expect(
|
expect(
|
||||||
runTabCounts([
|
runningRunCount([
|
||||||
{'status': 'running'},
|
{'status': 'running'},
|
||||||
{'status': 'running', 'executing': false},
|
{'status': 'running', 'executing': false},
|
||||||
{'status': 'queued'},
|
{'status': 'queued'},
|
||||||
{'status': 'waiting'},
|
{'status': 'waiting'},
|
||||||
]),
|
]),
|
||||||
(running: 1, failed: 0),
|
1,
|
||||||
);
|
);
|
||||||
expect(runTabCounts([]), (running: 0, failed: 0));
|
expect(runningRunCount([]), 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||||
|
|
||||||
/// The Runs tab mirrors the attention count in every mount: the floating tab
|
/// The Runs tab keeps running work visible without an error counter.
|
||||||
/// 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() {
|
void main() {
|
||||||
final needingAttention = RegExp('3 failed runs');
|
final needingAttention = RegExp('3 runs in progress');
|
||||||
final anyAttention = RegExp('failed runs');
|
final anyAttention = RegExp('runs in progress');
|
||||||
|
|
||||||
Future<void> pumpShell(
|
Future<void> pumpShell(
|
||||||
WidgetTester tester, {
|
WidgetTester tester, {
|
||||||
@@ -19,7 +17,7 @@ void main() {
|
|||||||
tester.view.devicePixelRatio = 1;
|
tester.view.devicePixelRatio = 1;
|
||||||
addTearDown(tester.view.resetPhysicalSize);
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
addTearDown(tester.view.resetDevicePixelRatio);
|
addTearDown(tester.view.resetDevicePixelRatio);
|
||||||
final shell = AdaptiveShell(failedRunCount: count);
|
final shell = AdaptiveShell(runningRunCount: count, attentionCount: 99);
|
||||||
await tester.pumpWidget(MaterialApp(home: shell));
|
await tester.pumpWidget(MaterialApp(home: shell));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,9 +29,12 @@ void main() {
|
|||||||
await pumpShell(tester, width: width, count: 3);
|
await pumpShell(tester, width: width, count: 3);
|
||||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||||
expect(find.byType(NavigationRail), findsNothing);
|
expect(find.byType(NavigationRail), findsNothing);
|
||||||
final badge = find.byType(Badge);
|
final badge = find.byKey(const ValueKey('shell.badge.runs.running'));
|
||||||
expect(badge, findsOneWidget);
|
expect(badge, findsOneWidget);
|
||||||
expect(tester.widget<Badge>(badge).isLabelVisible, isTrue);
|
expect(
|
||||||
|
find.byKey(const ValueKey('shell.badge.runs.failed')),
|
||||||
|
findsNothing,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
find.descendant(of: badge, matching: find.text('3')),
|
find.descendant(of: badge, matching: find.text('3')),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
@@ -45,9 +46,12 @@ void main() {
|
|||||||
testWidgets('$mount hides the badge at zero', (tester) async {
|
testWidgets('$mount hides the badge at zero', (tester) async {
|
||||||
final semantics = tester.ensureSemantics();
|
final semantics = tester.ensureSemantics();
|
||||||
await pumpShell(tester, width: width, count: 0);
|
await pumpShell(tester, width: width, count: 0);
|
||||||
final badge = find.byType(Badge);
|
final badge = find.byKey(const ValueKey('shell.badge.runs.running'));
|
||||||
expect(badge, findsOneWidget);
|
expect(badge, findsOneWidget);
|
||||||
expect(tester.widget<Badge>(badge).isLabelVisible, isFalse);
|
expect(
|
||||||
|
find.byKey(const ValueKey('shell.badge.runs.failed')),
|
||||||
|
findsNothing,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: badge,
|
of: badge,
|
||||||
@@ -66,7 +70,10 @@ void main() {
|
|||||||
await tester.tap(find.byKey(ValueKey('shell.destination.$name')));
|
await tester.tap(find.byKey(ValueKey('shell.destination.$name')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(
|
expect(
|
||||||
find.descendant(of: find.byType(Badge), matching: find.text('2')),
|
find.descendant(
|
||||||
|
of: find.byKey(const ValueKey('shell.badge.runs.running')),
|
||||||
|
matching: find.text('2'),
|
||||||
|
),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
reason: 'badge missing on $name',
|
reason: 'badge missing on $name',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -66,10 +66,9 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget shell({int attention = 0, int failed = 0}) {
|
Widget shell({int attention = 0}) {
|
||||||
final app = AdaptiveShell(
|
final app = AdaptiveShell(
|
||||||
attentionCount: attention,
|
attentionCount: attention,
|
||||||
failedRunCount: failed,
|
|
||||||
destinationBodies: {
|
destinationBodies: {
|
||||||
AppDestination.runs: (_) => ShellBadge(
|
AppDestination.runs: (_) => ShellBadge(
|
||||||
kind: ShellBadgeKind.running,
|
kind: ShellBadgeKind.running,
|
||||||
@@ -219,14 +218,14 @@ void main() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('the Runs tab shows running and failed indicators together', (
|
testWidgets('the Runs tab keeps running work without an error counter', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await setSize(tester, const Size(1200, 800));
|
await setSize(tester, const Size(1200, 800));
|
||||||
await tester.pumpWidget(shell(attention: 2, failed: 2));
|
await tester.pumpWidget(shell(attention: 2));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(find.text('2'), findsOneWidget);
|
expect(find.text('2'), findsNothing);
|
||||||
expect(find.text('4'), findsOneWidget);
|
expect(find.text('4'), findsOneWidget);
|
||||||
|
|
||||||
await tester.pumpWidget(shell());
|
await tester.pumpWidget(shell());
|
||||||
|
|||||||
@@ -5,46 +5,38 @@ import 'package:pipelines_app/shell/adaptive_shell.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
for (final width in [390.0, 1000.0]) {
|
for (final width in [390.0, 1000.0]) {
|
||||||
for (final brightness in Brightness.values) {
|
for (final brightness in Brightness.values) {
|
||||||
testWidgets('running and failed are distinct at $width $brightness', (
|
testWidgets(
|
||||||
tester,
|
'running stays visible without an error counter at $width $brightness',
|
||||||
) async {
|
(tester) async {
|
||||||
tester.view.physicalSize = Size(width, 900);
|
tester.view.physicalSize = Size(width, 900);
|
||||||
tester.view.devicePixelRatio = 1;
|
tester.view.devicePixelRatio = 1;
|
||||||
addTearDown(tester.view.reset);
|
addTearDown(tester.view.reset);
|
||||||
final semantics = tester.ensureSemantics();
|
final semantics = tester.ensureSemantics();
|
||||||
final theme = ThemeData(brightness: brightness);
|
final theme = ThemeData(brightness: brightness);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
home: const AdaptiveShell(runningRunCount: 2, failedRunCount: 3),
|
home: const AdaptiveShell(runningRunCount: 2, attentionCount: 3),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final failed = find.byKey(const ValueKey('shell.badge.runs.failed'));
|
final failed = find.byKey(const ValueKey('shell.badge.runs.failed'));
|
||||||
final running = find.byKey(const ValueKey('shell.badge.runs.running'));
|
final running = find.byKey(
|
||||||
expect(
|
const ValueKey('shell.badge.runs.running'),
|
||||||
find.descendant(of: failed, matching: find.text('3')),
|
);
|
||||||
findsOneWidget,
|
expect(failed, findsNothing);
|
||||||
);
|
expect(
|
||||||
expect(
|
find.descendant(of: running, matching: find.text('2')),
|
||||||
find.descendant(of: running, matching: find.text('2')),
|
findsOneWidget,
|
||||||
findsOneWidget,
|
);
|
||||||
);
|
expect(
|
||||||
expect(
|
find.bySemanticsLabel(RegExp('2 runs in progress')),
|
||||||
tester.widget<Badge>(failed).backgroundColor,
|
findsOneWidget,
|
||||||
theme.colorScheme.error,
|
);
|
||||||
);
|
expect(tester.takeException(), isNull);
|
||||||
expect(
|
semantics.dispose();
|
||||||
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();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user