Emulate text entry in FlutterDriver (#13373)

* Emulate text entry in FlutterDriver

* document enterText behavior

* remove the unnecessary composint TextRange
This commit is contained in:
Yegor
2017-12-06 17:29:37 -08:00
committed by GitHub
parent 5a1e639a2f
commit e27bcd0f9d
9 changed files with 155 additions and 43 deletions

View File

@@ -83,6 +83,9 @@ class DriverTestAppState extends State<DriverTestApp> {
),
],
),
const TextField(
key: const ValueKey<String>('enter-text-field'),
),
],
),
),

View File

@@ -4,4 +4,7 @@
import 'package:flutter/widgets.dart';
void main() => runApp(const Center(child: const Text('flutter drive lib/xxx.dart')));
void main() => runApp(const Center(child: const Text(
'flutter drive lib/xxx.dart',
textDirection: TextDirection.ltr,
)));

View File

@@ -93,5 +93,14 @@ void main() {
await driver.tap(a);
await driver.waitForAbsent(menu);
});
test('enters text in a text field', () async {
final SerializableFinder textField = find.byValueKey('enter-text-field');
await driver.tap(textField);
await driver.enterText('Hello!');
await driver.waitFor(find.text('Hello!'));
await driver.enterText('World!');
await driver.waitFor(find.text('World!'));
});
});
}