From 2404cfd80c58842745de5ad937fb2e515e47b798 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 | 20 +++++++++++++++++++ 1 file changed, 20 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..4e065e3324 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,25 @@ 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', + '/', + ),); + }); }); }