3136e5bb7e
Replace the tabbed Settings flow with a single grouped page that searches and lazily loads server-backed sections. Preserve existing settings behavior while adding inline loading and retry states and updating coverage for the new navigation model.
69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/core/transport/pipelines_client.dart'
|
|
as transport;
|
|
import 'package:pipelines_app/features/settings/settings_keys.dart';
|
|
import 'package:pipelines_app/features/settings/settings_screen.dart';
|
|
import 'package:pipelines_app/features/settings/settings_store.dart';
|
|
|
|
import 'fake_channel.dart';
|
|
import 'settings_section_test_helper.dart';
|
|
|
|
/// The Library section lists Schedules only: Templates left
|
|
/// Settings, and Schedules keeps its own route.
|
|
void main() {
|
|
Future<void> pump(
|
|
WidgetTester tester, {
|
|
VoidCallback? onOpenSchedules,
|
|
}) async {
|
|
await tester.binding.setSurfaceSize(const Size(560, 1000));
|
|
addTearDown(() => tester.binding.setSurfaceSize(null));
|
|
final factory = FakeChannelFactory();
|
|
final client = transport.PipelinesClient(channelFactory: factory.call);
|
|
addTearDown(client.dispose);
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: SettingsScreen(
|
|
client: client,
|
|
store: MemorySettingsStore(),
|
|
embedded: true,
|
|
onOpenSchedules: onOpenSchedules,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
if (onOpenSchedules != null) await openSettingsSection(tester, 'Library');
|
|
}
|
|
|
|
testWidgets('Library offers Schedules and no Templates entry', (
|
|
tester,
|
|
) async {
|
|
var opened = 0;
|
|
await pump(tester, onOpenSchedules: () => opened++);
|
|
|
|
expect(find.text('Library'), findsOneWidget);
|
|
expect(find.text('Browse templates'), findsNothing);
|
|
expect(
|
|
find.byKey(const ValueKey<String>('settings.templates')),
|
|
findsNothing,
|
|
);
|
|
|
|
await tester.ensureVisible(find.byKey(SettingsKeys.schedules));
|
|
await tester.tap(find.byKey(SettingsKeys.schedules));
|
|
await tester.pump();
|
|
expect(opened, 1);
|
|
});
|
|
|
|
testWidgets('without a Schedules route the Library group is absent', (
|
|
tester,
|
|
) async {
|
|
await pump(tester);
|
|
|
|
expect(find.text('Library'), findsNothing);
|
|
expect(find.text('Browse templates'), findsNothing);
|
|
expect(find.byKey(SettingsKeys.schedules), findsNothing);
|
|
});
|
|
}
|