I am facing the exact same problem now. The testing code hangs because it thinks the view is not quiet, although it in fact is. The problem is this code:
[UIView animateWithDuration:0.6 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionAllowUserInteraction animations:^ {
self.buttonFortune.center = CGPointMake(DEFAULTCENTER.x, DEFAULTCENTER.y + 3.0);
} completion:^(BOOL finished) {
self.buttonFortune.center = DEFAULTCENTER;
}];
It's just an ever repeating thing to make the main button in the interface move slightly (to make it tap-appealing). I can't believe this is an issue that is not being addressed so far, lots of people must have run into to it and found it so far? I mean this thread is from 2015, and now we are close to 2017. It should be easy to reproduce from above code. Do I need to report a bug (or feature req)?
Note the use of the options above: UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionAllowUserInteraction
UIViewAnimationOptionRepeat is probably the "culprit" here which makes the UI testing wait forever... (or time out after a long time, 30 seconds?). With the use of the UIViewAnimationOptionAllowUserInteraction option at least, this whole thing should not be an issue (alas it is).
Update: I should add that in fact the tests still work, however they are still unfeasable because the "idle-wait" process goes on for something like 30 seconds or more, and THEN proceeds (successfully, if no other problem). So the tests eventually likely pass, but it just takes a very, very long time.