iOS 13 Support (#1648)

* Update RN to 0.60.5

* iOS 13 support

* Support Xcode 11 building of Detox

* Support shake on iOS 13

* Update Earl Grey to use latest fishhook for iOS 13 support

* Compile detox with its own fishhook (from EG)

* Update package.json

* Run on iPhone 11 Pro simulator

* xcpretty
This commit is contained in:
Leo Natan
2019-09-24 16:11:28 +03:00
committed by GitHub
parent a914b8353d
commit 2455b4b8fe
13 changed files with 44 additions and 27 deletions
@@ -70,6 +70,8 @@
39CE25AC22197F0900D78AA1 /* DetoxInstrumentsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 39CE25AA22197F0900D78AA1 /* DetoxInstrumentsManager.m */; };
39CEFCDB1E34E91B00A09124 /* DetoxUserNotificationDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CEFCDA1E34E91B00A09124 /* DetoxUserNotificationDispatcher.swift */; };
39DA0E2822D72AEF001E63A0 /* UIApplication+MockedSharedApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 39DA0E2722D72AEF001E63A0 /* UIApplication+MockedSharedApplication.m */; };
39F62D41233730F500094FAB /* fishhook.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F62D39233730F500094FAB /* fishhook.h */; };
39F62D42233730F500094FAB /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 39F62D40233730F500094FAB /* fishhook.c */; };
39F642281FDD5EB100468FED /* DTXLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 39F642201FDD5EB000468FED /* DTXLogging.h */; };
39F642291FDD5EB100468FED /* DTXLogging.m in Sources */ = {isa = PBXBuildFile; fileRef = 39F642271FDD5EB000468FED /* DTXLogging.m */; };
39FFD9471FD730A600C97030 /* DetoxCrashHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39FFD9451FD730A600C97030 /* DetoxCrashHandler.mm */; };
@@ -253,6 +255,8 @@
39DA0E2622D72AEF001E63A0 /* UIApplication+MockedSharedApplication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIApplication+MockedSharedApplication.h"; sourceTree = "<group>"; };
39DA0E2722D72AEF001E63A0 /* UIApplication+MockedSharedApplication.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+MockedSharedApplication.m"; sourceTree = "<group>"; };
39DA0E3522D72C91001E63A0 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
39F62D39233730F500094FAB /* fishhook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fishhook.h; path = EarlGrey/fishhook/fishhook.h; sourceTree = SOURCE_ROOT; };
39F62D40233730F500094FAB /* fishhook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fishhook.c; path = EarlGrey/fishhook/fishhook.c; sourceTree = SOURCE_ROOT; };
39F642201FDD5EB000468FED /* DTXLogging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTXLogging.h; path = DTXLoggingInfra/DTXLogging.h; sourceTree = SOURCE_ROOT; };
39F642271FDD5EB000468FED /* DTXLogging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTXLogging.m; path = DTXLoggingInfra/DTXLogging.m; sourceTree = SOURCE_ROOT; };
39F6422A1FDD5EEC00468FED /* Detox.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Detox.pch; sourceTree = "<group>"; };
@@ -367,6 +371,8 @@
394767991DBF985400D72256 /* Detox */ = {
isa = PBXGroup;
children = (
39F62D39233730F500094FAB /* fishhook.h */,
39F62D40233730F500094FAB /* fishhook.c */,
39F642201FDD5EB000468FED /* DTXLogging.h */,
39F642271FDD5EB000468FED /* DTXLogging.m */,
39F6422B1FDD5F3300468FED /* DTXLoggingSubsystem.h */,
@@ -495,6 +501,7 @@
A7F76A151ED33DE500FFE77E /* WXAnimatedDisplayLinkIdlingResource.h in Headers */,
394767AE1DBF987E00D72256 /* DetoxManager.h in Headers */,
468731A51E6C6D0500F151BE /* EarlGrey+Detox.h in Headers */,
39F62D41233730F500094FAB /* fishhook.h in Headers */,
399BF36821933F0C00F96D50 /* ExternalLogging.h in Headers */,
394767CD1DBF98D900D72256 /* ReactNativeHeaders.h in Headers */,
394767D41DBF98D900D72256 /* WXRunLoopIdlingResource.h in Headers */,
@@ -731,6 +738,7 @@
394767B11DBF987E00D72256 /* DTXMethodInvocation.m in Sources */,
39CEFCDB1E34E91B00A09124 /* DetoxUserNotificationDispatcher.swift in Sources */,
394767C21DBF98A700D72256 /* GREYMatchers+Detox.m in Sources */,
39F62D42233730F500094FAB /* fishhook.c in Sources */,
394767AF1DBF987E00D72256 /* DetoxManager.m in Sources */,
398260E8220CC9530061E83E /* GREYActions+Detox.m in Sources */,
39FFD9471FD730A600C97030 /* DetoxCrashHandler.mm in Sources */,
+1 -1
View File
@@ -6,7 +6,7 @@
// Copyright © 2017 Wix. All rights reserved.
//
#include <fishhook.h>
#include "fishhook.h"
#import <dlfcn.h>
#import <Foundation/Foundation.h>
#import "DetoxManager.h"
+2 -9
View File
@@ -16,6 +16,7 @@
#import "DetoxAppDelegateProxy.h"
#import "EarlGreyExtensions.h"
#import "EarlGreyStatistics.h"
#import <EarlGrey/GREYSyntheticEvents.h>
#import "DetoxInstrumentsManager.h"
@@ -325,7 +326,7 @@ static void detoxConditionalInit()
else if([type isEqualToString:@"shakeDevice"])
{
[EarlGrey detox_safeExecuteSync:^{
[self _sendShakeNotification];
[GREYSyntheticEvents shakeDeviceWithError:NULL];
[self _safeSendAction:@"shakeDeviceDone" params:@{} messageId:messageId];
}];
@@ -411,14 +412,6 @@ static void detoxConditionalInit()
[self.webSocket sendAction:@"AppWillTerminateWithError" withParams:details withMessageId:@-10000];
}
//TODO: Replace once Earl Grey has accepted PR to add this there: https://github.com/google/EarlGrey/pull/679
- (void)_sendShakeNotification
{
//This behaves exactly in the same manner that UIApplication handles the simulator "Shake Gesture" menu command.
[[UIApplication sharedApplication] _sendMotionBegan:UIEventSubtypeMotionShake];
[[UIApplication sharedApplication] _sendMotionEnded:UIEventSubtypeMotionShake];
}
- (void)_handlePerformanceRecording:(NSDictionary*)props isFromLaunch:(BOOL)launch completionHandler:(void(^)(void))completionHandler
{
if(completionHandler == nil)
+4
View File
@@ -28,6 +28,7 @@
@property(readonly, nonatomic) UIKeyboardTaskQueue *taskQueue;
- (void)handleKeyWithString:(id)arg1 forKeyEvent:(id)arg2 executionContext:(id)arg3;
- (void)setShift:(_Bool)arg1 autoshift:(_Bool)arg2;
- (void)removeCandidateList;
@end
@@ -53,6 +54,9 @@ static void _DTXTypeText(NSString* text)
[NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[UIKeyboardImpl.sharedInstance removeCandidateList];
rangeIdx += range.length;
}
}
+2
View File
@@ -105,6 +105,8 @@ id<GREYMatcher> detox_grey_parent(id<GREYMatcher> ancestorMatcher)
+ (id<GREYMatcher>)detoxMatcherAvoidingProblematicReactNativeElements:(id<GREYMatcher>)matcher
{
matcher = grey_allOf(matcher, grey_not(grey_kindOfClass(NSClassFromString(@"UIAccessibilityTextFieldElement"))), nil);
//No RN—Life is always good.
Class RN_RCTScrollView = NSClassFromString(@"RCTScrollView");
if (!RN_RCTScrollView)
+1 -1
View File
@@ -19,7 +19,7 @@
#include <dlfcn.h>
#include <stdatomic.h>
#include <fishhook.h>
#include "fishhook.h"
@import ObjectiveC;
@import Darwin;
+1 -1
View File
@@ -8,7 +8,7 @@
#import "ReactNativeSupportNoARC.h"
#include <dlfcn.h>
#include <fishhook.h>
#include "fishhook.h"
Class (*__orig_objc_lookUpClass)(const char * name);
Class __dtx_objc_lookUpClass(const char * name)
+1 -1
View File
@@ -9,7 +9,7 @@
#import "WXRunLoopIdlingResource.h"
#import <stdatomic.h>
#include <dlfcn.h>
#include <fishhook.h>
#include "fishhook.h"
#import <pthread.h>
@import ObjectiveC;
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash -e -x
#!/bin/bash -e
# Ensure Xcode is installed or print a warning message and return.
xcodebuild -version &>/dev/null || { echo "WARNING: Xcode is not installed on this machine. Skipping iOS framework build phase"; exit 0; }
+14 -4
View File
@@ -17,16 +17,26 @@ rm -fr "${OUTPUT_DIR}/${PROJECT_NAME}.framework"
TEMP_DIR=$(mktemp -d "$TMPDIR"DetoxBuild.XXXX)
echo TEMP_DIR = "${TEMP_DIR}"
# Step 0. Xcode version
XCODEVERSION=$(xcodebuild -version | grep -oEi "([0-9]*\.[0-9]*)")
echo "Xcode ${XCODEVERSION}"
USE_NEW_BUILD_SYSTEM="YES"
if [ "${XCODEVERSION}" != "`echo -e "${XCODEVERSION}\n11.0" | sort --version-sort -r | head -n1`" ]; then
USE_NEW_BUILD_SYSTEM="NO"
fi
echo "Using -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM}"
# Step 1. Build Device and Simulator versions
BUILD_IOS=`xcodebuild -project "${PROJECT}" -UseNewBuildSystem=NO -scheme Detox ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" -arch arm64 -sdk iphoneos VALID_ARCHS=arm64 -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
BUILD_SIM=`xcodebuild -project "${PROJECT}" -UseNewBuildSystem=NO -scheme Detox -configuration "${CONFIGURATION}" -arch x86_64 -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO VALID_ARCHS=x86_64 -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
BUILD_IOS=`xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch arm64 -sdk iphoneos ONLY_ACTIVE_ARCH=NO VALID_ARCHS=arm64 -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
BUILD_SIM=`xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch x86_64 -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO VALID_ARCHS=x86_64 -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
echo ${BUILD_IOS}
echo ${BUILD_SIM}
xcodebuild -project "${PROJECT}" -UseNewBuildSystem=NO -scheme Detox ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" -arch arm64 -sdk iphoneos build VALID_ARCHS=arm64
xcodebuild -project "${PROJECT}" -UseNewBuildSystem=NO -scheme Detox -configuration "${CONFIGURATION}" -arch x86_64 -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO build VALID_ARCHS=x86_64
xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch arm64 -sdk iphoneos ONLY_ACTIVE_ARCH=NO clean build VALID_ARCHS=arm64
xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch x86_64 -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO build VALID_ARCHS=x86_64
# Step 2. Copy the framework structure (from iphoneos build) to the universal folder
+7 -7
View File
@@ -24,8 +24,8 @@
},
"dependencies": {
"moment": "^2.24.0",
"react": "16.8.3",
"react-native": "0.59.9"
"react": "16.8.6",
"react-native": "0.60.5"
},
"devDependencies": {
"@babel/core": "^7.4.5",
@@ -46,20 +46,20 @@
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
"build": "set -o pipefail && xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example_ci -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"build": "set -o pipefail && xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example_ci -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
"name": "iPhone 11 Pro"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/example.app",
"build": "set -o pipefail && export CODE_SIGNING_REQUIRED=NO && export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example_ci -configuration Release -sdk iphonesimulator -derivedDataPath ios/build | xcpretty",
"build": "set -o pipefail && export CODE_SIGNING_REQUIRED=NO && export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example_ci -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
"name": "iPhone 11 Pro"
},
"ios.none": {
"binaryPath": "ios",
"type": "ios.none",
"name": "iPhone X",
"name": "iPhone 11 Pro",
"session": {
"server": "ws://localhost:8099",
"sessionId": "com.wix.detox-example"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash -e
set -o pipefail && xcodebuild -project detox/ios/Detox.xcodeproj -scheme Detox -configuration Debug -sdk iphonesimulator build-for-testing | xcpretty
set -o pipefail && xcodebuild -project detox/ios/Detox.xcodeproj -scheme Detox -configuration Debug -sdk iphonesimulator test-without-building -destination 'platform=iOS Simulator,name=iPhone 7 Plus'
set -o pipefail && xcodebuild -project detox/ios/Detox.xcodeproj -scheme Detox -configuration Debug -sdk iphonesimulator test-without-building -destination 'platform=iOS Simulator,name=iPhone 11 Pro'