69 lines
2.4 KiB
Dart
69 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:ground_suite/app/app.dart';
|
|
import 'package:ground_suite/app/app_shell.dart';
|
|
import 'package:ground_suite/shared/widgets/glass_panel.dart';
|
|
|
|
void main() {
|
|
testWidgets('replay workspace keeps diagnostics distinct and read-only', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(const ProviderScope(child: GroundSuiteApp()));
|
|
await tester.pumpAndSettle();
|
|
|
|
final app = tester.widget<MaterialApp>(find.byType(MaterialApp));
|
|
expect(app.themeMode, ThemeMode.system);
|
|
expect(app.theme?.brightness, Brightness.light);
|
|
expect(app.darkTheme?.brightness, Brightness.dark);
|
|
expect(find.byType(GlassPanel), findsAtLeastNWidgets(1));
|
|
expect(find.text('Observation only'), findsOneWidget);
|
|
expect(find.text('Replay fixture'), findsAtLeastNWidgets(1));
|
|
expect(find.text('Vehicle identity'), findsOneWidget);
|
|
|
|
await tester.tap(find.byIcon(Icons.receipt_long_outlined));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('Diagnostics'), findsAtLeastNWidgets(1));
|
|
await tester.tap(find.text('Errors'));
|
|
await tester.pumpAndSettle();
|
|
expect(
|
|
find.text('kaptan_drivers::lidar_lite_v3::error::Error::TransferFault'),
|
|
findsOneWidget,
|
|
);
|
|
|
|
await tester.tap(find.text('Shutdowns'));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('Orderly shutdown observed'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets(
|
|
'compact desktop layout uses bottom navigation without overflow',
|
|
(tester) async {
|
|
await tester.binding.setSurfaceSize(const Size(480, 800));
|
|
addTearDown(() => tester.binding.setSurfaceSize(null));
|
|
|
|
await tester.pumpWidget(const ProviderScope(child: GroundSuiteApp()));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.byType(NavigationBar), findsOneWidget);
|
|
expect(tester.takeException(), isNull);
|
|
},
|
|
);
|
|
|
|
testWidgets('follows a dark system preference', (tester) async {
|
|
tester.binding.platformDispatcher.platformBrightnessTestValue =
|
|
Brightness.dark;
|
|
addTearDown(
|
|
tester.binding.platformDispatcher.clearPlatformBrightnessTestValue,
|
|
);
|
|
|
|
await tester.pumpWidget(const ProviderScope(child: GroundSuiteApp()));
|
|
await tester.pumpAndSettle();
|
|
|
|
final context = tester.element(find.byType(AppShell));
|
|
expect(Theme.of(context).brightness, Brightness.dark);
|
|
});
|
|
}
|