From 855a1e6ca5d91e857c14f32d901b933cfcaa46dc Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 23 Oct 2026 16:55:24 +0100 Subject: [PATCH] feat(app): run detail tabs are Summary, Timeline, Artifacts and Changes; the graph is a Summary preview that opens full screen --- .../artifacts/ui/artifact_gallery_action.dart | 2 + .../artifacts/ui/artifact_gallery_page.dart | 6 + .../graph/widgets/run_graph_view.dart | 7 +- .../features/runs/ui/run_detail_actions.dart | 3 - .../runs/ui/run_detail_cupertino.dart | 2 - .../features/runs/ui/run_detail_material.dart | 2 - app/lib/features/runs/ui/run_detail_tab.dart | 4 +- .../runs/ui/run_detail_tab_bodies.dart | 3 + .../runs/ui/run_detail_tab_strip.dart | 13 +- app/lib/features/runs/ui/run_detail_tabs.dart | 59 ++++++++- .../features/runs/ui/run_graph_preview.dart | 120 ++++++++++++++++++ .../runs/ui/run_artifacts_action_test.dart | 33 ++++- .../runs/ui/run_changes_action_test.dart | 32 +++-- .../runs/ui/run_changes_status_test.dart | 11 +- .../runs/ui/run_detail_deep_link_test.dart | 8 +- .../runs/ui/run_detail_graph_support.dart | 10 ++ .../runs/ui/run_detail_tabs_test.dart | 35 ++++- 17 files changed, 307 insertions(+), 43 deletions(-) create mode 100644 app/lib/features/runs/ui/run_graph_preview.dart diff --git a/app/lib/features/artifacts/ui/artifact_gallery_action.dart b/app/lib/features/artifacts/ui/artifact_gallery_action.dart index 86a88d96..0cd7ebc6 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_action.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_action.dart @@ -31,6 +31,8 @@ bool showRunArtifactsAction(JsonMap run) => /// Whether the run is still executing, so the page can say capture pending /// instead of claiming nothing was recorded. +bool runDetailExecuting(JsonMap run) => _runExecuting(run); + bool _runExecuting(JsonMap run) => run['executing'] == true || _executingStatuses.contains('${run['status'] ?? ''}'.trim().toLowerCase()); diff --git a/app/lib/features/artifacts/ui/artifact_gallery_page.dart b/app/lib/features/artifacts/ui/artifact_gallery_page.dart index 9b819f8b..32e08d58 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_page.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_page.dart @@ -50,6 +50,7 @@ class ArtifactGalleryPage extends StatefulWidget { this.fetch = fetchArtifact, this.markdownBuilder = chatMarkdownText, this.fileBridge = const ArtifactFileBridge(), + this.embedded = false, }); final List steps; @@ -64,6 +65,10 @@ class ArtifactGalleryPage extends StatefulWidget { final ArtifactMarkdownBuilder markdownBuilder; 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 State createState() => _ArtifactGalleryPageState(); } @@ -378,6 +383,7 @@ class _ArtifactGalleryPageState extends State { selectedIdentity: _selectedIdentity, onSelected: _select, ); + if (widget.embedded) return body; if (usesCupertinoHost(context)) { return CupertinoPageScaffold( // Sections paint the grouped background; the page must match it or a diff --git a/app/lib/features/graph/widgets/run_graph_view.dart b/app/lib/features/graph/widgets/run_graph_view.dart index d2cc6789..f2a53419 100644 --- a/app/lib/features/graph/widgets/run_graph_view.dart +++ b/app/lib/features/graph/widgets/run_graph_view.dart @@ -46,6 +46,7 @@ class RunGraphView extends StatefulWidget { required this.onStageSelected, this.selectedStage, this.now, + this.showHeader = true, }); /// 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. final DateTime Function()? now; + /// False for a still preview, which has no room for the status legend. + final bool showHeader; + @override State createState() => _RunGraphViewState(); } @@ -193,7 +197,8 @@ class _RunGraphViewState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - RunGraphHeader(state: state, style: style, now: widget.now), + if (widget.showHeader) + RunGraphHeader(state: state, style: style, now: widget.now), Expanded( child: Stack( fit: StackFit.expand, diff --git a/app/lib/features/runs/ui/run_detail_actions.dart b/app/lib/features/runs/ui/run_detail_actions.dart index 2499f3c9..7a06c08c 100644 --- a/app/lib/features/runs/ui/run_detail_actions.dart +++ b/app/lib/features/runs/ui/run_detail_actions.dart @@ -1,7 +1,6 @@ import 'package:flutter/widgets.dart'; import '../../../core/api_gateway.dart'; -import '../../artifacts/ui/artifact_gallery_action.dart'; import '../actions/cancel_eligibility.dart'; import '../actions/cancel_run_action.dart'; import '../actions/retry_action.dart'; @@ -58,8 +57,6 @@ class RunDetailActions extends StatelessWidget { gateway: gateway, onRunChanged: onRunChanged, ), - if (showRunArtifactsAction(run)) - RunArtifactsButton(run: run, gateway: gateway), ], ), RunDecisionNotice(run: run, gateway: gateway, onRunChanged: onRunChanged), diff --git a/app/lib/features/runs/ui/run_detail_cupertino.dart b/app/lib/features/runs/ui/run_detail_cupertino.dart index 9a2bd54a..92eccb45 100644 --- a/app/lib/features/runs/ui/run_detail_cupertino.dart +++ b/app/lib/features/runs/ui/run_detail_cupertino.dart @@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart'; import '../../../core/api_gateway.dart'; import '../../../ui/status/run_status_icon.dart'; import '../domain/run_models.dart'; -import 'run_changes_action.dart'; import 'run_detail_content.dart'; import 'run_detail_tabs.dart'; import 'run_more_menu.dart'; @@ -66,7 +65,6 @@ Widget buildCupertinoRunDetail({ ], ), ), - if (showRunChangesAction(run)) RunChangesButton(run: run), if (copying) const CupertinoActivityIndicator(), RunMoreMenu( run: run, diff --git a/app/lib/features/runs/ui/run_detail_material.dart b/app/lib/features/runs/ui/run_detail_material.dart index 5bb1b711..a92e85be 100644 --- a/app/lib/features/runs/ui/run_detail_material.dart +++ b/app/lib/features/runs/ui/run_detail_material.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; import '../../../ui/status/run_status_icon.dart'; import '../domain/run_models.dart'; -import 'run_changes_action.dart'; import 'run_detail_content.dart'; import 'run_detail_tabs.dart'; import 'run_more_menu.dart'; @@ -62,7 +61,6 @@ Widget buildMaterialRunDetail({ icon: const Icon(Icons.arrow_back), label: const Text('Back to list'), ), - if (showRunChangesAction(run)) RunChangesButton(run: run), ], ), ), diff --git a/app/lib/features/runs/ui/run_detail_tab.dart b/app/lib/features/runs/ui/run_detail_tab.dart index 196caa8f..40e1bf00 100644 --- a/app/lib/features/runs/ui/run_detail_tab.dart +++ b/app/lib/features/runs/ui/run_detail_tab.dart @@ -9,7 +9,9 @@ enum RunDetailTab { graph('Graph'), input('Input'), output('Output'), - timeline('Timeline'); + timeline('Timeline'), + artifacts('Artifacts'), + changes('Changes'); const RunDetailTab(this.label); diff --git a/app/lib/features/runs/ui/run_detail_tab_bodies.dart b/app/lib/features/runs/ui/run_detail_tab_bodies.dart index 19ba07c3..09e1be28 100644 --- a/app/lib/features/runs/ui/run_detail_tab_bodies.dart +++ b/app/lib/features/runs/ui/run_detail_tab_bodies.dart @@ -25,6 +25,7 @@ Widget runDetailSummaryTab({ required VoidCallback onCopy, ExpansibleController? inputController, ExpansibleController? outputController, + Widget? graphPreview, }) { final rows = detailSummaryRows(run); final identity = detailSummaryIdentity(run); @@ -33,6 +34,7 @@ Widget runDetailSummaryTab({ return ListView( key: const Key('run-detail-tab-body-summary'), children: [ + ?graphPreview, _cupertinoIdentity(context, identity), if (rows.any((row) => !row.block)) CupertinoListSection.insetGrouped( @@ -69,6 +71,7 @@ Widget runDetailSummaryTab({ key: const Key('run-detail-tab-body-summary'), padding: const EdgeInsets.only(bottom: 16), children: [ + ?graphPreview, Padding( padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), child: Text( diff --git a/app/lib/features/runs/ui/run_detail_tab_strip.dart b/app/lib/features/runs/ui/run_detail_tab_strip.dart index a477b94b..a567a241 100644 --- a/app/lib/features/runs/ui/run_detail_tab_strip.dart +++ b/app/lib/features/runs/ui/run_detail_tab_strip.dart @@ -9,10 +9,13 @@ import 'run_detail_tab.dart'; /// default, then the run Graph and the Timeline. Input and Output are /// collapsible Summary sections now, so their stable enum keys stay available /// 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 renderedRunDetailTabs = [ RunDetailTab.summary, - RunDetailTab.graph, RunDetailTab.timeline, + RunDetailTab.artifacts, + RunDetailTab.changes, ]; /// The run detail's platform tab strip: a Material segmented button or a @@ -27,11 +30,15 @@ class RunDetailTabStrip extends StatefulWidget { super.key, required this.selected, required this.onSelected, + this.tabs = renderedRunDetailTabs, }); final RunDetailTab selected; final ValueChanged onSelected; + /// The tabs this run offers, in [renderedRunDetailTabs] order. + final List tabs; + @override State createState() => _RunDetailTabStripState(); } @@ -75,7 +82,7 @@ class _RunDetailTabStripState extends State { Widget _materialControl() => SegmentedButton( segments: [ - for (final tab in renderedRunDetailTabs) + for (final tab in widget.tabs) ButtonSegment(value: tab, label: _label(tab)), ], selected: {widget.selected}, @@ -90,7 +97,7 @@ class _RunDetailTabStripState extends State { groupValue: widget.selected, onValueChanged: widget.onSelected, children: { - for (final tab in renderedRunDetailTabs) + for (final tab in widget.tabs) tab: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: _label(tab), diff --git a/app/lib/features/runs/ui/run_detail_tabs.dart b/app/lib/features/runs/ui/run_detail_tabs.dart index 1b2f2f70..47a7443f 100644 --- a/app/lib/features/runs/ui/run_detail_tabs.dart +++ b/app/lib/features/runs/ui/run_detail_tabs.dart @@ -4,7 +4,12 @@ import 'package:flutter/material.dart'; import '../../../core/api_gateway.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_graph_preview.dart'; import 'run_detail_tab.dart'; import 'run_detail_tab_bodies.dart'; import 'run_detail_tab_strip.dart'; @@ -166,8 +171,9 @@ class _RunDetailTabsState extends State { // 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. if (detailVisitHasDefinition(detailGraph(widget.run), stageKey)) { + // The Summary's graph preview shows the selected stage. _selectedStage = stageKey; - _tab = RunDetailTab.graph; + _tab = RunDetailTab.summary; } else { _selectedStage = null; } @@ -243,8 +249,25 @@ class _RunDetailTabsState extends State { 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 _tabsFor(JsonMap run) => [ + for (final tab in renderedRunDetailTabs) + if (switch (tab) { + RunDetailTab.artifacts => showRunArtifactsAction(run), + RunDetailTab.changes => showRunChangesAction(run), + _ => true, + }) + tab, + ]; + @override 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( builder: (context, constraints) { final headerLimit = _headerLimit(constraints); @@ -260,7 +283,8 @@ class _RunDetailTabsState extends State { children: [ widget.header, RunDetailTabStrip( - selected: _tab, + tabs: tabs, + selected: shown, onSelected: (tab) => setState(() => _tab = tab), ), ], @@ -272,7 +296,7 @@ class _RunDetailTabsState extends State { // never asked for an unbounded extent. Expanded( key: ValueKey('run-detail-body-${widget.run['id']}'), - child: _body(), + child: _body(shown), ), ], ); @@ -280,8 +304,8 @@ class _RunDetailTabsState extends State { ); } - Widget _body() { - switch (_tab) { + Widget _body(RunDetailTab tab) { + switch (tab) { case RunDetailTab.summary: return runDetailSummaryTab( context: context, @@ -292,6 +316,12 @@ class _RunDetailTabsState extends State { onCopy: widget.onCopy, inputController: _inputSection, outputController: _outputSection, + graphPreview: RunGraphPreview( + graph: detailGraph(widget.run), + run: widget.run, + selectedStage: _selectedStage, + onStageSelected: _openStage, + ), ); case RunDetailTab.graph: return RunGraphView( @@ -315,6 +345,25 @@ class _RunDetailTabsState extends State { empty: 'No output recorded.', 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: final visits = detailTimeline(widget.run['steps']); final index = _selectedVisit; diff --git a/app/lib/features/runs/ui/run_graph_preview.dart b/app/lib/features/runs/ui/run_graph_preview.dart new file mode 100644 index 00000000..0cec876f --- /dev/null +++ b/app/lib/features/runs/ui/run_graph_preview.dart @@ -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('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 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 _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( + cupertino + ? CupertinoPageRoute( + builder: (page) => CupertinoPageScaffold( + navigationBar: const CupertinoNavigationBar( + middle: Text('Graph'), + ), + child: SafeArea(child: graphView(page)), + ), + ) + : MaterialPageRoute( + builder: (page) => Scaffold( + appBar: AppBar(title: const Text('Graph')), + body: SafeArea(top: false, child: graphView(page)), + ), + ), + ); + } +} diff --git a/app/test/features/runs/ui/run_artifacts_action_test.dart b/app/test/features/runs/ui/run_artifacts_action_test.dart index 1a654187..54468d9e 100644 --- a/app/test/features/runs/ui/run_artifacts_action_test.dart +++ b/app/test/features/runs/ui/run_artifacts_action_test.dart @@ -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/artifacts/ui/artifact_gallery_action.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/runs_controller.dart'; @@ -104,8 +103,15 @@ void main() { addTearDown(controller.dispose); await _pumpDetail(tester, platform, controller, gateway); - expect(find.byKey(runArtifactsButtonKey), findsOneWidget); - await tester.tap(find.byKey(runArtifactsButtonKey)); + expect( + 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(); expect(find.text('Artifacts · 2 recorded'), findsOneWidget); @@ -123,7 +129,10 @@ void main() { final controller = await _loaded(gateway); addTearDown(controller.dispose); 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', ( @@ -138,7 +147,13 @@ void main() { addTearDown(controller.dispose); 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(); expect(find.text('No artifacts recorded for this run.'), findsOneWidget); }); @@ -153,7 +168,13 @@ void main() { addTearDown(controller.dispose); 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(); expect(find.text('Artifacts · capture unavailable'), findsOneWidget); expect(find.text('No artifacts recorded for this run.'), findsNothing); diff --git a/app/test/features/runs/ui/run_changes_action_test.dart b/app/test/features/runs/ui/run_changes_action_test.dart index e81d1708..61560214 100644 --- a/app/test/features/runs/ui/run_changes_action_test.dart +++ b/app/test/features/runs/ui/run_changes_action_test.dart @@ -4,7 +4,6 @@ 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/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/runs_controller.dart'; @@ -103,7 +102,13 @@ void main() { await controller.select(9); 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(); expect(find.text('Changes'), findsOneWidget); @@ -145,14 +150,17 @@ void main() { await tester.pumpAndSettle(); expect(find.text('lib/feature.dart'), findsOneWidget); - if (platform == _Platform.material) { - await tester.tap(find.byTooltip('Back')); - } else { - await tester.tap(find.byType(CupertinoNavigationBarBackButton)); - } + // Changes is a tab: Summary is one tap away and the run stays open. + final summaryTab = find.byKey(const ValueKey('run-detail-tab-summary')); + await tester.ensureVisible(summaryTab); + await tester.pumpAndSettle(); + await tester.tap(summaryTab); await tester.pumpAndSettle(); 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); }, ); @@ -175,7 +183,13 @@ void main() { await controller.select(9); 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(); expect(find.text('Changes · capture unavailable'), findsOneWidget); expect(find.text(diagnostic), findsWidgets); diff --git a/app/test/features/runs/ui/run_changes_status_test.dart b/app/test/features/runs/ui/run_changes_status_test.dart index f9bacf2b..a21ca4b2 100644 --- a/app/test/features/runs/ui/run_changes_status_test.dart +++ b/app/test/features/runs/ui/run_changes_status_test.dart @@ -94,7 +94,11 @@ Future _openChanges( Brightness brightness = Brightness.light, }) async { 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(); } @@ -163,7 +167,10 @@ void main() { // The opened page would not follow live captures, so an executing run // 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(tester.takeException(), isNull); }, diff --git a/app/test/features/runs/ui/run_detail_deep_link_test.dart b/app/test/features/runs/ui/run_detail_deep_link_test.dart index f85b7843..b45ded91 100644 --- a/app/test/features/runs/ui/run_detail_deep_link_test.dart +++ b/app/test/features/runs/ui/run_detail_deep_link_test.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.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/features/graph/widgets/run_graph_view.dart'; import 'package:pipelines_app/features/runs/data/runs_repository.dart'; @@ -212,9 +213,12 @@ void main() { await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'audit'); 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( - find.byKey(const Key('run-detail-graph')), + find.descendant( + of: find.byKey(runGraphPreviewKey), + matching: find.byType(RunGraphView), + ), ); expect(graph.selectedStage, 'audit'); }); diff --git a/app/test/features/runs/ui/run_detail_graph_support.dart b/app/test/features/runs/ui/run_detail_graph_support.dart index 494547ab..6208a690 100644 --- a/app/test/features/runs/ui/run_detail_graph_support.dart +++ b/app/test/features/runs/ui/run_detail_graph_support.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.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/features/graph/widgets/graph_stage_node.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}')); Future 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.pumpAndSettle(); await tester.tap(runDetailTab(tab)); diff --git a/app/test/features/runs/ui/run_detail_tabs_test.dart b/app/test/features/runs/ui/run_detail_tabs_test.dart index f39561e0..51ff3e38 100644 --- a/app/test/features/runs/ui/run_detail_tabs_test.dart +++ b/app/test/features/runs/ui/run_detail_tabs_test.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.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/graph/widgets/run_graph_view.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart'; @@ -14,16 +15,26 @@ void main() { ) async { await pumpRunDetail(tester, platform); + // The graph is a preview on Summary; artifacts and changes are tabs. expect(renderedRunDetailTabs, [ RunDetailTab.summary, - RunDetailTab.graph, 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')); + 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']) { expect( 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 // 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). - 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 [ - RunDetailTab.graph, RunDetailTab.timeline, + RunDetailTab.artifacts, + RunDetailTab.changes, RunDetailTab.summary, ]) { await openRunDetailTab(tester, tab);