diff --git a/AppFramework/AutomationSetup/GREYAutomationSetup.m b/AppFramework/AutomationSetup/GREYAutomationSetup.m index c7ae2b121..3fc7825f8 100644 --- a/AppFramework/AutomationSetup/GREYAutomationSetup.m +++ b/AppFramework/AutomationSetup/GREYAutomationSetup.m @@ -24,7 +24,9 @@ @implementation GREYAutomationSetup + (void)load { // Force software keyboard. - [[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO]; + dispatch_async(dispatch_get_main_queue(), ^{ + [[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO]; + }); } @end diff --git a/TestLib/XCTestCase/XCUIApplication+GREYEnvironment.m b/TestLib/XCTestCase/XCUIApplication+GREYEnvironment.m index df82d5d3a..116bfebf4 100644 --- a/TestLib/XCTestCase/XCUIApplication+GREYEnvironment.m +++ b/TestLib/XCTestCase/XCUIApplication+GREYEnvironment.m @@ -20,14 +20,16 @@ @implementation XCUIApplication (GREYEnvironment) - (void)grey_configureApplicationForLaunch { NSMutableDictionary *mutableEnv = [self.launchEnvironment mutableCopy]; - NSString *insertionKey = @"DYLD_INSERT_LIBRARIES"; - NSString *insertionValue = @"@executable_path/Frameworks/AppFramework.framework/AppFramework"; - NSString *alreadyExistingValue = [mutableEnv valueForKey:insertionKey]; - NSArray *existingValues = [alreadyExistingValue componentsSeparatedByString:@":"]; - if (existingValues && ![existingValues containsObject:insertionValue]) { - insertionValue = [NSString stringWithFormat:@"%@:%@", alreadyExistingValue, insertionValue]; + if (![mutableEnv[@"EG_SKIP_INSERT_LIBRARIES"] isEqualToString:@"YES"]) { + NSString *insertionKey = @"DYLD_INSERT_LIBRARIES"; + NSString *insertionValue = @"@executable_path/Frameworks/AppFramework.framework/AppFramework"; + NSString *alreadyExistingValue = [mutableEnv valueForKey:insertionKey]; + NSArray *existingValues = [alreadyExistingValue componentsSeparatedByString:@":"]; + if (existingValues && ![existingValues containsObject:insertionValue]) { + insertionValue = [NSString stringWithFormat:@"%@:%@", alreadyExistingValue, insertionValue]; + } + [mutableEnv setObject:insertionValue forKey:insertionKey]; } - [mutableEnv setObject:insertionValue forKey:insertionKey]; // Pass in this flag so logging is enabled for the application process for both NSLog and OSLog. mutableEnv[@"OS_ACTIVITY_DT_MODE"] = @"YES";