I saw the below API in GREYConfiguration
that says that EarlGrey by default truncates CALayer animations more than 10 seconds -
/**
* Configuration for setting max allowable animation duration (in seconds) for any CALayer based
* animation. Animations exceeding the specified time will have their duration truncated to value
* specified by this config.
*
* Accepted values: @c double (negative values shouldn't be used)
* Default value: 10.0
*/
GREY_EXTERN NSString *const kGREYConfigKeyCALayerMaxAnimationDuration;
I'm developing a small gaming app that has a number of such animations going on. I noticed that my tests take a long time to run when I have my animations enabled, which is required for my UI Tests. I know that I can change the animation speed for my entire app using UIApplication.sharedApplication.keyWindow.layer.speed
. Is there any way that I can change it only for my EarlGrey tests?
Put your UIApplication.sharedApplication.keyWindow.layer.speed
behind a conditional statement:
#if EARLGREY_ENV
UIApplication.sharedApplication.keyWindow.layer.speed = 100
#endif
The line of code will only execute when the app is being run through Earl Grey.
For more information around dealing with animations in Earl Grey, see How should I handle animations? under their FAQs.