68 lines
2.6 KiB
Dart
68 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:prediqo_mobile/app.dart';
|
|
import 'package:prediqo_mobile/core/config/app_config.dart';
|
|
import 'package:prediqo_mobile/core/di/injection.dart';
|
|
|
|
import 'support/e2e_fixtures.dart';
|
|
|
|
/// UI E2E flows runnable on the VM (`flutter test test/e2e_app_flow_test.dart`).
|
|
void main() {
|
|
setUpAll(configureE2eTestEnvironment);
|
|
|
|
group('Tloto mobile E2E (UI)', () {
|
|
tearDown(() async {
|
|
if (sl.isRegistered<AppConfig>()) {
|
|
await sl.reset();
|
|
}
|
|
});
|
|
|
|
testWidgets('unauthenticated user sees public welcome after splash', (tester) async {
|
|
await setupE2eDependencies(loggedIn: false);
|
|
await tester.pumpWidget(const PrediqoApp());
|
|
await e2ePumpPastSplash(tester);
|
|
|
|
expect(find.byKey(const Key('welcome_screen')), findsOneWidget);
|
|
expect(find.byKey(const Key('welcome_get_started')), findsOneWidget);
|
|
expect(find.byKey(const Key('login_screen')), findsNothing);
|
|
});
|
|
|
|
testWidgets('login flow reaches dashboard', (tester) async {
|
|
await setupE2eDependencies(loggedIn: false);
|
|
await tester.pumpWidget(const PrediqoApp());
|
|
await e2ePumpPastSplash(tester);
|
|
|
|
await tester.tap(find.byKey(const Key('welcome_get_started')));
|
|
await e2ePump(tester, frames: 5);
|
|
|
|
await tester.enterText(find.byKey(const Key('login_email')), 'e2e@prediqo.test');
|
|
await tester.enterText(find.byKey(const Key('login_password')), 'password123');
|
|
await tester.tap(find.byKey(const Key('login_submit')));
|
|
await e2ePump(tester, frames: 8);
|
|
|
|
expect(find.byKey(const Key('nav_home')), findsOneWidget);
|
|
expect(find.byKey(const Key('login_screen')), findsNothing);
|
|
});
|
|
|
|
testWidgets('authenticated user navigates predict catalog then candle game', (tester) async {
|
|
await setupE2eDependencies(loggedIn: true);
|
|
await tester.pumpWidget(const PrediqoApp());
|
|
await e2ePumpPastSplash(tester);
|
|
|
|
await tester.tap(find.byKey(const Key('nav_predict')));
|
|
await e2ePump(tester, frames: 20);
|
|
expect(find.byKey(const Key('prediction_games_screen')), findsOneWidget);
|
|
expect(find.byKey(const Key('game_card_candle-predict')), findsOneWidget);
|
|
|
|
await tester.tap(find.byKey(const Key('game_card_candle-predict')));
|
|
await e2ePump(tester, frames: 20);
|
|
expect(find.byKey(const Key('prediction_screen')), findsOneWidget);
|
|
expect(find.text('Candle Predict'), findsOneWidget);
|
|
|
|
await tester.tap(find.byKey(const Key('nav_profile')));
|
|
await e2ePump(tester, frames: 5);
|
|
expect(find.text('Account'), findsWidgets);
|
|
});
|
|
});
|
|
}
|