import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:moody/main.dart' as app; import 'icon_finder.dart'; import 'package:moody/views/settings_page/widgets/set_pin_popup_widget.dart'; import 'package:moody/views/settings_page/widgets/text_switch_container_widget.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() { SharedPreferences.setMockInitialValues({}); IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('SettingsPage UI Test', (WidgetTester tester) async { app.main(); await tester.pumpAndSettle(); await tester.tap(find.text('skip')); await tester.pumpAndSettle(); // Navigate to the SettingsPage if it's not the initial page await tester.tap(findIconByAsset('icon-settings.png')); await tester.pumpAndSettle(); // Verify that certain widgets are present expect(find.text('settings'), findsOneWidget); expect(find.text('change color'), findsOneWidget); expect(find.text('pin'), findsOneWidget); // Test tapping on a switch final Finder pinSwitch = find.byType(TextSwitchContainer).first; await tester.tap(pinSwitch); await tester.pumpAndSettle(); // Test navigation to another page await tester.tap(find.text('about us')); await tester.pumpAndSettle(); // Verify navigation occurred if there's a distinct widget on the navigated page // Test showing the Set PIN Popup await tester.tap(find.text('pin')); await tester.pump(); // Might need to adjust depending on the implementation expect(find.byType(SetPinPopup), findsOneWidget); }); }