Merge branch 'worktree-agent-a99db48531c8c963c' into integrate/floating-tabs

This commit is contained in:
2026-10-31 01:51:13 +00:00
35 changed files with 1197 additions and 702 deletions
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/screen.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
@@ -47,7 +48,7 @@ Future<void> _pumpShell(WidgetTester tester, Size size) async {
void main() {
for (final size in [const Size(1280, 800), const Size(800, 830)]) {
testWidgets('a wide window keeps the rail and list beside the open chat '
testWidgets('a wide window keeps the tab bar and list beside the open chat '
'at $size', (tester) async {
await _pumpShell(tester, size);
expect(find.text('Select a chat to open it here.'), findsOneWidget);
@@ -60,7 +61,8 @@ void main() {
await tester.pumpAndSettle();
final navigator = tester.state<NavigatorState>(find.byType(Navigator));
expect(navigator.canPop(), isFalse, reason: 'No page covers the shell');
expect(find.byType(NavigationRail), findsOneWidget);
expect(find.byType(NavigationRail), findsNothing);
expect(find.byType(FloatingDestinationBar), findsOneWidget);
expect(find.byKey(const ValueKey('chat-thread-a')), findsOneWidget);
expect(find.text('Second chat'), findsOneWidget);
expect(
@@ -1,11 +1,9 @@
import 'dart:ui' show PointerDeviceKind;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_styles.dart';
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
void main() {
testWidgets('code-like values still use native host typography', (
@@ -30,7 +28,7 @@ void main() {
for (final cupertino in [false, true]) {
for (final width in [320.0, 390.0, 720.0, 1200.0]) {
testWidgets('native tabs at $width, 2x, Cupertino=$cupertino', (
testWidgets('floating tabs at $width, 2x, Cupertino=$cupertino', (
tester,
) async {
tester.view.physicalSize = Size(width, 640);
@@ -38,7 +36,7 @@ void main() {
addTearDown(tester.view.reset);
PipelineDetailTab? selected;
final body = Align(
alignment: Alignment.topLeft,
alignment: Alignment.bottomCenter,
child: PipelineDetailTabs(
selected: PipelineDetailTab.summary,
onSelected: (value) => selected = value,
@@ -62,30 +60,27 @@ void main() {
),
);
await tester.pumpAndSettle();
// The host's own tab bar inside the shared glass pill.
expect(
cupertino
? find.byType(CupertinoSegmentedControl<PipelineDetailTab>)
: find.byType(SegmentedButton<PipelineDetailTab>),
find.byType(cupertino ? CupertinoTabBar : NavigationBar),
findsOneWidget,
);
for (final tab in PipelineDetailTab.values) {
final paragraph = tester.renderObject<RenderParagraph>(
find.text(tab.label),
);
expect(
paragraph.size.width,
greaterThanOrEqualTo(
paragraph.getMaxIntrinsicWidth(double.infinity) - 0.01,
),
reason: 'Whole labels must not be squeezed inside a native segment',
);
final pill = tester.getRect(find.byType(GlassPill));
if (width < 600) {
expect(pill.left, 16);
expect(pill.right, width - 16);
} else {
// Sized to its three tabs at the right edge.
expect(pill.right, width - 16);
expect(pill.width, lessThan(width * 0.6));
}
for (final tab in PipelineDetailTab.values) {
final rect = tester.getRect(
find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')),
);
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
}
await tester.drag(
find.byType(SingleChildScrollView),
const Offset(-1000, 0),
kind: PointerDeviceKind.mouse,
);
await tester.pumpAndSettle();
await tester.tap(find.text('Source'));
await tester.pumpAndSettle();
expect(selected, PipelineDetailTab.source);
@@ -8,7 +8,6 @@ import 'package:pipelines_app/features/pipelines/pipeline_repository.dart';
import 'package:pipelines_app/features/pipelines/pipelines_controller.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_panel.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
@@ -127,8 +126,12 @@ void main() {
expect(find.byType(CupertinoActionSheet), findsNothing);
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pumpAndSettle();
// The tabs are the floating glass Cupertino tab bar.
expect(
find.byType(CupertinoSegmentedControl<PipelineDetailTab>),
find.descendant(
of: find.byKey(const Key('pipeline-detail-tabs')),
matching: find.byType(CupertinoTabBar),
),
findsOneWidget,
);
expect(find.byType(CupertinoListTile), findsWidgets);
@@ -73,13 +73,16 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.text(decisionWaitingTitle), findsOneWidget);
// The web's decision banner spans the header, with Decide trailing.
// The web's decision banner spans the header at its 16px inset, with
// Decide trailing.
final banner = tester.getRect(
find.byKey(const Key('run-decision-banner')),
);
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
expect(banner.left, tabs.left);
expect(banner.width, greaterThanOrEqualTo(tabs.width));
final pane = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
expect(banner.left, pane.left + 16);
expect(banner.right, pane.right - 16);
expect(
tester.getCenter(find.byKey(decisionActionKey)).dx,
greaterThan(banner.center.dx),
@@ -5,6 +5,7 @@ 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/glass_pill.dart';
import 'run_detail_graph_support.dart';
@@ -48,19 +49,15 @@ void main() {
previous = center.dx;
}
expect(find.byKey(runMoreMenuKey), findsOneWidget);
// 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.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),
// 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.byType(GlassPill)),
);
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,
@@ -74,30 +71,50 @@ void main() {
}
});
testWidgets('${platform.name} phone tabs sit at the bottom, wide ones '
'under the header', (tester) async {
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 = tester.getRect(find.byKey(const Key('run-detail-tabs')));
final body = tester.getRect(
find.byKey(const Key('run-detail-tab-body-summary')),
final strip = find.byKey(const Key('run-detail-tabs'));
final pill = tester.getRect(
find.descendant(of: strip, matching: find.byType(GlassPill)),
);
expect(strip.top, greaterThanOrEqualTo(body.bottom));
expect(strip.bottom, greaterThan(844 - 80));
final body = find.byKey(const Key('run-detail-tab-body-summary'));
// Full width minus the margins, floating above the bottom.
expect(pill.left, 16);
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(0), reason: tab.name);
expect(rect.right, lessThanOrEqualTo(390), reason: tab.name);
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 wideStrip = tester.getRect(
find.byKey(const Key('run-detail-tabs')),
final widePill = tester.getRect(
find.descendant(of: strip, matching: find.byType(GlassPill)),
);
final wideBody = tester.getRect(
find.byKey(const Key('run-detail-tab-body-summary')),
);
expect(wideStrip.bottom, lessThanOrEqualTo(wideBody.top));
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 spans the width.
expect(tester.getRect(body).width, 1000);
});
testWidgets('${platform.name} missing graph states the exact wording', (
@@ -6,6 +6,7 @@ import 'package:pipelines_app/features/graph/widgets/stage_definition_view.dart'
import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
import 'package:pipelines_app/ui/layout/sticky_section.dart';
import 'run_detail_graph_support.dart';
@@ -236,6 +237,22 @@ void main() {
final strip = tester.getRect(find.byType(RunVisitSectionStrip));
expect(strip.bottom, size.height, reason: section.name);
}
// The floating glass bar: full width on a phone, sized to its tabs
// at the right edge of a wide page.
final pill = tester.getRect(
find.descendant(
of: find.byType(RunVisitSectionStrip),
matching: find.byType(GlassPill),
),
);
expect(pill.right, size.width - 16);
expect(pill.bottom, size.height - 16);
if (size.width < 600) {
expect(pill.left, 16);
} else {
// (The test font draws every glyph a full em wide.)
expect(pill.width, lessThan(size.width * 0.7));
}
},
);
}