Remove Templates from Settings
Keep the Templates destination available through its direct routes while removing the obsolete Settings entry and wiring. Update navigation coverage and document the preserved route behavior.
This commit is contained in:
@@ -8,7 +8,7 @@ import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
import '../features/pipelines/fixtures.dart';
|
||||
import 'pipelines_replies.dart';
|
||||
import 'templates_wiring_test.dart' show openSettings, openTemplates, pumpApp;
|
||||
import 'templates_wiring_test.dart' show pumpApp, readTemplates;
|
||||
|
||||
/// The app-level Templates page: one bar (Back + Refresh), the gallery and an
|
||||
/// open template reach the top edge, start below the bar at rest and scroll
|
||||
@@ -23,8 +23,10 @@ void main() {
|
||||
addTearDown(provider.dispose);
|
||||
await pumpApp(tester, channel: channel, client: client, provider: provider);
|
||||
await replyPipelines(tester, channel, PipelineFixture());
|
||||
await openSettings(tester, channel, provider);
|
||||
await openTemplates(tester, channel, provider);
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/templates')),
|
||||
);
|
||||
await readTemplates(tester, channel);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final bar = find.ancestor(
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/pipelines_app.dart';
|
||||
import 'package:pipelines_app/application/templates_destination.dart';
|
||||
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
||||
import 'package:pipelines_app/features/settings/settings_keys.dart';
|
||||
import 'package:pipelines_app/features/templates/screen.dart';
|
||||
import 'package:pipelines_app/features/templates/ui/template_create_wording.dart';
|
||||
import 'package:pipelines_app/features/templates/ui/template_detail.dart'
|
||||
@@ -18,7 +17,6 @@ import '../features/templates/ui/template_gallery_test_support.dart'
|
||||
show GalleryGateway, galleryTemplates, pumpGallery, templatesReply;
|
||||
import 'pipelines_app_test.dart' show webServer;
|
||||
import 'pipelines_replies.dart';
|
||||
import '../features/settings/settings_topic_test_helper.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
List<Map<String, dynamic>> requestsOf(FakeChannel channel, String type) =>
|
||||
@@ -85,38 +83,13 @@ Future<void> pumpApp(
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
Future<void> openSettings(
|
||||
/// Answers the reads a Templates page makes when it opens by route.
|
||||
Future<void> readTemplates(
|
||||
WidgetTester tester,
|
||||
FakeChannel channel,
|
||||
PlatformRouteInformationProvider provider,
|
||||
) async {
|
||||
await tester.tap(find.byKey(const Key('pipelines-open-settings')));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/settings');
|
||||
// Settings pings the shared socket; answer it so later reads are not queued.
|
||||
await reply(tester, channel, 'ping', 1, {
|
||||
'type': 'pong',
|
||||
'build': {'version': 'probe'},
|
||||
'time': 'fixture',
|
||||
});
|
||||
// Hidden notification settings do not load during this navigation flow.
|
||||
expect(requestsOf(channel, 'notification_settings'), isEmpty);
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
}
|
||||
|
||||
Future<void> openTemplates(
|
||||
WidgetTester tester,
|
||||
FakeChannel channel,
|
||||
PlatformRouteInformationProvider provider, {
|
||||
FakeChannel channel, {
|
||||
int listRead = 1,
|
||||
}) async {
|
||||
await selectSettingsTopic(tester, 'Tools');
|
||||
await tester.ensureVisible(find.byKey(SettingsKeys.templates));
|
||||
await tester.tap(find.byKey(SettingsKeys.templates));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 600));
|
||||
expect(provider.value.uri.path, '/templates');
|
||||
await reply(tester, channel, 'list_templates', listRead, {
|
||||
'type': 'templates',
|
||||
'templates': [
|
||||
@@ -129,6 +102,9 @@ Future<void> openTemplates(
|
||||
},
|
||||
],
|
||||
});
|
||||
// The shell's own ping shares the request queue; let it go out before the
|
||||
// gallery's validate reads, as the list read is followed by the shell's ping.
|
||||
await tester.pumpAndSettle();
|
||||
await reply(tester, channel, 'validate', listRead, {
|
||||
'type': 'graph',
|
||||
'graph': {'stages': <dynamic>[]},
|
||||
@@ -153,7 +129,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'Settings opens the embedded Templates page and Back restores it',
|
||||
'a /templates link opens the embedded page and Back restores Settings',
|
||||
(tester) async {
|
||||
final fixture = PipelineFixture();
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
@@ -176,14 +152,12 @@ void main() {
|
||||
provider: provider,
|
||||
);
|
||||
await replyPipelines(tester, channel, fixture);
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/templates')),
|
||||
);
|
||||
await readTemplates(tester, channel);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await openSettings(tester, channel, provider);
|
||||
// An edit that only Settings owns must survive the Templates detour.
|
||||
await tester.enterText(find.byType(EditableText).first, 'edited url');
|
||||
await tester.pump();
|
||||
expect(find.text('edited url'), findsOneWidget);
|
||||
|
||||
await openTemplates(tester, channel, provider);
|
||||
final screen = tester.widget<TemplatesScreen>(
|
||||
find.byType(TemplatesScreen),
|
||||
);
|
||||
@@ -214,8 +188,8 @@ void main() {
|
||||
expect(find.byKey(templateDetailBackKey), findsOneWidget);
|
||||
expect(find.byKey(templatesPageBackKey), findsNothing);
|
||||
|
||||
// Detail Back returns to the gallery, then the page Back restores the
|
||||
// same Settings state.
|
||||
// Detail Back returns to the gallery, then the page Back closes the
|
||||
// page to Settings.
|
||||
await tester.tap(find.byKey(templateDetailBackKey));
|
||||
await tester.pump();
|
||||
// The gallery hands the bar back to the page's Back on the next frame.
|
||||
@@ -225,15 +199,14 @@ void main() {
|
||||
|
||||
expect(provider.value.uri.path, '/settings');
|
||||
expect(find.byType(TemplatesScreen), findsNothing);
|
||||
expect(find.byKey(SettingsKeys.templates), findsOneWidget);
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
expect(find.text('edited url'), findsOneWidget);
|
||||
expect(find.text('Server URL'), findsOneWidget);
|
||||
expect(sockets, 1);
|
||||
expect(requestsOf(channel, 'ping'), hasLength(1));
|
||||
|
||||
// Browser Back from /templates follows the same close path.
|
||||
await openTemplates(tester, channel, provider, listRead: 2);
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/templates')),
|
||||
);
|
||||
await readTemplates(tester, channel, listRead: 2);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(TemplatesScreen), findsOneWidget);
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/settings')),
|
||||
@@ -241,9 +214,6 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/settings');
|
||||
expect(find.byType(TemplatesScreen), findsNothing);
|
||||
expect(find.byKey(SettingsKeys.templates), findsOneWidget);
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
expect(find.text('edited url'), findsOneWidget);
|
||||
expect(requestsOf(channel, 'list_templates'), hasLength(2));
|
||||
expect(sockets, 1);
|
||||
|
||||
@@ -271,13 +241,15 @@ void main() {
|
||||
|
||||
await pumpApp(tester, channel: channel, client: client, provider: provider);
|
||||
await replyPipelines(tester, channel, fixture);
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/templates')),
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('pipeline-row-41'), skipOffstage: false),
|
||||
findsNothing,
|
||||
);
|
||||
|
||||
await openSettings(tester, channel, provider);
|
||||
await openTemplates(tester, channel, provider);
|
||||
await readTemplates(tester, channel);
|
||||
await tester.tap(find.byKey(templateRowKey('release')));
|
||||
await tester.pump();
|
||||
await tester.tap(find.byKey(templateCreateActionKey));
|
||||
|
||||
Reference in New Issue
Block a user