From 296c4c4f3969ce821abd04eb42c581cd69542705 Mon Sep 17 00:00:00 2001 From: Aayushmaan Date: Tue, 12 Mar 2024 13:22:23 +0530 Subject: [PATCH] test: adds Test if Logout is successful test --- .../app_settings/app_setting_page_test.dart | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart b/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart index 2705a21811..5ab7fbf34c 100644 --- a/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart +++ b/test/widget_tests/after_auth_screens/app_settings/app_setting_page_test.dart @@ -308,5 +308,27 @@ Future main() async { final logoutButton = find.textContaining('LogOut'); await tester.tap(logoutButton); }); + + testWidgets('Test if Logout is successful', (tester) async { + final model = AppSettingViewModel(); + when(model.logout()).thenAnswer((_) async => true); + + await tester.pumpWidget(createChangePassScreenDark()); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('Logout'))); + await tester.pumpAndSettle(); + + final logoutButton = find.textContaining('LogOut'); + await tester.tap(logoutButton); + + verify(navigationService.pop()); + verify( + navigationService.removeAllAndPush( + '/selectLang', + '/', + ), + ); + }); }); }