Emulate text entry in FlutterDriver (#13373)
* Emulate text entry in FlutterDriver * document enterText behavior * remove the unnecessary composint TextRange
This commit is contained in:
@@ -83,6 +83,9 @@ class DriverTestAppState extends State<DriverTestApp> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const TextField(
|
||||
key: const ValueKey<String>('enter-text-field'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
)));
|
||||
|
||||
@@ -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!'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user