Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AppFramework/Config/GREYAppConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ static BOOL IsStandaloneMode(void) {
kGREYConfigKeyInteractionTimeoutDuration : @(30),
kGREYConfigKeyCALayerMaxAnimationDuration : @(10),
kGREYConfigKeySynchronizationEnabled : @YES,
kGREYConfigKeyMainQueueTrackingEnabled : @YES,
kGREYConfigKeyNSTimerMaxTrackableInterval : @(1.5),
kGREYConfigKeyCALayerModifyAnimations : @YES,
kGREYConfigKeyDispatchAfterMaxTrackableDelay : @(1.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ - (BOOL)isIdleNow {
if (trackerIsIdle && isDead) {
[[GREYUIThreadExecutor sharedInstance] deregisterIdlingResource:self];
}
return trackerIsIdle;
// In apps with unusually high main thread activity, the main thread may never be condidered
// idle, or may only rarely become idle. This is a safety valve to allow this tracker to be
// selectively disabled, because otherwise, tests that should take seconds can take minues or
// even hours.
BOOL mainQueueTrackingEnabled = [GREYConfiguration.sharedConfiguration
valueForConfigKey:kGREYConfigKeyMainQueueTrackingEnabled];
return trackerIsIdle || !mainQueueTrackingEnabled;
}

@end
10 changes: 10 additions & 0 deletions CommonLib/Config/GREYConfigKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ GREY_EXTERN GREYConfigKey const kGREYConfigKeyInteractionTimeoutDuration;
*/
GREY_EXTERN GREYConfigKey const kGREYConfigKeySynchronizationEnabled;

/**
* Configuration that enables or disables EarlGrey's main queue tracking. When disabled, Earl Grey
* will not wait for the main queue to become idle. All other synchronization remains enabled.
*
* @remark This can make apps with high levels of main thread activity testable. If you find
* yourself having to enable this, you should actively look for ways to move activity off of the
* main thread if at all possible, for both performance and battery life reasons.
*/
GREY_EXTERN GREYConfigKey const kGREYConfigKeyMainQueueTrackingEnabled;

/**
* Configuration that enables synchronization for different app state. By default, EarlGrey will
* wait for all tracked app state resources to be idle. Set this config value to options with @c
Expand Down
2 changes: 2 additions & 0 deletions CommonLib/Config/GREYConfigKey.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
GREYConfigKey const kGREYConfigKeyInteractionTimeoutDuration =
@"GREYConfigKeyInteractionTimeoutDuration";
GREYConfigKey const kGREYConfigKeySynchronizationEnabled = @"GREYConfigKeySynchronizationEnabled";
GREYConfigKey const kGREYConfigKeyMainQueueTrackingEnabled =
@"GREYConfigKeyMainQueueTrackingEnabled";
GREYConfigKey const kGREYConfigKeyNSTimerMaxTrackableInterval =
@"GREYConfigKeyNSTimerMaxTrackableInterval";
GREYConfigKey const kGREYConfigKeyCALayerModifyAnimations = @"GREYConfigKeyCALayerModifyAnimations";
Expand Down