排毒IOS-由于连续动画错误导致测试失败,disableSynchronization不起作用

时间:2018-09-24 13:07:58

标签: detox

请多多包涵,我是排毒新手!我目前正在评估Detox,以替代众所周知的非常慢的黑匣子自动化工具!

ENV

  • 排毒:v9.0.1
  • xcode:v9.4.1
  • macOS:High Sierra 10.13.2

使用以下命令执行测试:     detox test --debug-synchronization --loglevel trace

我正在编写一个自动化测试,该测试将登录到我们的应用程序并验证登录页面。登录后,我无法识别任何元素,因为我得到的错误是:

"appState": "Waiting for an animation to finish. Continuous animations may never finish and must be stopped explicitly. Animations attached to hidden view may still be running in the background.\nWaiting for view's draw or layout pass to complete."

detox[94060] INFO:  [actions.js] Sync Timed: 
animateWithDuration:delay:options:animations:completion:
detox[94060] INFO:  [actions.js] Sync Timed: performSelector 
@selector(removeInactiveFingerTips) on DTXTouchVisualizerWindow
detox[94060] INFO:  [actions.js] Sync App State: undefined
detox[94060] INFO:  [actions.js] Sync Dispatch Queue: com.apple.main- 
thread
detox[94060] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] 
{"type":"cleanupDone","messageId":8,"params":{}}

我已将URL添加到黑名单中,这有助于消除一些错误,现在我将自己的步骤包裹在device.disableSynchronizationdevice.enableSynchronization的众多组合中,这似乎无济于事。请查看我当前的测试版本:

describe('Signon and browse', () => {
beforeEach(async () => {
  await device.reloadReactNative();
});

 it('I log into the app', async () => {
     await element(by.id('input_username')).replaceText('mysername');
     await element(by.id('input_password')).replaceText('mypassword');
     await element(by.id('button-signon')).tap();
     await device.disableSynchronization();
     await waitFor(element(by.id('app-title'))).toHaveValue('DISCOVER').withTimeout(20000);
     await device.enableSynchronization();
 })
});

我是测试自动化开发人员,而不是该应用程序的ReactNative开发人员,因此,我不确定实际的ReactNative代码中是否需要更改某些内容-对于我们来说这将是一个大问题!

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

foreach ($allUsers as $user) { $groups = $user->getUserGroup(); ... } 的Detox文档中,waitFor()应该带有toHaveValue()语句。 https://github.com/wix/detox/blob/master/docs/APIRef.waitFor.md#tohavevaluevalue

expect之后添加expect(),如下所示。

waitFor()