mirror of
https://github.com/flutter/flutter
synced 2024-08-27 20:10:11 +00:00
Added a more generous timeout period for the keyboard animation. (#62628)
This commit is contained in:
parent
31ee51a302
commit
fbd6dd64d3
|
@ -1,13 +1,20 @@
|
|||
Automated Flutter integration test suites. Each suite consists of either a
|
||||
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
|
||||
testing.
|
||||
# Automated Flutter integration test suites
|
||||
|
||||
Each suite consists of either a 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 testing.
|
||||
|
||||
Intended for use with devicelab tests.
|
||||
|
||||
If you want to run a driver test locally, to debug a problem with a test,
|
||||
you can use this command from the appropriate subdirectory:
|
||||
If you want to run a driver test locally, to debug a problem with a test, you
|
||||
can use this command from the appropriate subdirectory:
|
||||
|
||||
```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() {
|
|||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue