Merge branch 'worktree-agent-a75e04ded5a42e4fb' into integrate/detail-bodies

# Conflicts:
#	app/lib/features/runs/ui/run_detail_timeline.dart
This commit is contained in:
2026-10-31 12:42:39 +00:00
23 changed files with 867 additions and 386 deletions
@@ -0,0 +1,75 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_summary_view.dart';
import 'package:pipelines_app/features/schedules/ui/pipeline/schedule_pipeline_wording.dart';
import 'package:pipelines_app/ui/layout/app_list_row.dart';
import 'fixtures.dart';
/// The pipeline Summary is flat on both hosts: facts in the shared grid,
/// Schedules with Add as its heading's only action (no body Refresh), and
/// versions as the shared list row.
void main() {
for (final cupertino in [false, true]) {
testWidgets('pipeline Summary is a facts grid with flat sections '
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
final gateway = FakeGateway((type, fields) {
return switch (type) {
'list_pipelines' => pipelineListReply([
pipelineSummary(id: 1, name: 'Alpha review', version: 3),
]),
'list_runs' => runListReply([]),
'get_pipeline' => pipelineDetailReply(
pipelineDetail(
id: 1,
name: 'Alpha review',
version: 3,
latestVersion: 3,
versions: [versionSummary(2), versionSummary(3)],
),
),
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
_ => errorReply('unexpected $type'),
};
});
tester.view.physicalSize = const Size(1100, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final screen = PipelinesScreen(gateway: gateway);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
: MaterialApp(home: screen),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pumpAndSettle();
expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget);
// Short facts share a line instead of one label/value row each.
final latest = tester.getRect(
find.byKey(const ValueKey('pipeline-summary-latest-version')),
);
final versionCreated = tester.getRect(
find.byKey(const ValueKey('pipeline-summary-version-created')),
);
expect(versionCreated.top, moreOrLessEquals(latest.top));
expect(versionCreated.left, greaterThan(latest.right));
expect(find.text('Refresh'), findsNothing);
expect(find.text(scheduleAddLabel), findsNothing);
expect(find.byKey(scheduleAddKey), findsOneWidget);
expect(find.byType(CupertinoListSection), findsNothing);
expect(find.byType(ListTile), findsNothing);
final row = tester.widget<AppListRow>(
find.byKey(const Key('pipeline-version-3')),
);
expect(row.selected, isTrue);
expect(row.cupertino, cupertino);
expect(tester.takeException(), isNull);
});
}
}
@@ -141,7 +141,14 @@ void main() {
),
findsOneWidget,
);
expect(find.byType(CupertinoListTile), findsWidgets);
// Versions are the shared row in its Cupertino form, flat on the page.
expect(
tester
.widget<AppListRow>(find.byKey(const Key('pipeline-version-1')))
.cupertino,
isTrue,
);
expect(find.byType(CupertinoListSection), findsNothing);
await tester.tap(find.byKey(const Key('pipeline-version-1')));
await tester.pumpAndSettle();
@@ -0,0 +1,91 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
import 'package:pipelines_app/ui/layout/section_heading.dart';
import 'run_detail_graph_support.dart';
import 'run_detail_visit_support.dart';
/// The run and stage detail bodies are flat on the page on both hosts: no
/// Cupertino inset group (so none nested in another), pinned headings on the
/// page colour, and beside a list one row of tabs and header.
void main() {
for (final platform in RunDetailTestPlatform.values) {
testWidgets('${platform.name} Summary and Timeline draw no grouped '
'card', (tester) async {
await pumpRunDetail(tester, platform);
expect(find.byType(CupertinoListSection), findsNothing);
await openRunDetailTab(tester, RunDetailTab.timeline);
expect(find.byType(CupertinoListSection), findsNothing);
expect(tester.takeException(), isNull);
});
testWidgets('${platform.name} the stage Session nests no group in a '
'group', (tester) async {
await openVisit(tester, platform);
await openVisitTab(tester, RunVisitSection.session);
expect(find.text('Turn documents'), findsOneWidget);
expect(find.byType(CupertinoListSection), findsNothing);
});
testWidgets('${platform.name} beside a list the tabs and the header '
'share one row', (tester) async {
tester.view.physicalSize = const Size(720, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final gateway = RunDetailFakeGateway(graphRunFixture());
final controller = RunsController(RunsRepository(gateway));
addTearDown(controller.dispose);
await controller.select(51);
final view = PageTabsEdge(
edge: FloatingBarEdge.top,
child: RunDetailView(
controller: controller,
gateway: gateway,
onBack: () {},
),
);
await tester.pumpWidget(
platform == RunDetailTestPlatform.material
? MaterialApp(home: Scaffold(body: view))
: CupertinoApp(home: CupertinoPageScaffold(child: view)),
);
await tester.pumpAndSettle();
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
final header = tester.getRect(find.byKey(const Key('run-detail-header')));
// Side by side, not stacked: the header starts after the tabs and
// overlaps them vertically.
expect(header.left, greaterThanOrEqualTo(tabs.right - 12));
expect(header.top, lessThan(tabs.bottom));
expect(header.bottom, greaterThan(tabs.top));
expect(tester.takeException(), isNull);
});
}
testWidgets('Cupertino pinned headings take the page colour', (tester) async {
for (final brightness in Brightness.values) {
late SectionHeadingStyle style;
late Color page;
await tester.pumpWidget(
CupertinoApp(
theme: CupertinoThemeData(brightness: brightness),
home: Builder(
builder: (context) {
style = SectionHeadingStyle.of(context);
page = CupertinoTheme.of(context).scaffoldBackgroundColor;
return const SizedBox.shrink();
},
),
),
);
expect(style.background, page, reason: '$brightness');
}
});
}
@@ -1,3 +1,4 @@
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';
@@ -132,10 +133,12 @@ void main() {
size: const Size(900, 1600),
);
for (final label in recordedLabels) {
// The bar's subtitle names the pipeline, so no Pipeline fact repeats it.
for (final label in recordedLabels.where((l) => l != 'Pipeline')) {
expect(find.text(label), findsOneWidget, reason: label);
}
expect(find.text('id 3 · v2'), findsOneWidget);
expect(find.text('Pipeline'), findsNothing);
expect(find.text('id 3 · v2'), findsNothing);
expect(find.text('review'), findsOneWidget);
expect(find.text('/srv/workspaces/run-51'), findsOneWidget);
expect(find.text('abc123def456'), findsOneWidget);
@@ -199,6 +202,28 @@ void main() {
expect(hash.width, greaterThan(300));
});
testWidgets('${platform.name} a single fact starts at the leading edge, '
'with no grouped card', (tester) async {
await pumpRunDetail(
tester,
platform,
run: absentRunFixture()..['current_stage'] = 'review',
size: const Size(900, 1600),
);
final grid = tester.getRect(
find.byKey(const Key('run-detail-summary-facts')),
);
final stage = tester.getRect(
find.byKey(const ValueKey('run-detail-summary-stage')),
);
// The grid spans the Summary, and its one fact is at the start of the
// line rather than a half-width block centred on the page.
expect(grid.width, moreOrLessEquals(900));
expect(stage.left, moreOrLessEquals(16));
expect(stage.center.dx, lessThan(450));
expect(find.byType(CupertinoListSection), findsNothing);
});
testWidgets('${platform.name} summary sections state their exact empty '
'wording', (tester) async {
await pumpRunDetail(
@@ -121,10 +121,23 @@ void main() {
tester,
) async {
await pumpRunDetail(tester, platform, run: graphRunFixture(graph: false));
await openRunDetailTab(tester, RunDetailTab.graph);
await openRunDetailTab(tester, RunDetailTab.summary);
// One muted line on the Summary: no framed, tappable empty preview.
expect(find.text(runGraphMissing), findsOneWidget);
expect(find.byKey(runGraphPreviewMissingKey), findsOneWidget);
expect(find.byKey(runGraphPreviewKey), findsNothing);
expect(find.byType(RunGraphView), findsNothing);
expect(find.byType(InteractiveViewer), findsNothing);
final line = tester.getSize(find.byKey(runGraphPreviewMissingKey));
expect(line.height, lessThan(60));
expect(
find.descendant(
of: find.byKey(runGraphPreviewMissingKey),
matching: find.byType(DecoratedBox),
),
findsNothing,
);
});
testWidgets('${platform.name} Graph stays bounded at 320 with 2x text', (
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_content.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_timeline.dart';
import 'package:pipelines_app/ui/layout/app_list_row.dart';
import 'package:pipelines_app/ui/status/run_status_icon.dart';
final _steps = [
@@ -52,8 +53,13 @@ void main() {
expect(find.text('success'), findsOneWidget);
expect(find.text('error'), findsOneWidget);
expect(find.text('→ build · 2m 5s'), findsOneWidget);
// The target is the line; the duration is the row's time.
expect(find.text('→ build'), findsOneWidget);
expect(find.text('2m 5s'), findsOneWidget);
expect(find.text('→ #failure'), findsOneWidget);
// The shared flat row, with no grouped card on either host.
expect(find.byType(AppListRow), findsNWidgets(3));
expect(find.byType(CupertinoListSection), findsNothing);
});
}
@@ -112,10 +112,7 @@ void main() {
await pumpScheduleSection(tester, gateway: gateway, version: 3);
expect(find.text('Schedules (0)'), findsOneWidget);
expect(
find.text('No schedules yet. Add one for each topic or recurring task.'),
findsOneWidget,
);
expect(find.textContaining(scheduleSectionEmpty), findsOneWidget);
await tester.tap(find.byKey(scheduleAddKey));
await tester.pumpAndSettle();
@@ -329,10 +326,7 @@ void main() {
expect(gateway.callsOf('delete_schedule'), hasLength(1));
expect(find.text('Research batteries'), findsNothing);
expect(
find.text('No schedules yet. Add one for each topic or recurring task.'),
findsOneWidget,
);
expect(find.textContaining(scheduleSectionEmpty), findsOneWidget);
expect(gateway.calls.map((call) => call.type), [
'list_schedules',
'delete_schedule',