feat(app): run detail tabs are Summary, Timeline, Artifacts and Changes; the graph is a Summary preview that opens full screen

This commit is contained in:
2026-10-23 16:55:24 +01:00
parent 4276f5717f
commit 855a1e6ca5
17 changed files with 307 additions and 43 deletions
@@ -31,6 +31,8 @@ bool showRunArtifactsAction(JsonMap run) =>
/// Whether the run is still executing, so the page can say capture pending /// Whether the run is still executing, so the page can say capture pending
/// instead of claiming nothing was recorded. /// instead of claiming nothing was recorded.
bool runDetailExecuting(JsonMap run) => _runExecuting(run);
bool _runExecuting(JsonMap run) => bool _runExecuting(JsonMap run) =>
run['executing'] == true || run['executing'] == true ||
_executingStatuses.contains('${run['status'] ?? ''}'.trim().toLowerCase()); _executingStatuses.contains('${run['status'] ?? ''}'.trim().toLowerCase());
@@ -50,6 +50,7 @@ class ArtifactGalleryPage extends StatefulWidget {
this.fetch = fetchArtifact, this.fetch = fetchArtifact,
this.markdownBuilder = chatMarkdownText, this.markdownBuilder = chatMarkdownText,
this.fileBridge = const ArtifactFileBridge(), this.fileBridge = const ArtifactFileBridge(),
this.embedded = false,
}); });
final List<JsonMap> steps; final List<JsonMap> steps;
@@ -64,6 +65,10 @@ class ArtifactGalleryPage extends StatefulWidget {
final ArtifactMarkdownBuilder markdownBuilder; final ArtifactMarkdownBuilder markdownBuilder;
final ArtifactFileBridge fileBridge; final ArtifactFileBridge fileBridge;
/// True inside the run detail's Artifacts tab: the list without its own
/// page bar, since the detail already names the run.
final bool embedded;
@override @override
State<ArtifactGalleryPage> createState() => _ArtifactGalleryPageState(); State<ArtifactGalleryPage> createState() => _ArtifactGalleryPageState();
} }
@@ -378,6 +383,7 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
selectedIdentity: _selectedIdentity, selectedIdentity: _selectedIdentity,
onSelected: _select, onSelected: _select,
); );
if (widget.embedded) return body;
if (usesCupertinoHost(context)) { if (usesCupertinoHost(context)) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
// Sections paint the grouped background; the page must match it or a // Sections paint the grouped background; the page must match it or a
@@ -46,6 +46,7 @@ class RunGraphView extends StatefulWidget {
required this.onStageSelected, required this.onStageSelected,
this.selectedStage, this.selectedStage,
this.now, this.now,
this.showHeader = true,
}); });
/// The run's definition graph, or null when the server omitted it. /// The run's definition graph, or null when the server omitted it.
@@ -62,6 +63,9 @@ class RunGraphView extends StatefulWidget {
/// Injectable clock for deterministic elapsed labels; defaults to now. /// Injectable clock for deterministic elapsed labels; defaults to now.
final DateTime Function()? now; final DateTime Function()? now;
/// False for a still preview, which has no room for the status legend.
final bool showHeader;
@override @override
State<RunGraphView> createState() => _RunGraphViewState(); State<RunGraphView> createState() => _RunGraphViewState();
} }
@@ -193,7 +197,8 @@ class _RunGraphViewState extends State<RunGraphView> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
RunGraphHeader(state: state, style: style, now: widget.now), if (widget.showHeader)
RunGraphHeader(state: state, style: style, now: widget.now),
Expanded( Expanded(
child: Stack( child: Stack(
fit: StackFit.expand, fit: StackFit.expand,
@@ -1,7 +1,6 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import '../../../core/api_gateway.dart'; import '../../../core/api_gateway.dart';
import '../../artifacts/ui/artifact_gallery_action.dart';
import '../actions/cancel_eligibility.dart'; import '../actions/cancel_eligibility.dart';
import '../actions/cancel_run_action.dart'; import '../actions/cancel_run_action.dart';
import '../actions/retry_action.dart'; import '../actions/retry_action.dart';
@@ -58,8 +57,6 @@ class RunDetailActions extends StatelessWidget {
gateway: gateway, gateway: gateway,
onRunChanged: onRunChanged, onRunChanged: onRunChanged,
), ),
if (showRunArtifactsAction(run))
RunArtifactsButton(run: run, gateway: gateway),
], ],
), ),
RunDecisionNotice(run: run, gateway: gateway, onRunChanged: onRunChanged), RunDecisionNotice(run: run, gateway: gateway, onRunChanged: onRunChanged),
@@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
import '../../../core/api_gateway.dart'; import '../../../core/api_gateway.dart';
import '../../../ui/status/run_status_icon.dart'; import '../../../ui/status/run_status_icon.dart';
import '../domain/run_models.dart'; import '../domain/run_models.dart';
import 'run_changes_action.dart';
import 'run_detail_content.dart'; import 'run_detail_content.dart';
import 'run_detail_tabs.dart'; import 'run_detail_tabs.dart';
import 'run_more_menu.dart'; import 'run_more_menu.dart';
@@ -66,7 +65,6 @@ Widget buildCupertinoRunDetail({
], ],
), ),
), ),
if (showRunChangesAction(run)) RunChangesButton(run: run),
if (copying) const CupertinoActivityIndicator(), if (copying) const CupertinoActivityIndicator(),
RunMoreMenu( RunMoreMenu(
run: run, run: run,
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart'; import '../../../core/api_gateway.dart';
import '../../../ui/status/run_status_icon.dart'; import '../../../ui/status/run_status_icon.dart';
import '../domain/run_models.dart'; import '../domain/run_models.dart';
import 'run_changes_action.dart';
import 'run_detail_content.dart'; import 'run_detail_content.dart';
import 'run_detail_tabs.dart'; import 'run_detail_tabs.dart';
import 'run_more_menu.dart'; import 'run_more_menu.dart';
@@ -62,7 +61,6 @@ Widget buildMaterialRunDetail({
icon: const Icon(Icons.arrow_back), icon: const Icon(Icons.arrow_back),
label: const Text('Back to list'), label: const Text('Back to list'),
), ),
if (showRunChangesAction(run)) RunChangesButton(run: run),
], ],
), ),
), ),
+3 -1
View File
@@ -9,7 +9,9 @@ enum RunDetailTab {
graph('Graph'), graph('Graph'),
input('Input'), input('Input'),
output('Output'), output('Output'),
timeline('Timeline'); timeline('Timeline'),
artifacts('Artifacts'),
changes('Changes');
const RunDetailTab(this.label); const RunDetailTab(this.label);
@@ -25,6 +25,7 @@ Widget runDetailSummaryTab({
required VoidCallback onCopy, required VoidCallback onCopy,
ExpansibleController? inputController, ExpansibleController? inputController,
ExpansibleController? outputController, ExpansibleController? outputController,
Widget? graphPreview,
}) { }) {
final rows = detailSummaryRows(run); final rows = detailSummaryRows(run);
final identity = detailSummaryIdentity(run); final identity = detailSummaryIdentity(run);
@@ -33,6 +34,7 @@ Widget runDetailSummaryTab({
return ListView( return ListView(
key: const Key('run-detail-tab-body-summary'), key: const Key('run-detail-tab-body-summary'),
children: [ children: [
?graphPreview,
_cupertinoIdentity(context, identity), _cupertinoIdentity(context, identity),
if (rows.any((row) => !row.block)) if (rows.any((row) => !row.block))
CupertinoListSection.insetGrouped( CupertinoListSection.insetGrouped(
@@ -69,6 +71,7 @@ Widget runDetailSummaryTab({
key: const Key('run-detail-tab-body-summary'), key: const Key('run-detail-tab-body-summary'),
padding: const EdgeInsets.only(bottom: 16), padding: const EdgeInsets.only(bottom: 16),
children: [ children: [
?graphPreview,
Padding( Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text( child: Text(
@@ -9,10 +9,13 @@ import 'run_detail_tab.dart';
/// default, then the run Graph and the Timeline. Input and Output are /// default, then the run Graph and the Timeline. Input and Output are
/// collapsible Summary sections now, so their stable enum keys stay available /// collapsible Summary sections now, so their stable enum keys stay available
/// for old routes but they are not separate tabs. /// for old routes but they are not separate tabs.
/// The graph is a preview on Summary that opens full screen, so it has no tab
/// of its own; the run's artifacts and changes do.
const List<RunDetailTab> renderedRunDetailTabs = [ const List<RunDetailTab> renderedRunDetailTabs = [
RunDetailTab.summary, RunDetailTab.summary,
RunDetailTab.graph,
RunDetailTab.timeline, RunDetailTab.timeline,
RunDetailTab.artifacts,
RunDetailTab.changes,
]; ];
/// The run detail's platform tab strip: a Material segmented button or a /// The run detail's platform tab strip: a Material segmented button or a
@@ -27,11 +30,15 @@ class RunDetailTabStrip extends StatefulWidget {
super.key, super.key,
required this.selected, required this.selected,
required this.onSelected, required this.onSelected,
this.tabs = renderedRunDetailTabs,
}); });
final RunDetailTab selected; final RunDetailTab selected;
final ValueChanged<RunDetailTab> onSelected; final ValueChanged<RunDetailTab> onSelected;
/// The tabs this run offers, in [renderedRunDetailTabs] order.
final List<RunDetailTab> tabs;
@override @override
State<RunDetailTabStrip> createState() => _RunDetailTabStripState(); State<RunDetailTabStrip> createState() => _RunDetailTabStripState();
} }
@@ -75,7 +82,7 @@ class _RunDetailTabStripState extends State<RunDetailTabStrip> {
Widget _materialControl() => SegmentedButton<RunDetailTab>( Widget _materialControl() => SegmentedButton<RunDetailTab>(
segments: [ segments: [
for (final tab in renderedRunDetailTabs) for (final tab in widget.tabs)
ButtonSegment(value: tab, label: _label(tab)), ButtonSegment(value: tab, label: _label(tab)),
], ],
selected: {widget.selected}, selected: {widget.selected},
@@ -90,7 +97,7 @@ class _RunDetailTabStripState extends State<RunDetailTabStrip> {
groupValue: widget.selected, groupValue: widget.selected,
onValueChanged: widget.onSelected, onValueChanged: widget.onSelected,
children: { children: {
for (final tab in renderedRunDetailTabs) for (final tab in widget.tabs)
tab: Padding( tab: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
child: _label(tab), child: _label(tab),
+54 -5
View File
@@ -4,7 +4,12 @@ import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart'; import '../../../core/api_gateway.dart';
import '../../graph/widgets/run_graph_view.dart'; import '../../graph/widgets/run_graph_view.dart';
import '../../artifacts/ui/artifact_gallery_action.dart';
import '../../artifacts/ui/artifact_gallery_page.dart';
import '../../changes/changes.dart';
import 'run_changes_action.dart';
import 'run_detail_content.dart'; import 'run_detail_content.dart';
import 'run_graph_preview.dart';
import 'run_detail_tab.dart'; import 'run_detail_tab.dart';
import 'run_detail_tab_bodies.dart'; import 'run_detail_tab_bodies.dart';
import 'run_detail_tab_strip.dart'; import 'run_detail_tab_strip.dart';
@@ -166,8 +171,9 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
// The key is not a recorded visit. Only a stage the pinned graph actually // The key is not a recorded visit. Only a stage the pinned graph actually
// declares can be selected; anything else leaves the plain detail intact. // declares can be selected; anything else leaves the plain detail intact.
if (detailVisitHasDefinition(detailGraph(widget.run), stageKey)) { if (detailVisitHasDefinition(detailGraph(widget.run), stageKey)) {
// The Summary's graph preview shows the selected stage.
_selectedStage = stageKey; _selectedStage = stageKey;
_tab = RunDetailTab.graph; _tab = RunDetailTab.summary;
} else { } else {
_selectedStage = null; _selectedStage = null;
} }
@@ -243,8 +249,25 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
void _closeVisit() => setState(() => _selectedVisit = null); void _closeVisit() => setState(() => _selectedVisit = null);
/// Artifacts once the run has recorded steps; Changes once it has stopped
/// executing, since a snapshot would not follow live captures.
List<RunDetailTab> _tabsFor(JsonMap run) => [
for (final tab in renderedRunDetailTabs)
if (switch (tab) {
RunDetailTab.artifacts => showRunArtifactsAction(run),
RunDetailTab.changes => showRunChangesAction(run),
_ => true,
})
tab,
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final tabs = _tabsFor(widget.run);
// A tab the run no longer offers falls back to Summary.
final shown = tabs.contains(_tab) || !renderedRunDetailTabs.contains(_tab)
? _tab
: RunDetailTab.summary;
return LayoutBuilder( return LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final headerLimit = _headerLimit(constraints); final headerLimit = _headerLimit(constraints);
@@ -260,7 +283,8 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
children: [ children: [
widget.header, widget.header,
RunDetailTabStrip( RunDetailTabStrip(
selected: _tab, tabs: tabs,
selected: shown,
onSelected: (tab) => setState(() => _tab = tab), onSelected: (tab) => setState(() => _tab = tab),
), ),
], ],
@@ -272,7 +296,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
// never asked for an unbounded extent. // never asked for an unbounded extent.
Expanded( Expanded(
key: ValueKey('run-detail-body-${widget.run['id']}'), key: ValueKey('run-detail-body-${widget.run['id']}'),
child: _body(), child: _body(shown),
), ),
], ],
); );
@@ -280,8 +304,8 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
); );
} }
Widget _body() { Widget _body(RunDetailTab tab) {
switch (_tab) { switch (tab) {
case RunDetailTab.summary: case RunDetailTab.summary:
return runDetailSummaryTab( return runDetailSummaryTab(
context: context, context: context,
@@ -292,6 +316,12 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
onCopy: widget.onCopy, onCopy: widget.onCopy,
inputController: _inputSection, inputController: _inputSection,
outputController: _outputSection, outputController: _outputSection,
graphPreview: RunGraphPreview(
graph: detailGraph(widget.run),
run: widget.run,
selectedStage: _selectedStage,
onStageSelected: _openStage,
),
); );
case RunDetailTab.graph: case RunDetailTab.graph:
return RunGraphView( return RunGraphView(
@@ -315,6 +345,25 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
empty: 'No output recorded.', empty: 'No output recorded.',
cupertino: widget.cupertino, cupertino: widget.cupertino,
); );
case RunDetailTab.artifacts:
return ArtifactGalleryPage(
key: ValueKey('run-detail-artifacts-${widget.run['id']}'),
steps: runDetailArtifactSteps(widget.run),
executing: runDetailExecuting(widget.run),
configuredEndpoint: widget.configuredEndpoint,
embedded: true,
);
case RunDetailTab.changes:
final viewer = ChangesViewer(
key: ValueKey('run-detail-changes-${widget.run['id']}'),
steps: runDetailChangeSteps(widget.run),
showSummary: showRunChangesSummary(widget.run['status']),
);
// A CupertinoApp supplies no Material theme; follow the host so the
// viewer's section text stays readable.
return widget.cupertino
? Theme(data: hostTextTheme(context), child: viewer)
: viewer;
case RunDetailTab.timeline: case RunDetailTab.timeline:
final visits = detailTimeline(widget.run['steps']); final visits = detailTimeline(widget.run['steps']);
final index = _selectedVisit; final index = _selectedVisit;
@@ -0,0 +1,120 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../graph/widgets/run_graph_view.dart';
const runGraphPreviewKey = ValueKey<String>('run-graph-preview');
/// The run graph as a still picture on top of Summary. Tapping it opens the
/// interactive graph full screen; picking a stage there closes it and hands
/// the stage to [onStageSelected].
class RunGraphPreview extends StatelessWidget {
const RunGraphPreview({
super.key,
required this.graph,
required this.run,
required this.onStageSelected,
this.selectedStage,
this.height = 200,
});
final JsonMap? graph;
final JsonMap run;
final ValueChanged<String> onStageSelected;
final String? selectedStage;
final double height;
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final border = cupertino
? CupertinoColors.separator.resolveFrom(context)
: Theme.of(context).colorScheme.outlineVariant;
return Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Semantics(
button: true,
label: 'Run graph, open full screen',
excludeSemantics: true,
onTap: () => _open(context, cupertino),
child: GestureDetector(
key: runGraphPreviewKey,
behavior: HitTestBehavior.opaque,
onTap: () => _open(context, cupertino),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(color: border),
borderRadius: BorderRadius.circular(12),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: SizedBox(
height: height,
child: Stack(
children: [
Positioned.fill(
// A picture, not a control: the full-screen view is
// where the graph pans, zooms and opens stages.
child: IgnorePointer(
child: RunGraphView(
graph: graph,
run: run,
selectedStage: selectedStage,
onStageSelected: (_) {},
showHeader: false,
),
),
),
PositionedDirectional(
end: 8,
bottom: 8,
child: Icon(
cupertino
? CupertinoIcons.fullscreen
: Icons.open_in_full,
size: 18,
color: border,
),
),
],
),
),
),
),
),
),
);
}
Future<void> _open(BuildContext context, bool cupertino) {
Widget graphView(BuildContext pageContext) => RunGraphView(
key: const Key('run-detail-graph'),
graph: graph,
run: run,
selectedStage: selectedStage,
onStageSelected: (stage) {
Navigator.of(pageContext).pop();
onStageSelected(stage);
},
);
return Navigator.of(context).push<void>(
cupertino
? CupertinoPageRoute<void>(
builder: (page) => CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('Graph'),
),
child: SafeArea(child: graphView(page)),
),
)
: MaterialPageRoute<void>(
builder: (page) => Scaffold(
appBar: AppBar(title: const Text('Graph')),
body: SafeArea(top: false, child: graphView(page)),
),
),
);
}
}
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_gallery_action.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart'; import 'package:pipelines_app/features/runs/data/runs_repository.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
import 'package:pipelines_app/features/runs/ui/runs_controller.dart'; import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
@@ -104,8 +103,15 @@ void main() {
addTearDown(controller.dispose); addTearDown(controller.dispose);
await _pumpDetail(tester, platform, controller, gateway); await _pumpDetail(tester, platform, controller, gateway);
expect(find.byKey(runArtifactsButtonKey), findsOneWidget); expect(
await tester.tap(find.byKey(runArtifactsButtonKey)); find.byKey(const ValueKey('run-detail-tab-artifacts')),
findsOneWidget,
);
await tester.ensureVisible(
find.byKey(const ValueKey('run-detail-tab-artifacts')),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Artifacts · 2 recorded'), findsOneWidget); expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
@@ -123,7 +129,10 @@ void main() {
final controller = await _loaded(gateway); final controller = await _loaded(gateway);
addTearDown(controller.dispose); addTearDown(controller.dispose);
await _pumpDetail(tester, _Platform.material, controller, gateway); await _pumpDetail(tester, _Platform.material, controller, gateway);
expect(find.byKey(runArtifactsButtonKey), findsNothing); expect(
find.byKey(const ValueKey('run-detail-tab-artifacts')),
findsNothing,
);
}); });
testWidgets('a recorded empty capture keeps its explicit wording', ( testWidgets('a recorded empty capture keeps its explicit wording', (
@@ -138,7 +147,13 @@ void main() {
addTearDown(controller.dispose); addTearDown(controller.dispose);
await _pumpDetail(tester, _Platform.material, controller, gateway); await _pumpDetail(tester, _Platform.material, controller, gateway);
await tester.tap(find.byKey(runArtifactsButtonKey)); await tester.ensureVisible(
find.byKey(const ValueKey('run-detail-tab-artifacts')),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('No artifacts recorded for this run.'), findsOneWidget); expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
}); });
@@ -153,7 +168,13 @@ void main() {
addTearDown(controller.dispose); addTearDown(controller.dispose);
await _pumpDetail(tester, _Platform.material, controller, gateway); await _pumpDetail(tester, _Platform.material, controller, gateway);
await tester.tap(find.byKey(runArtifactsButtonKey)); await tester.ensureVisible(
find.byKey(const ValueKey('run-detail-tab-artifacts')),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Artifacts · capture unavailable'), findsOneWidget); expect(find.text('Artifacts · capture unavailable'), findsOneWidget);
expect(find.text('No artifacts recorded for this run.'), findsNothing); expect(find.text('No artifacts recorded for this run.'), findsNothing);
@@ -4,7 +4,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/changes/changes.dart'; import 'package:pipelines_app/features/changes/changes.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart'; import 'package:pipelines_app/features/runs/data/runs_repository.dart';
import 'package:pipelines_app/features/runs/ui/run_changes_action.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
import 'package:pipelines_app/features/runs/ui/runs_controller.dart'; import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
@@ -103,7 +102,13 @@ void main() {
await controller.select(9); await controller.select(9);
await _pumpDetail(tester, platform, controller, gateway); await _pumpDetail(tester, platform, controller, gateway);
await tester.tap(find.byKey(runChangesButtonKey)); await tester.ensureVisible(
find.byKey(const ValueKey('run-detail-tab-changes')),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('run-detail-tab-changes')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Changes'), findsOneWidget); expect(find.text('Changes'), findsOneWidget);
@@ -145,14 +150,17 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('lib/feature.dart'), findsOneWidget); expect(find.text('lib/feature.dart'), findsOneWidget);
if (platform == _Platform.material) { // Changes is a tab: Summary is one tap away and the run stays open.
await tester.tap(find.byTooltip('Back')); final summaryTab = find.byKey(const ValueKey('run-detail-tab-summary'));
} else { await tester.ensureVisible(summaryTab);
await tester.tap(find.byType(CupertinoNavigationBarBackButton)); await tester.pumpAndSettle();
} await tester.tap(summaryTab);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Wiring run'), findsOneWidget); expect(find.text('Wiring run'), findsOneWidget);
expect(find.byKey(runChangesButtonKey), findsOneWidget); expect(
find.byKey(const ValueKey('run-detail-tab-changes')),
findsOneWidget,
);
expect(find.text('lib/feature.dart'), findsNothing); expect(find.text('lib/feature.dart'), findsNothing);
}, },
); );
@@ -175,7 +183,13 @@ void main() {
await controller.select(9); await controller.select(9);
await _pumpDetail(tester, platform, controller, gateway); await _pumpDetail(tester, platform, controller, gateway);
await tester.tap(find.byKey(runChangesButtonKey)); await tester.ensureVisible(
find.byKey(const ValueKey('run-detail-tab-changes')),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('run-detail-tab-changes')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Changes · capture unavailable'), findsOneWidget); expect(find.text('Changes · capture unavailable'), findsOneWidget);
expect(find.text(diagnostic), findsWidgets); expect(find.text(diagnostic), findsWidgets);
@@ -94,7 +94,11 @@ Future<void> _openChanges(
Brightness brightness = Brightness.light, Brightness brightness = Brightness.light,
}) async { }) async {
await _pumpDetail(tester, platform, run, brightness: brightness); await _pumpDetail(tester, platform, run, brightness: brightness);
await tester.tap(find.byKey(runChangesButtonKey)); await tester.ensureVisible(
find.byKey(const ValueKey('run-detail-tab-changes')),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('run-detail-tab-changes')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
} }
@@ -163,7 +167,10 @@ void main() {
// The opened page would not follow live captures, so an executing run // The opened page would not follow live captures, so an executing run
// has no action until the live visit pane can show them. // has no action until the live visit pane can show them.
expect(find.byKey(runChangesButtonKey), findsNothing); expect(
find.byKey(const ValueKey('run-detail-tab-changes')),
findsNothing,
);
expect(find.text('Changes'), findsNothing); expect(find.text('Changes'), findsNothing);
expect(tester.takeException(), isNull); expect(tester.takeException(), isNull);
}, },
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart';
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart'; import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart'; import 'package:pipelines_app/features/runs/data/runs_repository.dart';
@@ -212,9 +213,12 @@ void main() {
await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'audit'); await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'audit');
expect(find.byKey(const Key('run-visit-pane')), findsNothing); expect(find.byKey(const Key('run-visit-pane')), findsNothing);
expect(find.byKey(const Key('run-detail-graph')), findsOneWidget); // Summary's graph preview shows the stage selected.
final graph = tester.widget<RunGraphView>( final graph = tester.widget<RunGraphView>(
find.byKey(const Key('run-detail-graph')), find.descendant(
of: find.byKey(runGraphPreviewKey),
matching: find.byType(RunGraphView),
),
); );
expect(graph.selectedStage, 'audit'); expect(graph.selectedStage, 'audit');
}); });
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart';
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart'; import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart'; import 'package:pipelines_app/features/runs/data/runs_repository.dart';
@@ -126,6 +127,15 @@ Finder runDetailTab(RunDetailTab tab) =>
find.byKey(ValueKey('run-detail-tab-${tab.name}')); find.byKey(ValueKey('run-detail-tab-${tab.name}'));
Future<void> openRunDetailTab(WidgetTester tester, RunDetailTab tab) async { Future<void> openRunDetailTab(WidgetTester tester, RunDetailTab tab) async {
// The graph has no tab: Summary shows it as a preview that opens full screen.
if (tab == RunDetailTab.graph) {
if (find.byKey(runGraphPreviewKey).evaluate().isEmpty) {
await openRunDetailTab(tester, RunDetailTab.summary);
}
await tester.tap(find.byKey(runGraphPreviewKey));
await tester.pumpAndSettle();
return;
}
await tester.ensureVisible(runDetailTab(tab)); await tester.ensureVisible(runDetailTab(tab));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(runDetailTab(tab)); await tester.tap(runDetailTab(tab));
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart';
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart'; import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart'; import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
@@ -14,16 +15,26 @@ void main() {
) async { ) async {
await pumpRunDetail(tester, platform); await pumpRunDetail(tester, platform);
// The graph is a preview on Summary; artifacts and changes are tabs.
expect(renderedRunDetailTabs, [ expect(renderedRunDetailTabs, [
RunDetailTab.summary, RunDetailTab.summary,
RunDetailTab.graph,
RunDetailTab.timeline, RunDetailTab.timeline,
RunDetailTab.artifacts,
RunDetailTab.changes,
]); ]);
for (final label in ['Summary', 'Graph', 'Timeline']) {
expect(find.text(label), findsOneWidget);
}
// Input and Output are Summary sections now, never separate tabs.
final strip = find.byKey(const Key('run-detail-tabs')); final strip = find.byKey(const Key('run-detail-tabs'));
for (final label in ['Summary', 'Timeline', 'Artifacts', 'Changes']) {
expect(
find.descendant(of: strip, matching: find.text(label)),
findsOneWidget,
);
}
expect(
find.descendant(of: strip, matching: find.text('Graph')),
findsNothing,
);
expect(find.byKey(runGraphPreviewKey), findsOneWidget);
// Input and Output are Summary sections now, never separate tabs.
for (final label in ['Input', 'Output']) { for (final label in ['Input', 'Output']) {
expect( expect(
find.descendant(of: strip, matching: find.text(label)), find.descendant(of: strip, matching: find.text(label)),
@@ -40,11 +51,21 @@ void main() {
// The strip lines up with the header's 16px inset on both hosts: the // The strip lines up with the header's 16px inset on both hosts: the
// first label sits within its segment's own padding of that inset, not // first label sits within its segment's own padding of that inset, not
// behind a second 16px control inset (which put it at 48 on Cupertino). // behind a second 16px control inset (which put it at 48 on Cupertino).
expect(tester.getTopLeft(find.text('Summary')).dx, lessThan(40)); expect(
tester
.getTopLeft(
find.descendant(of: strip, matching: find.text('Summary')),
)
.dx,
// Segments share the widest label's width, so a short first label
// sits a little in from its edge; a doubled inset would be 48+.
lessThan(46),
);
for (final tab in [ for (final tab in [
RunDetailTab.graph,
RunDetailTab.timeline, RunDetailTab.timeline,
RunDetailTab.artifacts,
RunDetailTab.changes,
RunDetailTab.summary, RunDetailTab.summary,
]) { ]) {
await openRunDetailTab(tester, tab); await openRunDetailTab(tester, tab);