排毒:iOS 模拟器如何按键盘上的下一步

Detox: iOS Simulator how to press Next on keyboard

输入用户电子邮件地址后,我希望 Detox 按“下一步”移动到密码字段。

我尝试通过元素 id 查找密码字段并调用 .tap() 获得焦点,但键盘部分遮挡了密码字段并且无法通过 75% 的可见性标准。

Error Trace: [
  {
    "Description" : "Assertion with matcher [M] failed: UI element [E] failed to match the following matcher(s): [S]",
    "Description Glossary" :     {
      "M" : "matcherForSufficientlyVisible(>=0.750000)",
      "E" : "<RCTUITextField:0x7f9abd45f190; AX=Y; AX.id='Password Input'; AX.value='your new password'; AX.frame={{42.5, 342.5}, {235, 40}}; AX.activationPoint={160, 362.5}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {235, 40}}; alpha=1; text=''>",
      "S" : "matcherForSufficientlyVisible(>=0.750000)"
    },
    "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
    "Error Code" : "3",
    "File Name" : "GREYAssertions.m",
    "Function Name" : "+[GREYAssertions grey_createAssertionWithMatcher:]_block_invoke",
    "Line" : "75"
  }
]

知道如何解决这个问题吗?我正在使用 detox 来测试 react-native 应用程序。

谢谢。

事实证明它就像在文本输入的末尾添加 \n 一样简单,如下所示:

const email = 'test@email.com';
await element(by.id('email_input')).typeText(`${email}\n`);