diff --git a/lib/dashboard/drawer/help_center/help_center/view/help_center_menu.dart b/lib/dashboard/drawer/help_center/help_center/view/help_center_menu.dart index f35e473d3..b2db6592f 100644 --- a/lib/dashboard/drawer/help_center/help_center/view/help_center_menu.dart +++ b/lib/dashboard/drawer/help_center/help_center/view/help_center_menu.dart @@ -16,23 +16,30 @@ class HelpCenterMenu extends StatelessWidget { @override Widget build(BuildContext context) { - return const HelpCenterView(); + return Builder( + builder: (context) { + return HelpCenterView( + profileCubit: context.read(), + ); + }, + ); } } class HelpCenterView extends StatelessWidget { - const HelpCenterView({super.key}); + const HelpCenterView({ + super.key, + required this.profileCubit, + }); + + final ProfileCubit profileCubit; @override Widget build(BuildContext context) { final l10n = context.l10n; - final helpCenterOptions = context - .read() - .state - .model - .profileSetting - .helpCenterOptions; + final helpCenterOptions = + profileCubit.state.model.profileSetting.helpCenterOptions; var email = AltMeStrings.appSupportMail; @@ -80,11 +87,8 @@ class HelpCenterView extends StatelessWidget { DrawerItem( title: l10n.sendAnEmail, onTap: () { - Navigator.of(context).push( - ContactUsPage.route( - email: email, - ), - ); + Navigator.of(context) + .push(ContactUsPage.route(email: email)); }, ), ], @@ -96,9 +100,7 @@ class HelpCenterView extends StatelessWidget { ), DrawerItem( onTap: () { - LaunchUrl.launch( - 'https://${AltMeStrings.appContactWebsiteName}', - ); + LaunchUrl.launch('https://${AltMeStrings.appContactWebsiteName}'); }, title: l10n.officialWebsite, ), diff --git a/lib/dashboard/drawer/src/view/drawer_page.dart b/lib/dashboard/drawer/src/view/drawer_page.dart index 1517fdaed..ac0b8af75 100644 --- a/lib/dashboard/drawer/src/view/drawer_page.dart +++ b/lib/dashboard/drawer/src/view/drawer_page.dart @@ -11,12 +11,23 @@ class DrawerPage extends StatelessWidget { @override Widget build(BuildContext context) { - return const DrawerView(); + return Builder( + builder: (context) { + return DrawerView( + profileCubit: context.read(), + ); + }, + ); } } class DrawerView extends StatelessWidget { - const DrawerView({super.key}); + const DrawerView({ + super.key, + required this.profileCubit, + }); + + final ProfileCubit profileCubit; @override Widget build(BuildContext context) { @@ -32,163 +43,165 @@ class DrawerView extends StatelessWidget { child: SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 15), - child: ListView( - children: [ - Align( - alignment: Alignment.topLeft, - child: BackLeadingButton( - padding: EdgeInsets.zero, - color: Theme.of(context).colorScheme.onPrimary, + child: SingleChildScrollView( + child: Column( + children: [ + Align( + alignment: Alignment.topLeft, + child: BackLeadingButton( + padding: EdgeInsets.zero, + color: Theme.of(context).colorScheme.onPrimary, + ), ), - ), - const DrawerLogo(), - const AppVersionDrawer(), - const SizedBox(height: Sizes.spaceLarge), - if (profileModel.profileType == ProfileType.enterprise) ...[ - DrawerCategoryItem( - title: l10n.updateYourWalletConfigNow, - padding: const EdgeInsets.all(16), - onClick: () async { - Navigator.of(context).pop(); - await context - .read() - .updateTheConfiguration(); - }, - ), - const SizedBox(height: Sizes.spaceSmall), - ], + const DrawerLogo(), + const AppVersionDrawer(), + const SizedBox(height: Sizes.spaceLarge), + if (profileModel.profileType == + ProfileType.enterprise) ...[ + DrawerCategoryItem( + title: l10n.updateYourWalletConfigNow, + padding: const EdgeInsets.all(16), + onClick: () async { + Navigator.of(context).pop(); + await context + .read() + .updateTheConfiguration(); + }, + ), + const SizedBox(height: Sizes.spaceSmall), + ], + + if (profileModel + .profileSetting.settingsMenu.displayProfile) ...[ + DrawerCategoryItem( + title: l10n.walletProfiles, + subTitle: l10n.walletProfilesDescription, + onClick: () { + Navigator.of(context) + .push(PickProfileMenu.route()); + }, + ), + const SizedBox(height: Sizes.spaceSmall), + ], - if (profileModel - .profileSetting.settingsMenu.displayProfile) ...[ DrawerCategoryItem( - title: l10n.walletProfiles, - subTitle: l10n.walletProfilesDescription, + title: l10n.walletSecurity, + subTitle: l10n.walletSecurityDescription, onClick: () { Navigator.of(context) - .push(PickProfileMenu.route()); + .push(WalletSecurityMenu.route()); }, ), const SizedBox(height: Sizes.spaceSmall), - ], - DrawerCategoryItem( - title: l10n.walletSecurity, - subTitle: l10n.walletSecurityDescription, - onClick: () { - Navigator.of(context) - .push(WalletSecurityMenu.route()); - }, - ), - const SizedBox(height: Sizes.spaceSmall), - DrawerCategoryItem( - title: l10n.walletSettings, - subTitle: l10n.walletSettingsDescription, - onClick: () { - Navigator.of(context) - .push(WalletSettingsMenu.route()); - }, - ), - if (Parameters.walletHandlesCrypto) - Column( - children: [ - const SizedBox(height: Sizes.spaceSmall), - DrawerCategoryItem( - title: l10n.blockchainSettings, - subTitle: l10n.blockchainSettingsDescription, - onClick: () { - Navigator.of(context) - .push(BlockchainSettingsMenu.route()); - }, - ), - ], - ) - else - const SizedBox.shrink(), - const SizedBox(height: Sizes.spaceSmall), - - if (profileModel.profileSetting.settingsMenu - .displaySelfSovereignIdentity) ...[ DrawerCategoryItem( - title: l10n.ssi, - subTitle: l10n.ssiDescription, + title: l10n.walletSettings, + subTitle: l10n.walletSettingsDescription, onClick: () { - Navigator.of(context).push(SSIMenu.route()); + Navigator.of(context) + .push(WalletSettingsMenu.route()); }, ), + if (Parameters.walletHandlesCrypto) + Column( + children: [ + const SizedBox(height: Sizes.spaceSmall), + DrawerCategoryItem( + title: l10n.blockchainSettings, + subTitle: l10n.blockchainSettingsDescription, + onClick: () { + Navigator.of(context) + .push(BlockchainSettingsMenu.route()); + }, + ), + ], + ) + else + const SizedBox.shrink(), const SizedBox(height: Sizes.spaceSmall), - ], - if (profileModel - .profileSetting.settingsMenu.displayDeveloperMode) ...[ - DrawerCategoryItem( - title: l10n.developerMode, - subTitle: l10n.developerModeSubtitle, - trailing: SizedBox( - height: 25, - child: BlocBuilder( - builder: (context, state) { - return Switch( - onChanged: (value) async { - await context - .read() - .setDeveloperModeStatus(enabled: value); - }, - value: state.model.isDeveloperMode, - activeColor: - Theme.of(context).colorScheme.primary, - ); - }, + if (profileModel.profileSetting.settingsMenu + .displaySelfSovereignIdentity) ...[ + DrawerCategoryItem( + title: l10n.ssi, + subTitle: l10n.ssiDescription, + onClick: () { + Navigator.of(context).push(SSIMenu.route()); + }, + ), + const SizedBox(height: Sizes.spaceSmall), + ], + + if (profileModel.profileSetting.settingsMenu + .displayDeveloperMode) ...[ + DrawerCategoryItem( + title: l10n.developerMode, + subTitle: l10n.developerModeSubtitle, + trailing: SizedBox( + height: 25, + child: BlocBuilder( + builder: (context, state) { + return Switch( + key: const Key('developerMode'), + onChanged: (value) async { + await profileCubit.setDeveloperModeStatus( + enabled: value, + ); + }, + value: state.model.isDeveloperMode, + activeColor: + Theme.of(context).colorScheme.primary, + ); + }, + ), ), ), - ), - const SizedBox(height: Sizes.spaceSmall), - ], + const SizedBox(height: Sizes.spaceSmall), + ], - // DrawerCategoryItem( - // title: l10n.checkLinkedinProfile, - // subTitle: l10n.checkLinkedinProfile, - // onClick: () { - // Navigator.of(context) - // .push(CheckForLinkedInProfile.route()); - // }, - // ), - //const SizedBox(height: Sizes.spaceSmall), + // DrawerCategoryItem( + // title: l10n.checkLinkedinProfile, + // subTitle: l10n.checkLinkedinProfile, + // onClick: () { + // Navigator.of(context) + // .push(CheckForLinkedInProfile.route()); + // }, + // ), + //const SizedBox(height: Sizes.spaceSmall), + + if (profileModel + .profileSetting.settingsMenu.displayHelpCenter) ...[ + DrawerCategoryItem( + title: l10n.helpCenter, + subTitle: l10n.helpCenterDescription, + onClick: () { + Navigator.of(context) + .push(HelpCenterMenu.route()); + }, + ), + const SizedBox(height: Sizes.spaceSmall), + ], - if (profileModel - .profileSetting.settingsMenu.displayHelpCenter && - profileModel.profileType != ProfileType.defaultOne) ...[ DrawerCategoryItem( - title: l10n.helpCenter, - subTitle: l10n.helpCenterDescription, + title: l10n.about, + subTitle: l10n.aboutDescription, onClick: () { Navigator.of(context) - .push(HelpCenterMenu.route()); + .push(AboutAltmeMenu.route()); }, ), const SizedBox(height: Sizes.spaceSmall), + DrawerCategoryItem( + title: l10n.resetWallet, + subTitle: l10n.resetWalletDescription, + onClick: () { + Navigator.of(context) + .push(ResetWalletMenu.route()); + }, + ), + const SizedBox(height: Sizes.spaceNormal), ], - - DrawerCategoryItem( - title: l10n.about, - subTitle: l10n.aboutDescription, - onClick: () { - Navigator.of(context) - .push(AboutAltmeMenu.route()); - }, - ), - const SizedBox(height: Sizes.spaceSmall), - DrawerCategoryItem( - title: l10n.resetWallet, - subTitle: l10n.resetWalletDescription, - onClick: () { - Navigator.of(context) - .push(ResetWalletMenu.route()); - }, - ), - const SizedBox( - height: Sizes.spaceNormal, - ), - ], + ), ), ), ), diff --git a/test/dashboard/drawer/help_center/view/help_center_menu_test.dart b/test/dashboard/drawer/help_center/view/help_center_menu_test.dart new file mode 100644 index 000000000..a4b98f790 --- /dev/null +++ b/test/dashboard/drawer/help_center/view/help_center_menu_test.dart @@ -0,0 +1,173 @@ +import 'package:altme/app/app.dart'; +import 'package:altme/dashboard/dashboard.dart'; +import 'package:altme/flavor/flavor.dart'; +import 'package:bloc_test/bloc_test.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockingjay/mockingjay.dart'; + +import '../../../../helpers/helpers.dart'; + +class MockProfileCubit extends MockCubit + implements ProfileCubit {} + +class MockFlavorCubit extends MockCubit implements FlavorCubit { + @override + final state = FlavorMode.development; +} + +void main() { + late MockProfileCubit mockProfileCubit; + late FlavorCubit mockFlavorCubit; + late MockNavigator navigator; + + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + mockProfileCubit = MockProfileCubit(); + mockFlavorCubit = MockFlavorCubit(); + navigator = MockNavigator(); + when(navigator.canPop).thenReturn(true); + + when(() => navigator.push(any())).thenAnswer((_) async {}); + }); + + group('Help Center Menu Test', () { + testWidgets('renders HelpCenterView', (tester) async { + when(() => mockProfileCubit.state) + .thenReturn(ProfileState(model: ProfileModel.empty())); + await tester.pumpApp( + MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: const HelpCenterMenu(), + ), + ); + + expect(find.byType(HelpCenterView), findsOneWidget); + }); + + testWidgets('renders basic UI correctly', (tester) async { + when(() => mockProfileCubit.state) + .thenReturn(ProfileState(model: ProfileModel.empty())); + await tester.pumpApp( + MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: HelpCenterView(profileCubit: mockProfileCubit), + ), + ); + expect(find.byType(BasePage), findsOneWidget); + expect(find.byType(BackLeadingButton), findsOneWidget); + }); + + testWidgets( + 'navigates to ContactUsPage when displayEmailSupport is enabled and ' + '"sendAnEmail" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: HelpCenterView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Send an email'), findsOneWidget); + + await tester.tap(find.text('Send an email')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/ContactUsPage'), + ), + ), + ), + ).called(1); + }); + + testWidgets( + 'navigates to ContactUsPage when displayEmailSupport is enabled and ' + '"sendAnEmail" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: HelpCenterView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Send an email'), findsOneWidget); + + await tester.tap(find.text('Send an email')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/ContactUsPage'), + ), + ), + ), + ).called(1); + }); + + testWidgets('navigates to FAQsPage when "faqs" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: HelpCenterView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Frequently Asked Questions (FAQs)'), findsOneWidget); + + await tester.tap(find.text('Frequently Asked Questions (FAQs)')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/FAQsPage'), + ), + ), + ), + ).called(1); + }); + }); +} diff --git a/test/dashboard/drawer/src/view/drawer_page_test.dart b/test/dashboard/drawer/src/view/drawer_page_test.dart new file mode 100644 index 000000000..c36bc5d02 --- /dev/null +++ b/test/dashboard/drawer/src/view/drawer_page_test.dart @@ -0,0 +1,396 @@ +import 'package:altme/app/app.dart'; +import 'package:altme/dashboard/dashboard.dart'; +import 'package:altme/flavor/flavor.dart'; +import 'package:bloc_test/bloc_test.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockingjay/mockingjay.dart'; + +import '../../../../helpers/helpers.dart'; + +class MockProfileCubit extends MockCubit + implements ProfileCubit {} + +class MockFlavorCubit extends MockCubit implements FlavorCubit { + @override + final state = FlavorMode.development; +} + +void main() { + late MockProfileCubit mockProfileCubit; + late FlavorCubit mockFlavorCubit; + late MockNavigator navigator; + + setUpAll(() { + TestWidgetsFlutterBinding.ensureInitialized(); + mockProfileCubit = MockProfileCubit(); + mockFlavorCubit = MockFlavorCubit(); + navigator = MockNavigator(); + when(navigator.canPop).thenReturn(true); + + when(() => navigator.push(any())).thenAnswer((_) async {}); + }); + + group('DrawerPage Tests', () { + testWidgets('renders DrawerView', (tester) async { + when(() => mockProfileCubit.state) + .thenReturn(ProfileState(model: ProfileModel.empty())); + await tester.pumpApp( + MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: const DrawerPage(), + ), + ); + + expect(find.byType(DrawerView), findsOneWidget); + }); + + testWidgets('renders basic UI correctly', (tester) async { + when(() => mockProfileCubit.state) + .thenReturn(ProfileState(model: ProfileModel.empty())); + await tester.pumpApp( + MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ); + expect(find.byType(Drawer), findsOneWidget); + expect(find.byType(DrawerLogo), findsOneWidget); + expect(find.byType(AppVersionDrawer), findsOneWidget); + }); + + testWidgets( + 'navigates to PickProfileMenu when displayProfile is enabled and ' + '"Wallet Profile" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Wallet Profiles'), findsOneWidget); + expect( + find.text('Choose your SSI profile or customize your own'), + findsOneWidget, + ); + + await tester.tap(find.text('Wallet Profiles')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/PickProfileMenu'), + ), + ), + ), + ).called(1); + }); + + testWidgets('navigates to WalletSettingsMenu on tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Wallet Settings'), findsOneWidget); + expect(find.text('Choose your language'), findsOneWidget); + + await tester.tap(find.text('Wallet Settings')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/WalletSettingsMenu'), + ), + ), + ), + ).called(1); + }); + + testWidgets( + 'when walletHandlesCrypto is true, ' + 'navigates to BlockchainSettingsMenu on tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + if (Parameters.walletHandlesCrypto) { + expect(find.text('Blockchain Settings'), findsOneWidget); + expect( + find.text( + 'Manage accounts, Recovery Phrase, Connected dApps and Networks', + ), + findsOneWidget, + ); + + await tester.tap(find.text('Blockchain Settings')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/BlockchainSettingsMenu'), + ), + ), + ), + ).called(1); + } + }); + + testWidgets( + 'navigates to SSIMenu when displaySelfSovereignIdentity is enabled ' + 'and "ssi" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Self-Sovereign Identity (DID)'), findsOneWidget); + expect( + find.text( + 'Manage your Decentralized ID and backup or restore your credentials'), + findsOneWidget, + ); + + await tester.scrollUntilVisible( + find.text('Self-Sovereign Identity (DID)'), + 0, + ); + + await tester.tap(find.text('Self-Sovereign Identity (DID)')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/ssiMenu'), + ), + ), + ), + ).called(1); + }); + + testWidgets( + 'setDeveloperModeStatus is called when displayDeveloperMode is enabled ' + 'and "developerMode" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + when( + () => mockProfileCubit.setDeveloperModeStatus( + enabled: true, + ), + ).thenAnswer((_) async => {}); + + await tester.pumpApp( + MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ); + + expect(find.text('Developer Mode'), findsOneWidget); + expect( + find.text('Enable developer mode to access advanced debugging tools'), + findsOneWidget, + ); + + await tester.scrollUntilVisible(find.text('Developer Mode'), 0); + + await tester.tap(find.byKey(const Key('developerMode'))); + await tester.pumpAndSettle(); + + verify( + () => mockProfileCubit.setDeveloperModeStatus(enabled: true), + ).called(1); + }); + + testWidgets( + 'navigates to HelpCenterMenu when displayHelpCenter is enabled ' + 'and "helpCenter" is tapped', (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + await tester.scrollUntilVisible(find.text('Help Center'), 0); + + expect(find.text('Help Center'), findsOneWidget); + expect( + find.text('Contact us and get support if you need ' + 'assistance on using our wallet'), + findsOneWidget, + ); + + await tester.tap(find.text('Help Center')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/HelpCenterMenu'), + ), + ), + ), + ).called(1); + }); + + testWidgets('navigates to AboutAltmeMenu when "about" is tapped', + (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('About'), findsOneWidget); + expect( + find.text('Read about terms of use, confidentiality and licenses'), + findsOneWidget, + ); + + await tester.scrollUntilVisible(find.text('About'), 0); + + await tester.tap(find.text('About')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/AboutAltmeMenu'), + ), + ), + ), + ).called(1); + }); + + testWidgets('navigates to ResetWalletMenu when "resetWallet" is tapped', + (tester) async { + when(() => mockProfileCubit.state).thenReturn( + ProfileState(model: ProfileModel.empty()), + ); + + await tester.pumpApp( + MockNavigatorProvider( + navigator: navigator, + child: MultiBlocProvider( + providers: [ + BlocProvider.value(value: mockProfileCubit), + BlocProvider.value(value: mockFlavorCubit), + ], + child: DrawerView(profileCubit: mockProfileCubit), + ), + ), + ); + + expect(find.text('Reset Wallet'), findsOneWidget); + expect( + find.text('Erase all data stored on your phone and reset your wallet.'), + findsOneWidget, + ); + + await tester.scrollUntilVisible(find.text('Reset Wallet'), 0); + + await tester.tap(find.text('Reset Wallet')); + await tester.pumpAndSettle(); + + verify( + () => navigator.push( + any( + that: isRoute( + whereName: equals('/ResetWalletMenu'), + ), + ), + ), + ).called(1); + }); + }); +}