detox - Detox IOS - 由于连续动画错误导致测试失败,disableSynchronization 不起作用
问题描述
请多多包涵,我是排毒新手!我目前正在评估 Detox 作为一种众所周知的非常慢的黑盒自动化工具的替代品!
环境噪声
- 排毒: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.disableSynchronization
而device.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 代码中是否需要更改某些内容 - 这对我们来说将是一个大问题!
谢谢你的帮助。
解决方案
从 Detox 文档中waitFor()
,toHaveValue()
应附有expect
声明。https://github.com/wix/detox/blob/master/docs/APIRef.waitFor.md#tohavevaluevalue
如下图expect()
后添加。waitFor()
await waitFor(element(by.id('app-title'))).toHaveValue('DISCOVER').withTimeout(20000);
await expect(element(by.id('app-title'))).toHaveValue('DISCOVER');
推荐阅读
- javascript - 如何在重力形式中创建一个切换按钮,一旦在wordpress中从打开更改为关闭,该按钮就会冻结?
- junit - 骆驼 - 有问题的建议
- vi - 在 vi 编辑器中,我如何将单词保存在多个缓冲区中并在我想要的任何地方使用它们(无需一次又一次地复制)
- mysql - 为什么 MySQL SUM 查询只返回一行?
- asp.net-core-webapi - 在 EFCore 和 .net Core2.0 中与 DbContext 的多重连接
- python - 将N维numpy数组展平,形成K维数组(K≠1,K
假设我有一个三维数组,我将其称为
A
,其中第一维等于 N。如何找到B
,相当于:np.concatenate((A[0],A[1],A[2],...,A[N-1]),axis=1)
例如,假设我有:
A = np.array([[[1,2,3,4],
- pointers - 更改通过引用传递的结构的值
- mysql - 创建 MySQL 存储过程时出错
- editor - Alchemy CMS - 管理 UI - 编辑器 - 显示在所有页面区域
- excel - 添加评论时的条件格式