Added a more generous timeout period for the keyboard animation. (#62628)

This commit is contained in:
gaaclarke
2020-08-04 08:14:17 -07:00
committed by GitHub
parent 31ee51a302
commit fbd6dd64d3
2 changed files with 36 additions and 16 deletions

View File

@@ -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);
});
});
}