【问题标题】:I can not answer the native iOS confirm Detox - mocha application in React native我无法回答原生 iOS 确认 Detox - React native 中的 mocha 应用
【发布时间】:2019-11-13 22:01:01
【问题描述】:

我刚开始使用 Detox 来测试我的 react native 应用程序,我在回答原生确认时遇到了一些麻烦。

我没有找到_UI的列表......查看 (如:_UIAlertControllerActionView、_UINavigationBarBackIndicatorView)

it('should show world screen after tap', async () => {

    await loginPage.getFbBtn().tap();    
    // await element(by.type('_UINavigationBarBackIndicatorView')).tap(); 
    //await element(by.text('Continue')).tap();
    await element(by.text('Continue').and(by.type('_UIAlertControllerActionView'))).tap();
  });

元素(by.type('_UINavigationBarBackIndicatorView')).tap();

(节点:2009)UnhandledPromiseRejectionWarning:错误:找不到 UI 元素。 操作异常:{ “动作名称”:“点击”, "元素匹配器": "((!(kindOfClass('RCTScrollView')) && kindOfClass('(null)')) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass( 'RCTScrollView'))) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('(null)')))))", "Recovery Suggestion": "检查下打印的UI层级中是否存在该元素,如果存在,调整匹配器,使其准确匹配元素。" }

错误跟踪:[ { "Description": "交互无法继续,因为找不到所需的元素。", "错误域": "com.google.earlgrey.ElementInteractionErrorDomain", “错误代码”:“0”, "文件名": "GREYElementInteraction.m", "函数名称": "-[GREYElementInteractionmatchedElementsWithTimeout:error:]", “行”:“124” } ]

等待元素(by.text('Continue')).tap();

错误:找不到 UI 元素。 操作异常:{ “动作名称”:“点击”, "元素匹配器": "((!(kindOfClass('RCTScrollView')) && (((kindOfClass('UILabel') || kindOfClass('UITextField') || kindOfClass('UITextView')) && hasText('Continue' )) || (kindOfClass('RCTTextView') && an object with accessibilityLabel "Continue"))) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('RCTScrollView')) ) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches((((kindOfClass('UILabel') || kindOfClass('UITextField') || kindOfClass('UITextView')) && hasText(' Continue')) || (kindOfClass('RCTTextView') && an object with accessibilityLabel "Continue"))))))", "Recovery Suggestion": "检查下打印的UI层级中是否存在该元素,如果存在,调整匹配器,使其准确匹配元素。" }

等待元素(by.text('Continue').and(by.type('_UIAlertControllerActionView'))).tap(); 错误:找不到 UI 元素。

【问题讨论】:

    标签: react-native detox


    【解决方案1】:

    这不是您可以与之交互的警报。该警报由与您的应用程序不同的进程呈现,并且 Detox 无法与之交互。相反,您应该模拟显示这一点的 API。

    【讨论】:

      猜你喜欢
      • 2021-11-26
      • 2021-09-14
      • 1970-01-01
      • 2012-04-05
      • 2019-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      相关资源
      最近更新 更多