0e5a06ae88
Product: - Settings jump index scrolls instead of overflowing a short wide window (overflowed by 48 px at 1200x800 once Open in chat added a section). - Chat: a route to the retained workspace's active pane shows it in the same frame again;ec3c1e4cdeferred it a frame behind a post-frame callback. Tests updated to intended behaviour: - first-run walkthrough (30ba70ad): seed a device that has seen it and was offered it for the fixture server; - Output section open by default (22af093e); - chat page Back closes its own route explicitly (19b1d132); - open-chat sync (c48a1559): answer chat_open_workspace statefully; - keyed session list (0a51add9) no longer re-reads chat_sessions on open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
2.9 KiB
Dart
86 lines
2.9 KiB
Dart
import '../features/settings/settings_section_test_helper.dart';
|
|
import 'dart:convert';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/application/pipelines_app.dart';
|
|
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
|
import '../features/pipelines/fixtures.dart';
|
|
import 'pipelines_app_test.dart'
|
|
show walkthroughDonePreferences, webServer, requestOf;
|
|
import 'pipelines_replies.dart';
|
|
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
|
|
|
void main() {
|
|
testWidgets('Settings shares socket and one native bar', (tester) async {
|
|
// A device that has seen the first-run walkthrough: no dialog over the
|
|
// Pipelines page absorbs the bar tap.
|
|
SharedPreferences.setMockInitialValues(walkthroughDonePreferences());
|
|
final channel = FakeChannel()..readyCompleter.complete();
|
|
var sockets = 0;
|
|
final client = PipelinesClient(
|
|
channelFactory: (_) {
|
|
sockets++;
|
|
return channel;
|
|
},
|
|
);
|
|
final provider = PlatformRouteInformationProvider(
|
|
initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')),
|
|
);
|
|
addTearDown(provider.dispose);
|
|
await tester.pumpWidget(
|
|
PipelinesApp(
|
|
androidSupported: false,
|
|
server: webServer(),
|
|
client: client,
|
|
routeInformationProvider: provider,
|
|
),
|
|
);
|
|
await tester.pump();
|
|
expect(
|
|
requestOf(channel, 'ping'),
|
|
isNull,
|
|
reason: 'Unvisited settings must not issue hidden requests',
|
|
);
|
|
await replyPipelines(tester, channel, PipelineFixture());
|
|
|
|
await tester.tap(find.byKey(const ValueKey('shell.destination.settings')));
|
|
await tester.pump();
|
|
await tester.pump();
|
|
expect(provider.value.uri.path, '/settings');
|
|
expect(find.text('Quick switch animation'), findsOneWidget);
|
|
await openSettingsSection(tester, 'Connection');
|
|
expect(find.text('Server URL'), findsOneWidget);
|
|
expect(find.text('Settings — Not implemented'), findsNothing);
|
|
expect(sockets, 1);
|
|
expect(find.byType(SegmentedBar), findsOneWidget);
|
|
final ping = requestOf(channel, 'ping')!;
|
|
channel.incoming.add(
|
|
jsonEncode({
|
|
'id': ping['id'],
|
|
'type': 'pong',
|
|
'build': {'version': 'settings-fixture'},
|
|
'time': 'fixture time',
|
|
'protocol': 2,
|
|
}),
|
|
);
|
|
await tester.pump();
|
|
await tester.pump();
|
|
expect(find.textContaining('settings-fixture'), findsOneWidget);
|
|
expect(
|
|
find.text(
|
|
'Protocol mismatch: this page speaks protocol 1, '
|
|
'the server reports 2.',
|
|
),
|
|
findsOneWidget,
|
|
reason: 'a mismatched server must stay visibly flagged in Settings',
|
|
);
|
|
expect(tester.takeException(), isNull);
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
await tester.pump();
|
|
});
|
|
}
|