@@ -78,9 +78,11 @@ void main() {
7878 });
7979}
8080
81+ Duration duration = const Duration (milliseconds: 300 );
82+
8183Future <HomePageObject > _setupHomePage (WidgetTester tester) async {
8284 await tester.pumpWidget (const MaterialApp (home: HomePage ()));
83- await tester.pumpAndSettle ();
85+ await tester.pumpAndSettle (duration );
8486 final pageObject = HomePageObject (tester);
8587 await pageObject.deleteAll ();
8688 return pageObject;
@@ -112,7 +114,7 @@ class HomePageObject {
112114 final textField = find.byKey (const Key ('value_field' ));
113115 expect (textField, findsOneWidget, reason: 'Value text field not found' );
114116 await tester.enterText (textField, newValue);
115- await tester.pumpAndSettle ();
117+ await tester.pumpAndSettle (duration );
116118
117119 await _tap (find.byKey (const Key ('save' )));
118120 }
@@ -142,11 +144,11 @@ class HomePageObject {
142144 final textField = find.byKey (const Key ('key_field' ));
143145 expect (textField, findsOneWidget);
144146 await tester.enterText (textField, keyWidget.data! );
145- await tester.pumpAndSettle ();
147+ await tester.pumpAndSettle (duration );
146148
147149 // Confirm the action
148150 await tester.tap (find.text ('OK' ));
149- await tester.pumpAndSettle ();
151+ await tester.pumpAndSettle (duration );
150152
151153 // Verify the SnackBar message
152154 final expectedText = 'Contains Key: $expectedResult ' ;
@@ -168,11 +170,11 @@ class HomePageObject {
168170 final textField = find.byKey (const Key ('key_field' ));
169171 expect (textField, findsOneWidget);
170172 await tester.enterText (textField, keyWidget.data! );
171- await tester.pumpAndSettle ();
173+ await tester.pumpAndSettle (duration );
172174
173175 // Confirm the action
174176 await tester.tap (find.text ('OK' ));
175- await tester.pumpAndSettle ();
177+ await tester.pumpAndSettle (duration );
176178
177179 // Verify the SnackBar message
178180 expect (find.text ('value: $expectedValue ' ), findsOneWidget);
@@ -213,6 +215,6 @@ class HomePageObject {
213215 reason: 'Widget not found for tapping: $finder ' ,
214216 );
215217 await tester.tap (finder);
216- await tester.pumpAndSettle ();
218+ await tester.pumpAndSettle (duration );
217219 }
218220}
0 commit comments