await widgetTester.tap(find.byType(ElevatedButton));
shows warning : Maybe the widget is actually off-screen, or another widget is obscuring it, or the widget cannot receive pointer events.
This involves three steps: Tap the add button using the tap() method. Rebuild the widget after the state has changed using the pump() method. Ensure that the list item appears on screen.
Check if the widget is currently visible using bool isVisible() .
pumpAndSettle method Null safetyRepeatedly calls pump with the given duration until there are no longer any frames scheduled. This will call pump at least once, even if no frames are scheduled when the function is called, to flush any pending microtasks which may themselves schedule a frame.
Try this:
await widgetTester.ensureVisible(find.byType(ElevatedButton));
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.byType(ElevatedButton));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With