Flutter: how to test the scroll
You can create a TestGesture in your tests and perform a scroll that way.
final gesture = await tester.startGesture(Offset(0, 300)); //Position of the scrollviewawait gesture.moveBy(Offset(0, -300)); //How much to scroll byawait tester.pump();
for those using the new flutter_test
lib, we also have the dragUntilVisible
method:
await tester.dragUntilVisible( find.text('Earn mana!'), // what you want to find find.byKey(ValueKey('OnboardingCarousel')), // widget you want to scroll const Offset(-250, 0), // delta to move);