Added a more generous timeout period for the keyboard animation. (#62628)
This commit is contained in:
@@ -33,22 +33,35 @@ void main() {
|
||||
final SerializableFinder defaultTextField = find.byValueKey(keys.kDefaultTextField);
|
||||
await driver.waitFor(defaultTextField);
|
||||
await driver.tap(defaultTextField);
|
||||
await Future<void>.delayed(const Duration(seconds: 1));
|
||||
|
||||
// Measure the height with keyboard displayed.
|
||||
final String heightWithKeyboardShown = await driver.getText(heightText);
|
||||
expect(double.parse(heightWithKeyboardShown) < double.parse(startHeight), isTrue);
|
||||
bool heightTextDidShrink = false;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
await Future<void>.delayed(const Duration(seconds: 1));
|
||||
// Measure the height with keyboard displayed.
|
||||
final String heightWithKeyboardShown = await driver.getText(heightText);
|
||||
if (double.parse(heightWithKeyboardShown) < double.parse(startHeight)) {
|
||||
heightTextDidShrink = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
expect(heightTextDidShrink, isTrue);
|
||||
|
||||
// Unfocus the text field to dismiss the keyboard.
|
||||
final SerializableFinder unfocusButton = find.byValueKey(keys.kUnfocusButton);
|
||||
await driver.waitFor(unfocusButton);
|
||||
await driver.tap(unfocusButton);
|
||||
await Future<void>.delayed(const Duration(seconds: 1));
|
||||
|
||||
// Measure the final height.
|
||||
final String endHeight = await driver.getText(heightText);
|
||||
|
||||
expect(endHeight, startHeight);
|
||||
bool heightTextDidExpand = false;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
await Future<void>.delayed(const Duration(seconds: 1));
|
||||
// Measure the final height.
|
||||
final String endHeight = await driver.getText(heightText);
|
||||
if (endHeight == startHeight) {
|
||||
heightTextDidExpand = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
expect(heightTextDidExpand, isTrue);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user