environment_monitoring_app/test/widget_test.dart

29 lines
956 B
Dart

// This is a basic Flutter widget test.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
// Import main.dart to get access to the SplashScreen widget
import 'package:environment_monitoring_app/main.dart';
void main() {
testWidgets('SplashScreen smoke test', (WidgetTester tester) async {
// Build the SplashScreen widget directly.
// We wrap it in a MaterialApp to provide the necessary structure
// (like text direction) that widgets like Text() need to render.
await tester.pumpWidget(
const MaterialApp(
home: SplashScreen(),
),
);
// Verify that the SplashScreen shows its loading text.
expect(find.text('Loading MMS data...'), findsOneWidget);
// Verify it shows the CircularProgressIndicator.
expect(find.byType(CircularProgressIndicator), findsOneWidget);
// Verify it shows the Image.
expect(find.byType(Image), findsOneWidget);
});
}