0

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.

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.

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!

ArielSD
  • 829
  • 10
  • 27

2 Answers2

1

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

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

[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.

ArielSD
  • 829
  • 10
  • 27
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

Gautam
  • 286
  • 1
  • 3
  • I was hoping you'd respond, @Gautam! The network wait is necessary, because the data that comes back is used to build elements that the rest of the test interacts with. Have you heard of anything like this before? – ArielSD Feb 08 '17 at 22:24
  • I think that EarlGrey would wait, except that the animation gets frozen. – ArielSD Feb 08 '17 at 22:53
  • I am surprised that Animation gets frozen because I have seen network intensive apps at google use EarlGrey without any issue with animations. To further understand the situation: any idea how the animations are implemented? [UIView animation](https://developer.apple.com/reference/uikit/uiview/1622515-animatewithduration) ? Some lower leve CoreAnimation? – Gautam Feb 08 '17 at 23:25
  • It's using [Shimmer](https://github.com/facebook/Shimmer). The use CoreGraphics, UIKit, and QuartzCore/CALayer? – ArielSD Feb 09 '17 at 03:22