Given that tester.enterText
will allow me to enter the text on a TextField
in a flutter test, how would I mock pressing the DONE key on the android keyboard or pressing ENTER on my keyboard inside the textfield?
This would also be equivalent to checking for the pressing of the DONE button on the IOS/android keyboard
I found the implementation in the flutter repo tests @ https://github.com/flutter/flutter/blob/7e445a17324ee7e615ef2c886d0cb9407853f338/packages/flutter/test/widgets/editable_text_test.dart#L558:
ex: await tester.testTextInput.receiveAction(TextInputAction.done);
// example
await tester.enterText(find.byKey(new Key('txtFieldKey')), 'Hello World!');
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pump();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With