forked from eatvio/eatvio_app
38 lines
1.6 KiB
Dart
38 lines
1.6 KiB
Dart
import 'package:eatvio_app/app_keys.dart';
|
|
import 'package:eatvio_app/core/app_initializer.dart';
|
|
import 'package:eatvio_app/main.dart' as app;
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:integration_test/integration_test.dart';
|
|
import '../common_cases/skip_welcome_screen.dart';
|
|
|
|
void main() {
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
setUpAll(() async {
|
|
await AppInitializer.initialize(buildType: AppBuildType.tests);
|
|
});
|
|
|
|
testWidgets('Signs in successfully with valid credentials', (WidgetTester tester) async {
|
|
await tester.pumpWidget(const app.MyApp());
|
|
await tester.pumpAndSettle(const Duration(seconds: 3));
|
|
await skipWelcomeScreen(tester);
|
|
final emailFieldFinder = find.byKey(AppKeys.emailTextFieldAuthScreen);
|
|
final passwordFieldFinder = find.byKey(AppKeys.passwordTextFieldAuthScreen);
|
|
final signInButtonFinder = find.byKey(AppKeys.signInButtonAuthScreen);
|
|
|
|
expect(emailFieldFinder, findsOneWidget, reason: 'Email text field should be found.');
|
|
expect(passwordFieldFinder, findsOneWidget, reason: 'Password text field should be found.');
|
|
expect(signInButtonFinder, findsOneWidget, reason: 'Sign In button should be found.');
|
|
|
|
await tester.enterText(emailFieldFinder, 'reshetnick.mike+user4@gmail.com');
|
|
await tester.enterText(passwordFieldFinder, '1234567890');
|
|
await tester.pumpAndSettle();
|
|
|
|
await tester.tap(signInButtonFinder);
|
|
|
|
await tester.pumpAndSettle(const Duration(seconds: 3));
|
|
|
|
expect(signInButtonFinder, findsNothing, reason: 'Sign-in button should not be visible after successful login and navigation.');
|
|
});
|
|
}
|