Unverified Commit fbd6dd64 authored by gaaclarke's avatar gaaclarke Committed by GitHub

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

parent 31ee51a3
Automated Flutter integration test suites. Each suite consists of either a # Automated Flutter integration test suites
complete Flutter app and a `flutter_driver` specification that drives tests
from the UI, or a native app that is meant to integrate with Flutter for Each suite consists of either a complete Flutter app and a `flutter_driver`
testing. specification that drives tests from the UI, or a native app that is meant to
integrate with Flutter for testing.
Intended for use with devicelab tests. Intended for use with devicelab tests.
If you want to run a driver test locally, to debug a problem with a test, If you want to run a driver test locally, to debug a problem with a test, you
you can use this command from the appropriate subdirectory: can use this command from the appropriate subdirectory:
```shell ```shell
% flutter drive flutter drive -t <test> --driver <driver>
```
For example:
```sh
flutter drive -t lib/keyboard_resize.dart --driver test_driver/keyboard_resize_test.dart
``` ```
...@@ -33,22 +33,35 @@ void main() { ...@@ -33,22 +33,35 @@ void main() {
final SerializableFinder defaultTextField = find.byValueKey(keys.kDefaultTextField); final SerializableFinder defaultTextField = find.byValueKey(keys.kDefaultTextField);
await driver.waitFor(defaultTextField); await driver.waitFor(defaultTextField);
await driver.tap(defaultTextField); await driver.tap(defaultTextField);
await Future<void>.delayed(const Duration(seconds: 1));
bool heightTextDidShrink = false;
for (int i = 0; i < 3; ++i) {
await Future<void>.delayed(const Duration(seconds: 1));
// Measure the height with keyboard displayed. // Measure the height with keyboard displayed.
final String heightWithKeyboardShown = await driver.getText(heightText); final String heightWithKeyboardShown = await driver.getText(heightText);
expect(double.parse(heightWithKeyboardShown) < double.parse(startHeight), isTrue); if (double.parse(heightWithKeyboardShown) < double.parse(startHeight)) {
heightTextDidShrink = true;
break;
}
}
expect(heightTextDidShrink, isTrue);
// Unfocus the text field to dismiss the keyboard. // Unfocus the text field to dismiss the keyboard.
final SerializableFinder unfocusButton = find.byValueKey(keys.kUnfocusButton); final SerializableFinder unfocusButton = find.byValueKey(keys.kUnfocusButton);
await driver.waitFor(unfocusButton); await driver.waitFor(unfocusButton);
await driver.tap(unfocusButton); await driver.tap(unfocusButton);
await Future<void>.delayed(const Duration(seconds: 1));
bool heightTextDidExpand = false;
for (int i = 0; i < 3; ++i) {
await Future<void>.delayed(const Duration(seconds: 1));
// Measure the final height. // Measure the final height.
final String endHeight = await driver.getText(heightText); final String endHeight = await driver.getText(heightText);
if (endHeight == startHeight) {
expect(endHeight, startHeight); heightTextDidExpand = true;
break;
}
}
expect(heightTextDidExpand, isTrue);
}); });
}); });
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment