377ff04aaf
Replace the single glass pill (host NavigationBar/CupertinoTabBar with one gliding highlight) with a row of separate circular GlassPill buttons, 52/50 px with 12/10 px gaps, at the same bottom-right place. The selected button fills with the host selection tint and cross-fades; each button pops in on its own, staggered, only when the bar appears or its tabs change; presses sink like the top bar's. Tab semantics, keys, tooltips and badges are kept; the row shares one BackdropGroup for its blurs.
190 lines
6.9 KiB
Dart
190 lines
6.9 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);
|
|
// The tabs are the floating glass bar: on this 900px detail it is sized
|
|
// to its tabs at the right edge, above the bottom.
|
|
final pill = tester.getRect(
|
|
find.descendant(
|
|
of: strip,
|
|
matching: find.byKey(FloatingDestinationBar.rowKey),
|
|
),
|
|
);
|
|
expect(pill.right, 900 - 16);
|
|
expect(pill.bottom, 1000 - 16);
|
|
// (The test font draws every glyph a full em wide.)
|
|
expect(pill.width, lessThan(900 * 0.7));
|
|
|
|
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 tabs at the right, floating above the bottom.
|
|
expect(
|
|
pill.width,
|
|
FloatingDestinationBar.rowWidth(
|
|
cupertino: platform != RunDetailTestPlatform.material,
|
|
tabs: renderedRunDetailTabs.length,
|
|
),
|
|
);
|
|
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),
|
|
);
|
|
|
|
await pumpRunDetail(tester, platform, size: const Size(1000, 844));
|
|
final widePill = tester.getRect(
|
|
find.descendant(
|
|
of: strip,
|
|
matching: find.byKey(FloatingDestinationBar.rowKey),
|
|
),
|
|
);
|
|
expect(widePill.right, 1000 - 16);
|
|
expect(widePill.bottom, 844 - 16);
|
|
expect(widePill.width, lessThan(1000 * 0.6));
|
|
// Beside the bar the content takes taps: the body fills the pane.
|
|
expect(tester.getRect(body).left, 0);
|
|
expect(tester.getRect(body).width, 1000);
|
|
});
|
|
|
|
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);
|
|
});
|
|
}
|
|
}
|