feat(app): the Changes tab lists the run's final changes, without a filter field

This commit is contained in:
2026-10-23 17:25:25 +01:00
parent cd86792094
commit 0c1e399e17
7 changed files with 138 additions and 253 deletions
@@ -210,56 +210,6 @@ void main() {
},
);
testWidgets('filtering changed filenames keeps matching rows and says so', (
tester,
) async {
await tester.pumpWidget(
materialHost(
ChangesViewer(
steps: [
stepFixture(
fileChanges: captureFixture(
files: [
fileChangeFixture(path: 'assets/logo.bin', binary: true),
fileChangeFixture(
path: 'lib/feature.dart',
patch: multiHunkPatch,
),
fileChangeFixture(
path: 'docs/notes.md',
kind: 'added',
patch: '@@ -0,0 +1 @@\n+x',
),
],
),
),
],
),
),
);
expect(find.text('assets/logo.bin'), findsOneWidget);
expect(find.text('lib/feature.dart'), findsOneWidget);
await tester.enterText(find.byType(TextField), 'feature');
await tester.pump();
expect(find.text('lib/feature.dart'), findsOneWidget);
expect(find.text('assets/logo.bin'), findsNothing);
expect(find.text('docs/notes.md'), findsNothing);
expect(find.text('1 of 3 changed paths match'), findsOneWidget);
await tester.enterText(find.byType(TextField), 'nothing-here');
await tester.pump();
expect(
find.text('No changed filenames match "nothing-here".'),
findsOneWidget,
);
await tester.enterText(find.byType(TextField), '');
await tester.pump();
expect(find.text('assets/logo.bin'), findsOneWidget);
expect(find.textContaining('changed files match'), findsNothing);
});
testWidgets(
'opening a file shows the rendered patch and copies exact bytes',
(tester) async {
@@ -400,48 +350,48 @@ void main() {
);
});
testWidgets(
'Cupertino uses native list tiles, search field and segmented control',
(tester) async {
await tester.pumpWidget(
cupertinoHost(
ChangesViewer(
steps: [
stepFixture(
fileChanges: captureFixture(
files: [
fileChangeFixture(
path: 'lib/feature.dart',
patch: multiHunkPatch,
),
],
),
testWidgets('Cupertino uses native list tiles and segmented control', (
tester,
) async {
await tester.pumpWidget(
cupertinoHost(
ChangesViewer(
steps: [
stepFixture(
fileChanges: captureFixture(
files: [
fileChangeFixture(
path: 'lib/feature.dart',
patch: multiHunkPatch,
),
],
),
],
),
),
],
),
);
expect(find.byType(CupertinoListTile), findsOneWidget);
expect(find.byType(CupertinoSearchTextField), findsOneWidget);
expect(find.byType(TextField), findsNothing);
),
);
expect(find.byType(CupertinoListTile), findsOneWidget);
// No filter field: the changes list shows every recorded file.
expect(find.byType(CupertinoSearchTextField), findsNothing);
expect(find.byType(TextField), findsNothing);
await tester.tap(find.byKey(const ValueKey('change-1-lib/feature.dart')));
await tester.pumpAndSettle();
expect(
find.byType(CupertinoSlidingSegmentedControl<DiffForm>),
findsOneWidget,
);
expect(find.text('Rendered'), findsOneWidget);
expect(find.text('Raw patch'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('change-1-lib/feature.dart')));
await tester.pumpAndSettle();
expect(
find.byType(CupertinoSlidingSegmentedControl<DiffForm>),
findsOneWidget,
);
expect(find.text('Rendered'), findsOneWidget);
expect(find.text('Raw patch'), findsOneWidget);
await tester.tap(find.byIcon(CupertinoIcons.xmark));
await tester.pumpAndSettle();
expect(
find.byType(CupertinoSlidingSegmentedControl<DiffForm>),
findsNothing,
);
},
);
await tester.tap(find.byIcon(CupertinoIcons.xmark));
await tester.pumpAndSettle();
expect(
find.byType(CupertinoSlidingSegmentedControl<DiffForm>),
findsNothing,
);
});
testWidgets('narrow viewport and large text keep every control reachable', (
tester,
@@ -138,26 +138,6 @@ void main() {
expect(find.text('lib/only.dart'), findsOneWidget);
});
testWidgets('the filter and its aggregate counter survive paging', (
tester,
) async {
await tester.pumpWidget(materialHost(ChangesViewer(steps: twoVisitRun())));
await tester.enterText(find.byType(TextField), 'a.dart');
await tester.pump();
expect(find.text('1 of 3 changed paths match'), findsOneWidget);
expect(find.text('lib/a.dart'), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
// The filter still applies to the shown visit, and the counter still
// describes the whole run's changed paths.
expect(find.text('1 of 3 changed paths match'), findsOneWidget);
expect(find.text('No changed filenames match "a.dart".'), findsOneWidget);
expect(find.text('lib/c.dart'), findsNothing);
expect(find.text('reviewer'), findsOneWidget);
});
testWidgets('a shorter reply clamps the shown visit instead of overflowing', (
tester,
) async {
@@ -118,22 +118,11 @@ void main() {
find.text('1 file changed · +2 -2 · capture incomplete'),
findsOneWidget,
);
// The page opens on the run's first recorded visit; its stage/visit
// heading identifies the evidence, and Next reaches the second visit.
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('implementer'), findsOneWidget);
expect(find.byKey(ChangesVisitPager.nextKey), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/feature.dart'), findsNothing);
await tester.tap(find.byKey(ChangesVisitPager.previousKey));
await tester.pump();
expect(find.text('lib/feature.dart'), findsOneWidget);
// The tab is the final state: each path once, no visit pages.
expect(find.byKey(ChangesVisitPager.nextKey), findsNothing);
await tester.tap(
find.byKey(const ValueKey('change-1-lib/feature.dart')),
find.byKey(const ValueKey('change-final-lib/feature.dart')),
);
await tester.pumpAndSettle();
final rendered = tester
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/changes/changes.dart';
import 'package:pipelines_app/features/changes/widgets/visit_pager.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
import 'package:pipelines_app/features/runs/ui/run_changes_action.dart';
@@ -124,38 +123,29 @@ void main() {
});
for (final platform in _Platform.values) {
testWidgets(
'${platform.name}: a failed run keeps visit evidence, not a summary',
(tester) async {
await _openChanges(
tester,
platform,
_run(
status: 'failed',
fileChanges: captureFixture(
files: [fileChangeFixture(path: 'lib/feature.dart')],
),
testWidgets('${platform.name}: a failed run tab shows its final changes', (
tester,
) async {
await _openChanges(
tester,
platform,
_run(
status: 'failed',
fileChanges: captureFixture(
files: [fileChangeFixture(path: 'lib/feature.dart')],
),
);
),
);
// The web client shows the aggregate only for succeeded runs.
expect(find.textContaining('file changed ·'), findsNothing);
expect(
find.textContaining('The summary counts each path once'),
findsNothing,
);
// The visit's own recorded capture stays reachable, one visit page at
// a time; the second visit's gap is reachable with Next.
expect(find.text('lib/feature.dart'), findsOneWidget);
expect(find.text('implementer'), findsOneWidget);
expect(find.text('Visit 1 · completed'), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('reviewer'), findsOneWidget);
expect(find.text(missingCaptureDetail), findsOneWidget);
expect(tester.takeException(), isNull);
},
);
// The tab is the end state: each changed path once, no visit pages.
expect(find.byKey(const ValueKey('changes-final')), findsOneWidget);
expect(
find.byKey(const ValueKey('change-final-lib/feature.dart')),
findsOneWidget,
);
expect(find.byKey(ChangesVisitPager.nextKey), findsNothing);
expect(tester.takeException(), isNull);
});
testWidgets(
'${platform.name}: an active run offers no snapshot Changes page',
@@ -206,7 +196,7 @@ void main() {
// The diff opens on the app Navigator, above the page's theme, so its
// own header must follow the host brightness too.
await tester.tap(
find.byKey(const ValueKey('change-1-lib/feature.dart')),
find.byKey(const ValueKey('change-final-lib/feature.dart')),
);
await tester.pumpAndSettle();
final title = tester.widget<Text>(find.text('Modified'));