You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Patrol做集成测试时,Pinput组件enterText()方法失效求助

Patrol集成测试中enterText()无法在Pinput组件上正常工作

在使用Patrol执行Flutter集成测试时,发现enterText()方法无法对Pinput组件正常输入内容。以下是测试用例代码:

final TextEditingController controller = TextEditingController();
const length = 4;
final focusNode = FocusNode();
final ref = ProviderContainer();

await $.pumpWidget(
  UncontrolledProviderScope(
    container: ref,
    child: MaterialApp(
      home: Scaffold(
        body: Pinput(
          autofocus: true,
          controller: controller,
          focusNode: focusNode,
        ),
      ),
    ),
  ),
);
focusNode.requestFocus();
await $.pump();
const pinValue = '1234';
await $.tester.enterText(find.byType(Pinput), pinValue);
await $.tester.testTextInput.receiveAction(TextInputAction.done);
await $.tester.pumpAndSettle();

测试输出显示输入未被Pinput组件正确接收,组件未填充预期的"1234"内容。该问题已提交至Pinput的GitHub仓库issue #140,寻求解决方法。

内容的提问来源于stack exchange,提问作者yash oza

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 22:18:14