@@ -78,9 +78,11 @@ void main() {
78
78
});
79
79
}
80
80
81
+ Duration duration = const Duration (milliseconds: 300 );
82
+
81
83
Future <HomePageObject > _setupHomePage (WidgetTester tester) async {
82
84
await tester.pumpWidget (const MaterialApp (home: HomePage ()));
83
- await tester.pumpAndSettle ();
85
+ await tester.pumpAndSettle (duration );
84
86
final pageObject = HomePageObject (tester);
85
87
await pageObject.deleteAll ();
86
88
return pageObject;
@@ -112,7 +114,7 @@ class HomePageObject {
112
114
final textField = find.byKey (const Key ('value_field' ));
113
115
expect (textField, findsOneWidget, reason: 'Value text field not found' );
114
116
await tester.enterText (textField, newValue);
115
- await tester.pumpAndSettle ();
117
+ await tester.pumpAndSettle (duration );
116
118
117
119
await _tap (find.byKey (const Key ('save' )));
118
120
}
@@ -142,11 +144,11 @@ class HomePageObject {
142
144
final textField = find.byKey (const Key ('key_field' ));
143
145
expect (textField, findsOneWidget);
144
146
await tester.enterText (textField, keyWidget.data! );
145
- await tester.pumpAndSettle ();
147
+ await tester.pumpAndSettle (duration );
146
148
147
149
// Confirm the action
148
150
await tester.tap (find.text ('OK' ));
149
- await tester.pumpAndSettle ();
151
+ await tester.pumpAndSettle (duration );
150
152
151
153
// Verify the SnackBar message
152
154
final expectedText = 'Contains Key: $expectedResult ' ;
@@ -168,11 +170,11 @@ class HomePageObject {
168
170
final textField = find.byKey (const Key ('key_field' ));
169
171
expect (textField, findsOneWidget);
170
172
await tester.enterText (textField, keyWidget.data! );
171
- await tester.pumpAndSettle ();
173
+ await tester.pumpAndSettle (duration );
172
174
173
175
// Confirm the action
174
176
await tester.tap (find.text ('OK' ));
175
- await tester.pumpAndSettle ();
177
+ await tester.pumpAndSettle (duration );
176
178
177
179
// Verify the SnackBar message
178
180
expect (find.text ('value: $expectedValue ' ), findsOneWidget);
@@ -213,6 +215,6 @@ class HomePageObject {
213
215
reason: 'Widget not found for tapping: $finder ' ,
214
216
);
215
217
await tester.tap (finder);
216
- await tester.pumpAndSettle ();
218
+ await tester.pumpAndSettle (duration );
217
219
}
218
220
}
0 commit comments