我正在尝试使用 Detox 为我的应用程序编写测试。但是在从登录屏幕导航屏幕时,由于找不到匹配器,我的测试失败了。我在渲染函数中正确添加了 testID 仍然出现错误。这是我的测试代码:
it('should login successfully', async () => {
await device.reloadReactNative();
await element(by.id('textInput_username_login')).typeText('test');
await element(by.id('textInput_password_login')).typeText('123456');
await element(by.text('Log In')).tap();
await expect(element(by.id('otp'))).toBeVisible();
});
出现以下错误:
Test Failed: No elements found for “MATCHER(identifier == “ otp” && NOT DESCENDANT(class ⊇ “RCTTextView” && identifier == “ otp”))”
提前致谢。