Merge commit '1dcef23db2233e9877163a782ae5bee7509ec8db' into pipelines/run-20261112-0152-chat-tab-re-tap-opens-the-active-chats-ff7a

This commit is contained in:
2026-11-12 03:20:45 +00:00
145 changed files with 5828 additions and 920 deletions
@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/application/app_terminals.dart';
import 'package:pipelines_app/features/terminal/terminal_layout.dart';
import 'package:pipelines_app/features/terminal/terminal_toggle_button.dart';
import '../features/terminal/terminal_fixtures.dart';
void main() {
late TerminalGateway gateway;
late AppTerminals terminals;
setUp(() {
gateway = TerminalGateway();
terminals = AppTerminals(
pool: null,
connection: ValueNotifier<int>(0),
connected: () => true,
gateway: gateway,
machineId: 'mac',
machineName: 'Mac',
layout: TerminalLayout(store: MemoryLayoutStore()),
);
});
tearDown(() {
terminals.dispose();
gateway.close();
});
/// Pumps [AppTerminals.barToggle] at [width] and returns what it built.
Future<Widget?> barToggleAt(WidgetTester tester, double width) async {
Widget? built;
await tester.pumpWidget(
MaterialApp(
home: MediaQuery(
data: MediaQueryData(size: Size(width, 800)),
child: Builder(
builder: (context) {
built = terminals.barToggle(context);
return const SizedBox.shrink();
},
),
),
),
);
return built;
}
testWidgets('the Chat shell bar offers the terminal toggle on a wide layout', (
tester,
) async {
final built = await barToggleAt(tester, 1000);
expect(built, isA<TerminalToggleButton>());
});
testWidgets('a narrow layout has no terminal toggle in the shell bar', (
tester,
) async {
// Covers both a narrow chat list and an open narrow chat: the open chat's
// own bar carries the terminal (terminal_chat_bar_action_test.dart).
final built = await barToggleAt(tester, 390);
expect(built, isNull);
});
}
@@ -285,12 +285,12 @@ void main() {
expect(find.byKey(const Key('chat-turn-activity')), findsOneWidget);
expect(find.text('Kept behind a native disclosure.'), findsNothing);
// The shell bar stays over the list and tabs; the open chat draws its
// own floating bar in its pane, with no Back: the list beside it is the
// way out.
// The destination rail sits at the left edge; the shell bar stays over
// the list, and the open chat draws its own floating bar in its pane,
// with no Back: the list beside it is the way out.
expect(find.byType(ChatSessionsScreen), findsOneWidget);
expect(find.byType(NavigationRail), findsNothing);
expect(find.byType(FloatingDestinationBar), findsOneWidget);
expect(find.byType(NavigationRail), findsOneWidget);
expect(find.byType(FloatingDestinationBar), findsNothing);
// The shell's bar and the conversation's own header.
expect(find.byType(SegmentedBar), findsNWidgets(2));
expect(find.byType(AppBar), findsNothing);
+57 -4
View File
@@ -13,9 +13,9 @@ import '../features/pipelines/fixtures.dart';
import 'pipelines_app_test.dart' show webServer;
import 'pipelines_replies.dart';
/// Settings is not a tab: it opens as a page from the gear in the Pipelines
/// bar, keeps its `/settings` route (and deep link), and closes back to
/// Pipelines. The tab bar keeps Pipelines selected meanwhile.
/// Settings is not a tab: it opens as a page (from the gear in the Pipelines
/// bar on a phone, from the rail's foot on a wide window), keeps its
/// `/settings` route (and deep link), and closes back to Pipelines. The tab bar keeps Pipelines selected meanwhile.
void main() {
Future<PlatformRouteInformationProvider> pumpApp(
WidgetTester tester, {
@@ -50,7 +50,9 @@ void main() {
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
.currentIndex;
for (final size in [const Size(390, 844), const Size(1200, 800)]) {
// A phone's Pipelines bar keeps the gear; a wide window's rail offers
// Settings instead (see the wide test below).
for (final size in [const Size(390, 844)]) {
testWidgets('${size.width}: the Pipelines bar gear opens Settings '
'as a page and Back returns', (tester) async {
final provider = await pumpApp(
@@ -101,6 +103,57 @@ void main() {
});
}
testWidgets('1200: the rail offers Settings at its foot and no gear is '
'left in the Pipelines toolbar; Settings is a page and Back returns', (
tester,
) async {
final provider = await pumpApp(
tester,
location: '/pipelines',
size: const Size(1200, 800),
);
expect(find.byType(NavigationRail), findsOneWidget);
expect(find.byKey(const Key('pipelines-open-settings')), findsNothing);
expect(find.byType(FloatingDestinationBar), findsNothing);
final rail = tester.widget<NavigationRail>(find.byType(NavigationRail));
expect(rail.selectedIndex, 0);
for (final label in ['Pipelines', 'Runs', 'Chat', 'Search', 'Settings']) {
expect(
find.descendant(
of: find.byType(NavigationRail),
matching: find.text(label),
),
findsOneWidget,
reason: label,
);
}
await tester.tap(find.byKey(const ValueKey('shell.destination.settings')));
await tester.pump();
await tester.pump();
expect(provider.value.uri.path, '/settings');
expect(find.byType(SettingsScreen), findsOneWidget);
// Settings is a page of Pipelines: the rail marks Settings, not a tab.
expect(
tester.widget<NavigationRail>(find.byType(NavigationRail)).selectedIndex,
isNull,
);
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
expect(tester.takeException(), isNull);
await tester.tap(find.byKey(const ValueKey('shell.back')));
await tester.pump();
await tester.pump();
expect(provider.value.uri.path, '/pipelines');
expect(find.byKey(const Key('pipelines-open-settings')), findsNothing);
expect(
tester.widget<NavigationRail>(find.byType(NavigationRail)).selectedIndex,
0,
);
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
});
testWidgets('the /settings deep link opens the Settings page and '
'the system Back closes it to Pipelines', (tester) async {
final provider = await pumpApp(
@@ -179,11 +179,9 @@ void main() {
final before = tester.widget<PipelinesScreen>(find.byType(PipelinesScreen));
expect(before.initialPipelineId, 1);
final pipelineState = tester.state(find.byType(PipelinesScreen));
await tapBarAction(
tester,
find.byKey(const Key('pipelines-open-settings')),
'Settings',
);
// Wide: the rail offers Settings (the toolbar gear is gone).
expect(find.byKey(const Key('pipelines-open-settings')), findsNothing);
await tester.tap(find.byKey(const ValueKey('shell.destination.settings')));
await tester.pumpAndSettle();
expect(app.provider.value.uri.path, '/settings');
final hidden = find.byType(PipelinesScreen, skipOffstage: false);