Files
pipelines/app/test/features/runs/ui/run_findings_tab_test.dart
T
alan ebe79ebed0 App: findings ledger tab, retry extra visits and exhaustion decisions
Run detail gains a Findings tab (open-count badge) listing the server's
findings ledger with status and minimum-severity filters and expandable
event history; visit grants show as an Extra visits summary fact. The
resume retry prompt can grant 1-5 extra visits to the exhausted stage or a
chosen graph stage (never sent on restart), suggested when the run failed
on a visit limit. A loop-exhaustion decision waiting on a model stage is
now decidable from its recorded options, with readable labels, targets and
the visit count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:45:51 +00:00

65 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/domain/run_findings.dart';
import 'package:pipelines_app/features/runs/ui/run_findings_tab.dart';
import '../domain/run_findings_fixture.dart';
Future<void> pumpFindings(WidgetTester tester, List<RunFinding> findings) =>
tester.pumpWidget(
MaterialApp(
home: Scaffold(body: RunFindingsTab(findings: findings)),
),
);
Finder finding(String id) => find.byKey(ValueKey('run-finding-$id'));
void main() {
testWidgets('starts on open findings and filters by status', (tester) async {
await pumpFindings(tester, runFindings(findingsRun()));
expect(finding('F1'), findsOneWidget);
expect(finding('F2'), findsNothing);
expect(find.text('F1 · Cache never evicts'), findsOneWidget);
expect(find.text('critical · introduced · open'), findsOneWidget);
expect(find.text('internal/cache.go:42'), findsOneWidget);
expect(find.text('Open (1)'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('run-findings-status-all')));
await tester.pumpAndSettle();
for (final id in ['F1', 'F2', 'F3']) {
expect(finding(id), findsOneWidget);
}
await tester.tap(find.byKey(const ValueKey('run-findings-status-settled')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-findings-empty')), findsOneWidget);
});
testWidgets('filters by minimum severity and expands events', (tester) async {
await pumpFindings(tester, runFindings(findingsRun()));
await tester.tap(find.byKey(const ValueKey('run-findings-status-all')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('run-findings-severity')));
await tester.pumpAndSettle();
await tester.tap(find.text('minor').last);
await tester.pumpAndSettle();
expect(finding('F2'), findsOneWidget);
expect(finding('F3'), findsNothing);
expect(find.text('Corrected'), findsOneWidget);
await tester.tap(finding('F2'));
await tester.pumpAndSettle();
expect(find.text('Raised by review (visit #4)'), findsOneWidget);
expect(find.text('Updated by implement (visit #5)'), findsOneWidget);
expect(find.text('#5 · implement · fixed: Corrected'), findsOneWidget);
});
testWidgets('with nothing open, all findings show', (tester) async {
await pumpFindings(tester, runFindings(findingsRun()).skip(1).toList());
expect(finding('F2'), findsOneWidget);
expect(finding('F3'), findsOneWidget);
});
}