Files
pipelines/app/test/features/runs/ui/run_detail_tabs_test.dart
T
alan a6db4ba20e App: run tabs under the header on wide layouts, stable Artifacts tab, spelled-out pipeline status, shared list selection, code block header and edge fades
- Run detail: on a wide window (>= 840, pane >= 600) the tabs are Material
  segments under the run header; phones keep the floating bottom bar.
  Artifacts is always a tab, badged with its count and disabled with 0 (its
  tooltip says why), so Changes never moves.
- Pipelines list: 'Failed · last run 19 Oct' beside the status dot; facts on
  the next line; compact rows keep 'Failed · 19 Oct'.
- Settings: Disconnect is outlined beside a tonal Reconnect.
- Lists: one selection style (tonal fill plus one leading accent bar) for
  runs, pipelines and chats; chat's border, fill and pointer removed.
- Transcript: overflowing blocks fade at the edge with a chevron instead of
  a 'Scroll horizontally' line (semantics hint kept); code blocks get a
  header strip with language and Copy; lighter light-mode code fill.
- Runs list: rows under a day heading show only the time of day.
- Artifact search reveal re-centres once the lazy list's extent settles.

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

192 lines
7.1 KiB
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/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';
import 'package:pipelines_app/features/runs/ui/run_detail_tab_strip.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
import 'run_detail_graph_support.dart';
void main() {
for (final platform in RunDetailTestPlatform.values) {
testWidgets('${platform.name} tabs keep the web order and the actions', (
tester,
) async {
await pumpRunDetail(tester, platform);
// The graph is a preview on Summary; artifacts and changes are tabs.
expect(renderedRunDetailTabs, [
RunDetailTab.summary,
RunDetailTab.timeline,
RunDetailTab.artifacts,
RunDetailTab.changes,
]);
final strip = find.byKey(const Key('run-detail-tabs'));
// Icon-only tabs, each keyed by its name.
for (final name in ['summary', 'timeline', 'artifacts', 'changes']) {
expect(
find.descendant(
of: strip,
matching: find.byKey(ValueKey('run-detail-tab-$name')),
),
findsOneWidget,
);
}
expect(
find.descendant(
of: strip,
matching: find.byKey(const ValueKey('run-detail-tab-graph')),
),
findsNothing,
);
expect(find.byKey(runGraphPreviewKey), findsOneWidget);
// Input and Output are Summary sections now, never separate tabs.
for (final name in ['input', 'output']) {
expect(
find.descendant(
of: strip,
matching: find.byKey(ValueKey('run-detail-tab-$name')),
),
findsNothing,
);
}
var previous = double.negativeInfinity;
for (final tab in renderedRunDetailTabs) {
final center = tester.getCenter(runDetailTab(tab));
expect(center.dx, greaterThan(previous));
previous = center.dx;
}
expect(find.byKey(runMoreMenuKey), findsOneWidget);
// On this wide 900px detail the tabs are Material segments under the
// run header, at the top of the detail, not a floating bottom bar.
final row = tester.getRect(strip);
final header = tester.getRect(find.byKey(const Key('run-detail-header')));
expect(find.byType(SegmentedButton<RunDetailTab>), findsOneWidget);
expect(
find.descendant(
of: strip,
matching: find.byKey(FloatingDestinationBar.rowKey),
),
findsNothing,
);
expect(row.top, greaterThan(header.top));
expect(row.bottom, lessThanOrEqualTo(header.bottom));
expect(row.top, lessThan(1000 / 3));
for (final tab in [
RunDetailTab.timeline,
RunDetailTab.artifacts,
RunDetailTab.changes,
RunDetailTab.summary,
]) {
await openRunDetailTab(tester, tab);
expect(find.byKey(runMoreMenuKey), findsOneWidget);
expect(find.text('Graph run'), findsOneWidget);
}
});
testWidgets('${platform.name} tabs float full width on a phone and at '
'the right edge when wide, over content that scrolls behind them', (
tester,
) async {
await pumpRunDetail(tester, platform, size: const Size(390, 844));
final strip = find.byKey(const Key('run-detail-tabs'));
final pill = tester.getRect(
find.descendant(
of: strip,
matching: find.byKey(FloatingDestinationBar.rowKey),
),
);
final body = find.byKey(const Key('run-detail-tab-body-summary'));
// Sized to its labelled tabs at the right, floating above the bottom.
expect(pill.width, lessThan(390 * 0.85));
expect(pill.right, 390 - 16);
expect(pill.bottom, 844 - 16);
// The tab's content reaches the bottom edge, behind the bar.
expect(tester.getRect(body).bottom, 844);
// Every tab is on screen without scrolling the bar.
for (final tab in renderedRunDetailTabs) {
final rect = tester.getRect(runDetailTab(tab));
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
}
// At rest after scrolling to the end, the last content clears the bar.
final scrollable = find.descendant(
of: body,
matching: find.byType(Scrollable),
);
final position = tester.state<ScrollableState>(scrollable.first).position;
position.jumpTo(position.maxScrollExtent);
await tester.pumpAndSettle();
expect(
MediaQuery.paddingOf(tester.element(body)).bottom,
greaterThanOrEqualTo(844 - pill.top),
);
// Wide, the tabs move to the top under the header; the content still
// fills the pane and starts below them at rest.
await pumpRunDetail(tester, platform, size: const Size(1000, 844));
final wideTabs = tester.getRect(strip);
expect(wideTabs.top, lessThan(844 / 3));
expect(
find.descendant(
of: strip,
matching: find.byKey(FloatingDestinationBar.rowKey),
),
findsNothing,
);
expect(tester.getRect(body).left, 0);
expect(tester.getRect(body).width, 1000);
expect(
MediaQuery.paddingOf(tester.element(body)).top,
greaterThanOrEqualTo(wideTabs.bottom),
);
});
testWidgets('${platform.name} missing graph states the exact wording', (
tester,
) async {
await pumpRunDetail(tester, platform, run: graphRunFixture(graph: false));
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', (
tester,
) async {
await pumpRunDetail(
tester,
platform,
size: const Size(320, 568),
scale: 2,
);
await openRunDetailTab(tester, RunDetailTab.graph);
expect(tester.takeException(), isNull);
final slot = tester.getSize(find.byType(RunGraphView));
expect(slot.height, greaterThan(0));
expect(slot.width, lessThanOrEqualTo(320));
expect(find.byType(InteractiveViewer), findsOneWidget);
expect(find.text(runGraphExecuted), findsOneWidget);
expect(find.text(runGraphNotExecuted), findsOneWidget);
});
}
}