EarlGrey冻结动画并且不会调用回调

时间:2022-04-17 10:28:45

There is a method with an asynchronous block as a parameter.

有一个异步块作为参数的方法。

The first time the app runs, this method is called, and there is an animation that covers the entire screen. The method is making a network call that can take a pretty long time, around 7 seconds or so. When the block runs, the callback ends the animation and the app is ready to be interacted with again.

应用程序第一次运行时,会调用此方法,并且有一个覆盖整个屏幕的动画。该方法正在进行网络呼叫,这可能需要相当长的时间,大约7秒左右。当块运行时,回调结束动画并且应用程序准备好再次与之交互。

When I run the app in the simulator and tap around, everything runs as it should. When I run the EarlGrey test target, the animation freezes, and the test ultimately fails, because there is an element that can't be found. Behind the animation view (a subclass of UIView), some steps are still successfully carried out, even though the elements are not visible.

当我在模拟器中运行应用程序并点击时,一切都按预期运行。当我运行EarlGrey测试目标时,动画会冻结,测试最终会失败,因为有一个元素无法找到。在动画视图(UIView的子类)后面,即使元素不可见,仍然可以成功执行某些步骤。

Lastly, this only happens on the first run of the app, since the network call in subsequent test runs is much shorter.

最后,这只发生在应用程序的第一次运行,因为后续测试运行中的网络调用要短得多。

I've tried changing configurations to disable animations, and nothing seems to work for me. I can't really paste code, since the app is proprietary.

我已经尝试更改配置以禁用动画,似乎没有什么对我有用。我无法真正粘贴代码,因为该应用程序是专有的。

I'm happy to answer any and all clarifying questions, and very much looking forward to some help!

我很乐意回答任何澄清问题,非常期待一些帮助!

2 个解决方案

#1


1  

Disclaimer: This was all @khandpur. I joined the Google Open Source Slack channel, and he helped me debug hard.

免责声明:这都是@khandpur。我加入了Google Open Source Slack频道,他帮我调试了很多。

The issue was the use of Facebook's Shimmer. I had this line in the setUp method:

问题在于使用Facebook的Shimmer。我在setUp方法中有这一行:

[UIApplication sharedApplication].keyWindow.layer.speed = 100;

[UIApplication sharedApplication] .keyWindow.layer.speed = 100;

This was speeding up animations, but causing some conflict with shimmer, not too sure why. I'm going to comment in their repo.

这加速了动画,但是引起了一些闪光的冲突,不太确定为什么。我要在他们的回购中发表评论。

I deleted that line, and while tests are a little slower, they're totally stable now.

我删除了那一行,虽然测试速度稍慢,但它们现在完全稳定了。

#2


0  

Have you considered using kGREYConfigKeyURLBlacklistRegex to black list the URL, i.e prevent EarlGrey from waiting on the request? (assuming that the network wait is unnecessary for ur test). see EarlGrey/Common/GREYConfiguration.h

您是否考虑过使用kGREYConfigKeyURLBlacklistRegex将URL列入黑名单,即阻止EarlGrey等待请求? (假设你的测试不需要网络等待)。见EarlGrey / Common / GREYConfiguration.h

#1


1  

Disclaimer: This was all @khandpur. I joined the Google Open Source Slack channel, and he helped me debug hard.

免责声明:这都是@khandpur。我加入了Google Open Source Slack频道,他帮我调试了很多。

The issue was the use of Facebook's Shimmer. I had this line in the setUp method:

问题在于使用Facebook的Shimmer。我在setUp方法中有这一行:

[UIApplication sharedApplication].keyWindow.layer.speed = 100;

[UIApplication sharedApplication] .keyWindow.layer.speed = 100;

This was speeding up animations, but causing some conflict with shimmer, not too sure why. I'm going to comment in their repo.

这加速了动画,但是引起了一些闪光的冲突,不太确定为什么。我要在他们的回购中发表评论。

I deleted that line, and while tests are a little slower, they're totally stable now.

我删除了那一行,虽然测试速度稍慢,但它们现在完全稳定了。

#2


0  

Have you considered using kGREYConfigKeyURLBlacklistRegex to black list the URL, i.e prevent EarlGrey from waiting on the request? (assuming that the network wait is unnecessary for ur test). see EarlGrey/Common/GREYConfiguration.h

您是否考虑过使用kGREYConfigKeyURLBlacklistRegex将URL列入黑名单,即阻止EarlGrey等待请求? (假设你的测试不需要网络等待)。见EarlGrey / Common / GREYConfiguration.h