diff --git a/examples/autosnapshotting/integration_test/app_test.dart b/examples/autosnapshotting/integration_test/app_test.dart index b6e428d1..2665debf 100644 --- a/examples/autosnapshotting/integration_test/app_test.dart +++ b/examples/autosnapshotting/integration_test/app_test.dart @@ -23,6 +23,8 @@ void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('Snapshots are not taken after reaching limit', (tester) async { + // Delay needed to detect memory usage is increased and take snapshot. + final delayForSnapshot = const Duration(seconds: 10); app.main([], snapshotDirectory: '$_testDirRoot/$pid'); await tester.pumpAndSettle(); @@ -37,8 +39,7 @@ void main() { await tester.tap(theButton); await tester.pumpAndSettle(); } - await tester - .runAsync(() => Future.delayed(const Duration(seconds: 5))); + await tester.runAsync(() => Future.delayed(delayForSnapshot)); expect(pageState.snapshots.length, greaterThan(0)); // Take second threshold @@ -49,8 +50,7 @@ void main() { await tester.tap(theButton); await tester.pumpAndSettle(); } - await tester - .runAsync(() => Future.delayed(const Duration(seconds: 5))); + await tester.runAsync(() => Future.delayed(delayForSnapshot)); expect(pageState.snapshots.length, snapshotsLength + 1); // Check the directory limit is respected.