Committed by
GitHub
Update documentation for Version 5.9.0 (Tests) (#547)
* Update documentation for Version 5.9.0 (Tests) This pull request updates the documentation to express the need for using pumpAndSettle() in widget tests to ensure compatibility and proper functioning in version 5.9.0. * Update documentation for Version 5.9.0 (Tests) This pull request updates the documentation to express the need for using pumpAndSettle() in widget tests to ensure compatibility and proper functioning in version 5.9.0.
Showing
1 changed file
with
25 additions
and
0 deletions
@@ -361,3 +361,28 @@ To use second method run: `flutter run --dart-define=method=2` | @@ -361,3 +361,28 @@ To use second method run: `flutter run --dart-define=method=2` | ||
361 | 361 | ||
362 |  | 362 |  |
363 |  | 363 |  |
364 | + | ||
365 | + | ||
366 | +### Update for Version 5.9.0 (Tests) | ||
367 | +Reported as bug in [#515](https://github.com/OpenFlutter/flutter_screenutil/issues/515) | ||
368 | + | ||
369 | + | ||
370 | +In version 5.9.0, to ensure compatibility and proper functioning of your tests, it is crucial to use the method `tester.pumpAndSettle()`; when conducting widget tests that depend on animations or a settling time to complete their state. | ||
371 | + | ||
372 | +In the previous version, this step was not strictly necessary. However, to maintain consistency in your tests and avoid unexpected errors, it's strongly recommended incorporating await tester.pumpAndSettle(); in your widget tests if you are using version 5.9.0 | ||
373 | + | ||
374 | +Example usage: | ||
375 | +```dart | ||
376 | +testWidgets('Should ensure widgets settle correctly', (WidgetTester tester) async { | ||
377 | +await tester.pumpWidget( | ||
378 | + const MaterialApp( | ||
379 | + home: ScreenUtilInit( | ||
380 | + child: MyApp(), | ||
381 | + ), | ||
382 | + ), | ||
383 | +); | ||
384 | +// Insertion of recommended method to prevent failures | ||
385 | +await tester.pumpAndSettle(); | ||
386 | +// Continue with your assertions and tests | ||
387 | +}); | ||
388 | +``` |
-
Please register or login to post a comment