【发布时间】:2018-06-25 01:46:24
【问题描述】:
我们在运行 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
反应原生:0.51.0
开玩笑:20.0.4
(我们也试过mocha,没有变化)
【问题讨论】:
-
从日志看来,动画仍在播放(可能是屏幕外?)。你确定没有动画在某个地方循环运行吗?
-
没有我知道的动画。有时您可以在 UI 层次结构中看到一些动画组件,但这些通常是 TouchableOpacity。但我试图删除所有可触摸的按钮,但仍然没有效果。除了可触摸的,实际上根本没有动画。我什至尝试创建一些最小的示例。即使对于只有很少标签的非常简单的应用程序,测试也很慢
-
所以这个动画 API 被 React Native 内部调用,原因不明。你能上传一个演示项目并在这里发布吗? @trubi
-
另外,你有没有闪烁的光标?
-
你好 Leo,这是一个示例项目 github.com/Crhaj/SampleApp-Detox 这是测试的屏幕截图 github.com/Crhaj/SampleApp-Detox/blob/master/testTimes.png 这些是同步日志 github.com/Crhaj/SampleApp-Detox/blob/master/detox_logs/… 这个示例应用程序看起来也很慢,而且非常简单。谢谢。
标签: ios react-native detox