Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'bottom_nav_bar_test.dart';
import 'onboarding/view/onboarding_flow_test.dart';


void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('Development App', () {
bottomNavBarTest();
onboardingFlowTest();
});
}
81 changes: 81 additions & 0 deletions integration_test/onboarding/view/onboarding_flow_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fpb/assets/fpb_svg.dart';
import 'package:fpb/authentication_with_google/application/google_auth_bloc/google_sign_in_bloc.dart';
import 'package:fpb/l10n/l10n.dart';
import 'package:fpb/onboarding/onboarding.dart';

import '../../../test/helpers/helpers.dart';


void onboardingFlowTest() {

late AppLocalizations l10n;

group('onboarding flow', () {
testWidgets('displays the onboarding flow', (tester) async {
await tester.pumpApp(Builder(
builder: (BuildContext context) {
l10n = context.l10n;
return OnboardingScreen();
}
));

await tester.pumpAndSettle();

/// TODO: write tests for the bubble animation when it's implemented

/// Onboarding Screen One
expect(find.image(AssetImage(SvgNames.sendIllustration)), findsOneWidget);
expect(find.text(l10n.onboardingSendTitle), findsOneWidget);
expect(find.text(l10n.onboardingSendDescription), findsOneWidget);

final Finder skipButtonLabel = find.byKey(ValueKey('skip_button'));
final Finder nextButtonLabel = find.byKey(ValueKey('next_button'));

expect(find.text(l10n.onboardingSkipLabel), findsOneWidget);
expect(find.text(l10n.onboardingNextLabel), findsOneWidget);
expect(find.byKey(ValueKey('next_icon')), findsOneWidget);

await tester.tap(skipButtonLabel, warnIfMissed: true);
await tester.tap(nextButtonLabel, warnIfMissed: true);

await waitForNextScreen(tester);

/// Onboarding Screen Two
expect(
find.image(AssetImage(
SvgNames.saveIllustration,
)),
findsOneWidget);
expect(find.text(l10n.onboardingSaveTitle), findsOneWidget);
expect(find.text(l10n.onboardingSaveDescription), findsOneWidget);
expect(find.text(l10n.onboardingSkipLabel), findsOneWidget);
expect(find.text(l10n.onboardingNextLabel), findsOneWidget);
await tester.tap(skipButtonLabel, warnIfMissed: true);
await tester.tap(nextButtonLabel, warnIfMissed: true);

await waitForNextScreen(tester);

/// Onboarding Screen Three
expect(
find.image(AssetImage(SvgNames.transIllustration)), findsOneWidget);
expect(find.text(l10n.onboardingTransactionTitle), findsOneWidget);
expect(find.text(l10n.onboardingTransactionDescription), findsOneWidget);
final Finder getStartedButtonLabel =
find.byKey(ValueKey('get_started_button'));
await tester.tap(getStartedButtonLabel, warnIfMissed: true);

// Trigger a frame.
await tester.pumpAndSettle();

/// Display the Login screen at the end of the onboarding flow
expect(find.byType(SignIn), findsOneWidget);
});
});
}

Future<void> waitForNextScreen(WidgetTester tester) async {
await tester.pumpAndSettle();
await tester.pump(Duration(seconds: 1));
}
5 changes: 4 additions & 1 deletion lib/onboarding/view/widgets/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ class Actions extends StatelessWidget {
if (!isLastPage) const SizedBox(),
if (!isLastPage)
TextButton(
key: Key("skip_button"),
onPressed: onSkipPressed,
child: Text(
l10n.onboardingSkipLabel,
style: textTheme.titleMedium,
),
),
FpbButton(
key: !isLastPage ? Key("next_button") : Key('get_started_button'),
label: !isLastPage
? l10n.onboardingNextLabel
: l10n.onboardingGetStartedLabel,
Expand All @@ -44,7 +46,8 @@ class Actions extends StatelessWidget {
height: cts.maxHeight * 0.07,
trailing: !isLastPage
? Icon(
FpbIcons.arrow_right,
key: Key("next_icon"),
FpbIcons.arrow_right,
size: cts.maxHeight * 0.02,
color: colors.background,
)
Expand Down