ios - 使用 React Native 进行 Detox UI 测试非常慢

标签 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

native react :0.51.0

开玩笑:20.0.4

(我们也尝试了mocha,没有变化)

最佳答案

在我的例子中,我有一个背景 Redux Saga每 1 秒运行一次(代码在以 yield call(delay, 1000) 结束的循环中运行。

1 秒的间隔时间太短,无法免费使用 Detox。将延迟更改为 2000 解决了问题。

计时器的严密性可能取决于您拥有的背景故事的数量。以 2000 毫秒的间隔运行 2 个 sagas 可能有效,但以相同的间隔运行 100 个 sagas 可能行不通。

关于ios - 使用 React Native 进行 Detox UI 测试非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48279760/

相关文章:

node.js - 如何以编程方式启动/停止 Metro Bundler

ios - UITableView 和解析数据

ios - Parse IOS SDK 中的 AND (&) 析取

ios - 以编程方式 UISearchBar 未显示

javascript - Swift 等待 UIWebView 中 javascript 的页面加载

ios - 如何在 React 原生应用中使用原生 View

testing - Circleci macOS 盒子是否规范太低而无法运行 Detox?

javascript - react 原生 : Highlight component/area by darkening the rest

jestjs - 类型错误 : Cannot read property 'LENGTH_LONG' of undefined

react-native - 是否可以在排毒端到端测试期间模拟响应