首页 > 解决方案 > 输入文本后点击 Flutter 集成测试中的 enter/done/return 按钮

问题描述

await tester.enterText(mySearchField, 'my search text');
await tester.showKeyboard(mySearchField);
await tester.sendKeyDownEvent(LogicalKeyboardKey.enter);

// do something to wait for 2 seconds
await tester.pumpAndSettle();
await Future.delayed(const Duration(seconds: 10), () {});

在搜索字段中输入文本后,我正在尝试点击虚拟键盘上的完成/输入/提交按钮。

如何做到这一点,以及如何等待结果(异步请求)......

标签: flutterasync-awaitkeyboardwidget-test-flutterflutter-integration-test

解决方案


推荐阅读