菜鸟教程小白 发表于 2022-12-11 19:36:49

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


                                            <p><p>我们在运行 wix/detox UI 测试时遇到问题。它们的速度慢得令人无法忍受。</p>

<p>我们尝试尽可能消除一切,我们禁用了所有后台进程,我们删除了几乎整个 UI 元素,我们尝试禁用自动同步,但没有任何帮助。它肯定比排毒文档中的动画慢一个数量级。</p>

<p>只有 1 个按钮的简单应用,单击该按钮大约需要 1.5 秒,当尝试在我们 UI 的某些部分上运行测试时,需要 40 秒,但按钮和文本输入很少。</p>

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

<p>典型日志:</p>

<pre><code>Timed: animateWithDuration:delay:options:animations:completion:
Timed: animateWithDuration:delay:options:animations:completion:
Timed: animateWithDuration:delay:options:animations:completion:
Timed: animateWithDuration:delay:options:animations:completion:
</code></pre>

<p>(即使没有动画)</p>

<p>或者:</p>

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

<p>库版本</p>

<p>排毒:6.0.0、6.0.4、7.0.0-alpha</p>

<p> react 原生:0.51.0</p>

<p>开玩笑:20.0.4</p>

<p>(我们也试过mocha,没有变化)</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p><strong>就我而言</strong>,我有背景 <a href="https://github.com/redux-saga/redux-saga" rel="noreferrer noopener nofollow">Redux Saga</a>每 1 秒运行一次(代码在以 <code>yield call(delay, 1000)</code> 结尾的循环中运行。</p>

<p>1 秒的时间间隔太紧,Detox 无法释放。将延迟更改为 2000 即可解决问题。</p>

<p>计时器的紧密度可能取决于您拥有的背景 sagas 的数量。以 2000 毫秒的间隔运行 2 个 saga 可能有效,但以相同的间隔运行 100 个 saga 可能不行。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 使用 React Native 进行排毒 UI 测试非常慢,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/48279760/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/48279760/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 使用 React Native 进行排毒 UI 测试非常慢