使用React Native,Detox UI测试非常慢

时间:2018-01-16 11:04:35

标签: ios react-native detox

我们在运行wix / detox UI测试时遇到问题。它们的速度令人难以忍受。

我们试图消除我们所能做的一切,我们禁用了所有后台进程,我们删除了几乎所有的UI元素,我们尝试禁用自动同步但没有任何帮助。它肯定比排毒文档中的动画要慢一些。

只有1个按钮的简单应用程序,单击该按钮大约需要1.5秒,当我尝试在UI的某些部分上运行测试时,它需要40秒,但只有几个按钮和文本输入。

结果是我们的整个测试套件运行30分钟(我们仍然没有涵盖我们想要的所有内容)。

典型日志:

Timed: animateWithDuration:delay:options:animations:completion:
Timed: animateWithDuration:delay:options:animations:completion:
Timed: animateWithDuration:delay:options:animations:completion:
Timed: animateWithDuration:delay:options:animations:completion:

(即使没有动画)

或者:

send: {"type":"currentStatus","params":{},"messageId":676}
send: {"type":"currentStatus","params":{},"messageId":677}
send: {"type":"currentStatus","params":{},"messageId":678}
send: {"type":"currentStatus","params":{},"messageId":679}
onMessage: {"type":"currentStatusResult","messageId":668,"params":{"state":"busy","resources":[{"name":"Dispatch Queue","info":{"queue":"<OS_dispatch_queue_main: com.apple.main-thread[0x11692fdc0] = { xref = -2147483648, ref = -2147483648, sref = 1, target = com.apple.root.default-qos.overcommit[0x116931300], width = 0x1, state = 0x001ffe9e00000300, dirty, max qos 6, in-flight = 0, thread = 0x303 }>","prettyPrint":"com.apple.main-thread"}}],"messageId":668}}
rbx
Dispatch Queue: com.apple.main-thread
onMessage: {"type":"currentStatusResult","messageId":669,"params":{"state":"busy","resources":[{"name":"Dispatch Queue","info":{"queue":"<OS_dispatch_queue_main: com.apple.main-thread[0x11692fdc0] = { xref = -2147483648, ref = -2147483648, sref = 1, target = com.apple.root.default-qos.overcommit[0x116931300], width = 0x1, state = 0x001ffe9e00000300, dirty, max qos 6, in-flight = 0, thread = 0x303 }>","prettyPrint":"com.apple.main-thread"}}],"messageId":669}}
rbx
Dispatch Queue: com.apple.main-thread
send: {"type":"currentStatus","params":{},"messageId":680}
send: {"type":"currentStatus","params":{},"messageId":681}
send: {"type":"currentStatus","params":{},"messageId":682}
onMessage: {"type":"currentStatusResult","messageId":670,"params":{"state":"busy","resources":[{"name":"Dispatch Queue","info":{"queue":"<OS_dispatch_queue_main: com.apple.main-thread[0x11692fdc0] = { xref = -2147483648, ref = -2147483648, sref = 1, target = com.apple.root.default-qos.overcommit[0x116931300], width = 0x1, state = 0x001ffe9e00000300, dirty, max qos 6, in-flight = 0, thread = 0x303 }>","prettyPrint":"com.apple.main-thread"}}],"messageId":670}}
rbx

图书馆版本

排毒:6.0.0,6.0.4,7.0.0-alpha

react-native:0.51.0

开玩笑:20.0.4

(我们也试过摩卡,没有变化)

1 个答案:

答案 0 :(得分:0)

就我而言,我有一个背景Redux Saga每1秒运行一次(代码以yield call(delay, 1000)结尾的循环运行。

1秒间隔太短,无法排毒。将延迟更改为2000可解决此问题。

计时器的松紧度可能取决于您拥有的背景杂色的数量。以2000ms的间隔运行2次sagas可能有效,但以相同的间隔运行100次sagas可能无效。