mirror of
https://github.com/Dvorinka/1356.git
synced 2026-06-05 04:22:55 +00:00
feat: Complete Phase 1 - Full Flutter app implementation with comprehensive features
Version: 1.1.0 Major changes: - Implemented complete Flutter app structure with all core features - Added comprehensive UI screens for auth, countdown, goals, profile, settings, and social features - Integrated Supabase backend with authentication and data repositories - Added offline support with Hive caching and local storage - Implemented comprehensive routing with go_router - Added location services with Google Maps integration - Implemented notifications and home widget support - Added voice recording capabilities and AI chat features - Created comprehensive test suite and documentation - Added Android and iOS platform configurations - Implemented achievements system and social features - Added calendar integration and bucket list functionality This represents a complete Phase 1 milestone with 3,775 additions across 31 files.
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/auth/application/auth_controller.dart';
|
||||
import 'package:lifetimer/features/auth/presentation/auth_gate.dart';
|
||||
import 'package:lifetimer/features/auth/presentation/auth_choice_screen.dart';
|
||||
import 'package:lifetimer/features/onboarding/presentation/onboarding_intro_screen.dart';
|
||||
import 'package:lifetimer/data/models/user_model.dart';
|
||||
import 'package:lifetimer/data/repositories/auth_repository.dart';
|
||||
|
||||
class MockAuthRepository extends AuthRepository {
|
||||
bool _isAuthenticated = false;
|
||||
|
||||
MockAuthRepository() : super(null);
|
||||
|
||||
@override
|
||||
User? get currentUser => _isAuthenticated ? TestData.createTestUser() : null;
|
||||
|
||||
@override
|
||||
Stream<User?> get authStateChanges => Stream.value(currentUser);
|
||||
|
||||
@override
|
||||
bool get isAuthenticated => _isAuthenticated;
|
||||
|
||||
@override
|
||||
String? get currentUserId => currentUser?.id;
|
||||
|
||||
@override
|
||||
Future<void> signInWithEmail(String email, String password) async {}
|
||||
|
||||
@override
|
||||
Future<void> signUpWithEmail(String email, String password, String username) async {}
|
||||
|
||||
@override
|
||||
Future<void> signInWithGoogle() async {}
|
||||
|
||||
@override
|
||||
Future<void> signInWithApple() async {}
|
||||
|
||||
@override
|
||||
Future<void> signOut() async {}
|
||||
|
||||
@override
|
||||
Future<void> resetPassword(String email) async {}
|
||||
|
||||
@override
|
||||
Future<bool> isSessionValid() async => true;
|
||||
|
||||
@override
|
||||
Future<void> refreshSession() async {}
|
||||
|
||||
@override
|
||||
Future<void> updateProfile({
|
||||
String? username,
|
||||
String? bio,
|
||||
String? avatarUrl,
|
||||
bool? isPublicProfile,
|
||||
}) async {}
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
}
|
||||
|
||||
class TestData {
|
||||
static User createTestUser() {
|
||||
return User(
|
||||
id: 'test-user-id',
|
||||
username: 'testuser',
|
||||
email: 'test@example.com',
|
||||
createdAt: DateTime.now(),
|
||||
updatedAt: DateTime.now(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
group('AuthGate Widget', () {
|
||||
testWidgets('should show AuthChoiceScreen when user is not authenticated',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
authRepositoryProvider.overrideWithValue(MockAuthRepository()),
|
||||
],
|
||||
child: const MaterialApp(
|
||||
home: AuthGate(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(AuthChoiceScreen), findsOneWidget);
|
||||
expect(find.byType(OnboardingIntroScreen), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should show OnboardingIntroScreen when user is authenticated',
|
||||
(WidgetTester tester) async {
|
||||
final mockRepo = MockAuthRepository();
|
||||
mockRepo._isAuthenticated = true;
|
||||
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
authRepositoryProvider.overrideWithValue(mockRepo),
|
||||
],
|
||||
child: const MaterialApp(
|
||||
home: AuthGate(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(OnboardingIntroScreen), findsOneWidget);
|
||||
expect(find.byType(AuthChoiceScreen), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/auth/presentation/sign_in_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('SignInScreen Widget', () {
|
||||
testWidgets('should display email and password fields',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Welcome back'), findsOneWidget);
|
||||
expect(find.text('Sign in to continue your journey'), findsOneWidget);
|
||||
expect(find.byType(TextFormField), findsNWidgets(2));
|
||||
expect(find.text('Email'), findsOneWidget);
|
||||
expect(find.text('Password'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show sign in button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Sign In'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show forgot password button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Forgot password?'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show sign up link', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text("Don't have an account?"), findsOneWidget);
|
||||
expect(find.text('Sign Up'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should validate email field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find email field
|
||||
final emailField = find.widgetWithText(TextFormField, 'Email');
|
||||
await tester.enterText(emailField, 'invalid-email');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Try to submit
|
||||
final signInButton = find.text('Sign In');
|
||||
await tester.tap(signInButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show validation error
|
||||
expect(find.text('Please enter a valid email address'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should validate password field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find password field
|
||||
final passwordField = find.widgetWithText(TextFormField, 'Password');
|
||||
await tester.enterText(passwordField, '123');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Try to submit
|
||||
final signInButton = find.text('Sign In');
|
||||
await tester.tap(signInButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show validation error
|
||||
expect(find.text('Password must be at least 6 characters'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should toggle password visibility',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignInScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find password visibility toggle button
|
||||
final toggleButton = find.byIcon(Icons.visibility_off);
|
||||
expect(toggleButton, findsOneWidget);
|
||||
|
||||
await tester.tap(toggleButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should now show visibility icon
|
||||
expect(find.byIcon(Icons.visibility), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/auth/presentation/sign_up_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('SignUpScreen Widget', () {
|
||||
testWidgets('should display username, email, and password fields',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Create your account'), findsOneWidget);
|
||||
expect(find.text('Start your 1356-day journey'), findsOneWidget);
|
||||
expect(find.byType(TextFormField), findsNWidgets(3));
|
||||
expect(find.text('Username'), findsOneWidget);
|
||||
expect(find.text('Email'), findsOneWidget);
|
||||
expect(find.text('Password'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show sign up button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Sign Up'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show sign in link', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Already have an account?'), findsOneWidget);
|
||||
expect(find.text('Sign In'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should validate username field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find username field
|
||||
final usernameField = find.widgetWithText(TextFormField, 'Username');
|
||||
await tester.enterText(usernameField, 'ab');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Try to submit
|
||||
final signUpButton = find.text('Sign Up');
|
||||
await tester.tap(signUpButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show validation error
|
||||
expect(find.text('Username must be at least 3 characters'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should validate email field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find email field
|
||||
final emailField = find.widgetWithText(TextFormField, 'Email');
|
||||
await tester.enterText(emailField, 'invalid-email');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Try to submit
|
||||
final signUpButton = find.text('Sign Up');
|
||||
await tester.tap(signUpButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show validation error
|
||||
expect(find.text('Please enter a valid email address'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should validate password field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find password field
|
||||
final passwordField = find.widgetWithText(TextFormField, 'Password');
|
||||
await tester.enterText(passwordField, '123');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Try to submit
|
||||
final signUpButton = find.text('Sign Up');
|
||||
await tester.tap(signUpButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show validation error
|
||||
expect(find.text('Password must be at least 6 characters'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should toggle password visibility',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Find password visibility toggle button
|
||||
final toggleButton = find.byIcon(Icons.visibility_off);
|
||||
expect(toggleButton, findsOneWidget);
|
||||
|
||||
await tester.tap(toggleButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should now show visibility icon
|
||||
expect(find.byIcon(Icons.visibility), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show Google sign up button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Sign up with Google'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should show Apple sign up button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SignUpScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Sign up with Apple'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/countdown/presentation/bucket_list_confirmation_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('BucketListConfirmationScreen Widget', () {
|
||||
testWidgets('should display confirmation title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: BucketListConfirmationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Finalize Your Bucket List'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display goals count', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: BucketListConfirmationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('goals'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display warning message', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: BucketListConfirmationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('cannot be paused'), findsOneWidget);
|
||||
expect(find.textContaining('cannot be reset'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display start countdown button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: BucketListConfirmationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Start 1356-Day Challenge'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display review goals button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: BucketListConfirmationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Review Goals'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display countdown duration info',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: BucketListConfirmationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('1356'), findsOneWidget);
|
||||
expect(find.textContaining('years'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/countdown/presentation/home_countdown_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('HomeCountdownScreen Widget', () {
|
||||
testWidgets('should display countdown timer', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should display countdown components
|
||||
expect(find.byType(Scaffold), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display days remaining', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should display large countdown display
|
||||
expect(find.textContaining('days'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display progress indicator', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should have progress visualization
|
||||
expect(find.byType(CircularProgressIndicator), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display motivational message',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show motivational text
|
||||
expect(find.textContaining('Make every day count'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display view goals button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('View My Goals'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display hours, minutes, seconds breakdown',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should display time breakdown
|
||||
expect(find.textContaining('h'), findsOneWidget);
|
||||
expect(find.textContaining('m'), findsOneWidget);
|
||||
expect(find.textContaining('s'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display percentage completed',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: HomeCountdownScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('%'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/goals/presentation/goal_detail_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('GoalDetailScreen Widget', () {
|
||||
testWidgets('should display goal detail title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should display goal detail view
|
||||
expect(find.byType(Scaffold), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display progress slider', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should have progress controls
|
||||
expect(find.byType(Slider), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display mark as completed button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Mark as Completed'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display edit button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byIcon(Icons.edit), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display delete button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byIcon(Icons.delete), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display milestones list', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Milestones'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display progress percentage',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalDetailScreen(goalId: 'test-goal-id'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('%'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/goals/presentation/goal_edit_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('GoalEditScreen Widget', () {
|
||||
testWidgets('should display goal edit title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Add Goal'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display title field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Title'), findsOneWidget);
|
||||
expect(find.byType(TextFormField), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('should display description field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Description'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display save button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Save Goal'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display cancel button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Cancel'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should validate title field', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Try to save without title
|
||||
final saveButton = find.text('Save Goal');
|
||||
await tester.tap(saveButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show validation error
|
||||
expect(find.text('Goal title is required'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display location picker', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Add Location'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display image picker', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Add Image'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display milestones section',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalEditScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Milestones'), findsOneWidget);
|
||||
expect(find.text('Add Milestone'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/goals/presentation/goals_list_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('GoalsListScreen Widget', () {
|
||||
testWidgets('should display goals list title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalsListScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('My Goals'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display add goal button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalsListScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Add Goal'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display goals counter', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalsListScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('/20'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display empty state when no goals',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalsListScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should show empty state message
|
||||
expect(find.textContaining('No goals'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display start countdown button when goals exist',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: MaterialApp(
|
||||
home: GoalsListScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// The button might not be visible until goals are added
|
||||
// This test verifies the structure is in place
|
||||
expect(find.byType(FloatingActionButton), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/onboarding/presentation/onboarding_how_it_works_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('OnboardingHowItWorksScreen Widget', () {
|
||||
testWidgets('should display how it works title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingHowItWorksScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('How It Works'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display bucket list step', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingHowItWorksScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('bucket list'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display countdown step', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingHowItWorksScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('countdown'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display next button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingHowItWorksScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Next'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display back button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingHowItWorksScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Back'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display step indicators', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingHowItWorksScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should have step indicators
|
||||
expect(find.byType(Container), findsWidgets);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/onboarding/presentation/onboarding_intro_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('OnboardingIntroScreen Widget', () {
|
||||
testWidgets('should display welcome message', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingIntroScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Welcome to LifeTimer'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display 1356-day challenge description',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingIntroScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('1356'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display get started button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingIntroScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Get Started'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display skip button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingIntroScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Skip'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display page indicator', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingIntroScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should have page indicators (dots)
|
||||
expect(find.byType(Container), findsWidgets);
|
||||
});
|
||||
});
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/onboarding/presentation/onboarding_motivation_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('OnboardingMotivationScreen Widget', () {
|
||||
testWidgets('should display motivation title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingMotivationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Your Journey Awaits'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display motivational message',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingMotivationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('goals'), findsOneWidget);
|
||||
expect(find.textContaining('dreams'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display start challenge button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingMotivationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Start Your Challenge'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display back button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingMotivationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Back'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display step indicators', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: OnboardingMotivationScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should have step indicators
|
||||
expect(find.byType(Container), findsWidgets);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/profile/presentation/profile_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('ProfileScreen Widget', () {
|
||||
testWidgets('should display profile title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Profile'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display user avatar', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(CircleAvatar), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display username', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Should display username section
|
||||
expect(find.textContaining('Username'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display countdown information',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Days Left'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display goals completed stat',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Goals Completed'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display edit profile button',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Edit Profile'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display settings button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Settings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display sign out button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: ProfileScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Sign Out'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/settings/presentation/about_challenge_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('AboutChallengeScreen Widget', () {
|
||||
testWidgets('should display about challenge title',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: AboutChallengeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('About the 1356-Day Challenge'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display challenge description',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: AboutChallengeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('1356'), findsOneWidget);
|
||||
expect(find.textContaining('days'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display bucket list explanation',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: AboutChallengeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('bucket list'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display countdown rules', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: AboutChallengeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('cannot be paused'), findsOneWidget);
|
||||
expect(find.textContaining('cannot be reset'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display motivation section', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: AboutChallengeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Make every day count'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display close button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: AboutChallengeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Close'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/settings/presentation/notification_settings_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('NotificationSettingsScreen Widget', () {
|
||||
testWidgets('should display notification settings title',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Notification Settings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display daily reminder option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Daily Reminder'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display weekly reminder option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Weekly Reminder'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display milestone notifications option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Milestone Notifications'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display countdown checkpoint notifications',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Countdown Checkpoints'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display toggle switches', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(Switch), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('should display save button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: NotificationSettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Save'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/settings/presentation/privacy_settings_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('PrivacySettingsScreen Widget', () {
|
||||
testWidgets('should display privacy settings title',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Privacy Settings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display profile visibility toggle',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Public Profile'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display visibility description',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Make your profile visible'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display private profile description',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Only you can see'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display public profile description',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Others can see'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display visibility toggle switch',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(Switch), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display save button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: PrivacySettingsScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Save'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lifetimer/features/settings/presentation/settings_home_screen.dart';
|
||||
|
||||
void main() {
|
||||
group('SettingsHomeScreen Widget', () {
|
||||
testWidgets('should display settings title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Settings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display account section', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Account'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display preferences section',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Preferences'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display privacy section', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Privacy'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display about section', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('About'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display account settings option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Account Settings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display notification settings option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Notifications'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display privacy settings option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Privacy Settings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display about challenge option',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const ProviderScope(
|
||||
child: const MaterialApp(
|
||||
home: SettingsHomeScreen(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('About the Challenge'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user