diff --git a/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart b/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart index b7072707c..1f2f17e0f 100644 --- a/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart +++ b/test/widget_tests/after_auth_screens/feed/organization_feed_test.dart @@ -285,5 +285,45 @@ void main() { verify(mockViewModel.nextPage()).called(1); verify(mockViewModel.previousPage()).called(1); }); + + testWidgets('check if FloatingActionButton click works fine', + (tester) async { + // Arrange + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pumpAndSettle(); + + // Simulate Tap + final fabFinder = find.byKey(const Key('floating_action_btn')); + expect(fabFinder, findsOneWidget); + await tester.tap(fabFinder); + + // Verify the /addpostscreen is pushed + await tester.pump(); + verify(locator().pushScreen('/addpostscreen')); + }); + + testWidgets( + 'check if counters reset when scrolling occurs anywhere other than at the edge', + (tester) async { + // Arrange + when(mockViewModel.posts) + .thenReturn([post, post, post, post, post, post]); + final model = locator(); + await tester.pumpWidget(createOrganizationFeedScreen(homeModel: model)); + await tester.pumpAndSettle(); + + // Simulate Scroll within content (not at edge) + await tester.drag( + find.byKey(const Key('listView')), + const Offset(0, -200), + ); + await tester.pumpAndSettle(); + + // Verify that counters are reset and loading state + expect(find.byType(CircularProgressIndicator), findsNothing); + verifyNever(mockViewModel.nextPage()); + verifyNever(mockViewModel.previousPage()); + }); }); }