Quellcode durchsuchen

upgrade example e2e tests to detox 5 + RN 44.2 (#1337)

Doron Pearl vor 7 Jahren
Ursprung
Commit
48fbe55599

+ 0
- 17
example/e2e/init.js Datei anzeigen

@@ -1,17 +0,0 @@
1
-/*eslint-disable*/
2
-const detox = require('detox');
3
-const config = require('../package.json').detox;
4
-
5
-before(function(done) {
6
-  this.timeout(120000);
7
-  detox.config(config);
8
-  detox.start(done);
9
-});
10
-
11
-afterEach(function(done) {
12
-  detox.waitForTestResult(done);
13
-});
14
-
15
-after(function(done) {
16
-  detox.cleanup(done);
17
-});

+ 0
- 2
example/e2e/mocha.opts Datei anzeigen

@@ -1,2 +0,0 @@
1
---recursive
2
---timeout 120000

+ 0
- 9
example/e2e/sanity.test.js Datei anzeigen

@@ -1,9 +0,0 @@
1
-describe('sanity', function() {
2
-  beforeEach(function(done) {
3
-    global.simulator.reloadReactNativeApp(done);
4
-  });
5
-
6
-  it('should have screen one showing', function() {
7
-    expect(element(by.label('Screen One'))).toBeVisible();
8
-  });
9
-});

+ 3
- 192
example/ios/example.xcodeproj/project.pbxproj Datei anzeigen

@@ -401,7 +401,7 @@
401 401
 			isa = PBXGroup;
402 402
 			children = (
403 403
 				7B9B39631DEB4076004A6281 /* libRCTAnimation.a */,
404
-				7B9B39651DEB4076004A6281 /* libRCTAnimation-tvOS.a */,
404
+				7B9B39651DEB4076004A6281 /* libRCTAnimation.a */,
405 405
 			);
406 406
 			name = Products;
407 407
 			sourceTree = "<group>";
@@ -484,7 +484,6 @@
484 484
 				13B07F8C1A680F5B00A75B9A /* Frameworks */,
485 485
 				13B07F8E1A680F5B00A75B9A /* Resources */,
486 486
 				00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
487
-				6956ED03EAA1831C238A5BB4 /* Copy Detox Framework */,
488 487
 			);
489 488
 			buildRules = (
490 489
 			);
@@ -657,10 +656,10 @@
657 656
 			remoteRef = 7B9B39621DEB4076004A6281 /* PBXContainerItemProxy */;
658 657
 			sourceTree = BUILT_PRODUCTS_DIR;
659 658
 		};
660
-		7B9B39651DEB4076004A6281 /* libRCTAnimation-tvOS.a */ = {
659
+		7B9B39651DEB4076004A6281 /* libRCTAnimation.a */ = {
661 660
 			isa = PBXReferenceProxy;
662 661
 			fileType = archive.ar;
663
-			path = "libRCTAnimation-tvOS.a";
662
+			path = libRCTAnimation.a;
664 663
 			remoteRef = 7B9B39641DEB4076004A6281 /* PBXContainerItemProxy */;
665 664
 			sourceTree = BUILT_PRODUCTS_DIR;
666 665
 		};
@@ -798,20 +797,6 @@
798 797
 			shellPath = /bin/sh;
799 798
 			shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
800 799
 		};
801
-		6956ED03EAA1831C238A5BB4 /* Copy Detox Framework */ = {
802
-			isa = PBXShellScriptBuildPhase;
803
-			buildActionMask = 2147483647;
804
-			files = (
805
-			);
806
-			inputPaths = (
807
-			);
808
-			name = "Copy Detox Framework";
809
-			outputPaths = (
810
-			);
811
-			runOnlyForDeploymentPostprocessing = 0;
812
-			shellPath = /bin/bash;
813
-			shellScript = "if [ -n \"$DEPLOY_DETOX_FRAMEWORK\" ]; then\nmkdir -p \"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncp -r \"${PROJECT_DIR}\"/../node_modules/detox/Detox.framework \"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\nfi";
814
-		};
815 800
 /* End PBXShellScriptBuildPhase section */
816 801
 
817 802
 /* Begin PBXSourcesBuildPhase section */
@@ -931,68 +916,6 @@
931 916
 			};
932 917
 			name = Release;
933 918
 		};
934
-		2C24A1398D388E120DDC2CA1 /* Debug_Detox */ = {
935
-			isa = XCBuildConfiguration;
936
-			buildSettings = {
937
-				ALWAYS_SEARCH_USER_PATHS = NO;
938
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
939
-				CLANG_CXX_LIBRARY = "libc++";
940
-				CLANG_ENABLE_MODULES = YES;
941
-				CLANG_ENABLE_OBJC_ARC = YES;
942
-				CLANG_WARN_BOOL_CONVERSION = YES;
943
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
944
-				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
945
-				CLANG_WARN_EMPTY_BODY = YES;
946
-				CLANG_WARN_ENUM_CONVERSION = YES;
947
-				CLANG_WARN_INT_CONVERSION = YES;
948
-				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
949
-				CLANG_WARN_UNREACHABLE_CODE = YES;
950
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
951
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
952
-				COPY_PHASE_STRIP = NO;
953
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
954
-				GCC_C_LANGUAGE_STANDARD = gnu99;
955
-				GCC_DYNAMIC_NO_PIC = NO;
956
-				GCC_OPTIMIZATION_LEVEL = 0;
957
-				GCC_PREPROCESSOR_DEFINITIONS = (
958
-					"DEBUG=1",
959
-					"$(inherited)",
960
-				);
961
-				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
962
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
963
-				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
964
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
965
-				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
966
-				GCC_WARN_UNUSED_FUNCTION = YES;
967
-				GCC_WARN_UNUSED_VARIABLE = YES;
968
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
969
-				MTL_ENABLE_DEBUG_INFO = YES;
970
-				ONLY_ACTIVE_ARCH = YES;
971
-				OTHER_LDFLAGS = "";
972
-				SDKROOT = iphoneos;
973
-			};
974
-			name = Debug_Detox;
975
-		};
976
-		5627D4C51CEC610E1744267F /* Debug_Detox */ = {
977
-			isa = XCBuildConfiguration;
978
-			buildSettings = {
979
-				BUNDLE_LOADER = "$(TEST_HOST)";
980
-				FRAMEWORK_SEARCH_PATHS = (
981
-					"$(SDKROOT)/Developer/Library/Frameworks",
982
-					"$(inherited)",
983
-				);
984
-				GCC_PREPROCESSOR_DEFINITIONS = (
985
-					"DEBUG=1",
986
-					"$(inherited)",
987
-				);
988
-				INFOPLIST_FILE = exampleTests/Info.plist;
989
-				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
990
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
991
-				PRODUCT_NAME = "$(TARGET_NAME)";
992
-				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example";
993
-			};
994
-			name = Debug_Detox;
995
-		};
996 919
 		83CBBA201A601CBA00E9B192 /* Debug */ = {
997 920
 			isa = XCBuildConfiguration;
998 921
 			buildSettings = {
@@ -1071,112 +994,6 @@
1071 994
 			};
1072 995
 			name = Release;
1073 996
 		};
1074
-		96FA810D67E56FD9D43906E6 /* Release_Detox */ = {
1075
-			isa = XCBuildConfiguration;
1076
-			buildSettings = {
1077
-				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1078
-				DEPLOY_DETOX_FRAMEWORK = YES;
1079
-				FRAMEWORK_SEARCH_PATHS = (
1080
-					"$(inherited)",
1081
-					"$(PROJECT_DIR)/../node_modules/detox",
1082
-				);
1083
-				HEADER_SEARCH_PATHS = (
1084
-					"$(inherited)",
1085
-					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
1086
-				);
1087
-				INFOPLIST_FILE = example/Info.plist;
1088
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1089
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1090
-				OTHER_LDFLAGS = (
1091
-					"-ObjC",
1092
-					"-l\"c++\"",
1093
-					"-framework",
1094
-					Detox,
1095
-				);
1096
-				PRODUCT_NAME = example;
1097
-			};
1098
-			name = Release_Detox;
1099
-		};
1100
-		BEB8EFA9FD7A9DCE32773C1C /* Debug_Detox */ = {
1101
-			isa = XCBuildConfiguration;
1102
-			buildSettings = {
1103
-				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1104
-				DEAD_CODE_STRIPPING = NO;
1105
-				DEPLOY_DETOX_FRAMEWORK = YES;
1106
-				FRAMEWORK_SEARCH_PATHS = (
1107
-					"$(inherited)",
1108
-					"$(PROJECT_DIR)/../node_modules/detox",
1109
-				);
1110
-				HEADER_SEARCH_PATHS = (
1111
-					"$(inherited)",
1112
-					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
1113
-				);
1114
-				INFOPLIST_FILE = example/Info.plist;
1115
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1116
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1117
-				OTHER_LDFLAGS = (
1118
-					"-ObjC",
1119
-					"-l\"c++\"",
1120
-					"-framework",
1121
-					Detox,
1122
-				);
1123
-				PRODUCT_NAME = example;
1124
-			};
1125
-			name = Debug_Detox;
1126
-		};
1127
-		E53E50BD43A56CF67FAAD3A5 /* Release_Detox */ = {
1128
-			isa = XCBuildConfiguration;
1129
-			buildSettings = {
1130
-				BUNDLE_LOADER = "$(TEST_HOST)";
1131
-				COPY_PHASE_STRIP = NO;
1132
-				FRAMEWORK_SEARCH_PATHS = (
1133
-					"$(SDKROOT)/Developer/Library/Frameworks",
1134
-					"$(inherited)",
1135
-				);
1136
-				INFOPLIST_FILE = exampleTests/Info.plist;
1137
-				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
1138
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1139
-				PRODUCT_NAME = "$(TARGET_NAME)";
1140
-				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example";
1141
-			};
1142
-			name = Release_Detox;
1143
-		};
1144
-		EAA4DC359BE7739594666868 /* Release_Detox */ = {
1145
-			isa = XCBuildConfiguration;
1146
-			buildSettings = {
1147
-				ALWAYS_SEARCH_USER_PATHS = NO;
1148
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1149
-				CLANG_CXX_LIBRARY = "libc++";
1150
-				CLANG_ENABLE_MODULES = YES;
1151
-				CLANG_ENABLE_OBJC_ARC = YES;
1152
-				CLANG_WARN_BOOL_CONVERSION = YES;
1153
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
1154
-				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1155
-				CLANG_WARN_EMPTY_BODY = YES;
1156
-				CLANG_WARN_ENUM_CONVERSION = YES;
1157
-				CLANG_WARN_INT_CONVERSION = YES;
1158
-				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1159
-				CLANG_WARN_UNREACHABLE_CODE = YES;
1160
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1161
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1162
-				COPY_PHASE_STRIP = YES;
1163
-				ENABLE_NS_ASSERTIONS = NO;
1164
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
1165
-				GCC_C_LANGUAGE_STANDARD = gnu99;
1166
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1167
-				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1168
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
1169
-				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1170
-				GCC_WARN_UNUSED_FUNCTION = YES;
1171
-				GCC_WARN_UNUSED_VARIABLE = YES;
1172
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1173
-				MTL_ENABLE_DEBUG_INFO = NO;
1174
-				OTHER_LDFLAGS = "";
1175
-				SDKROOT = iphoneos;
1176
-				VALIDATE_PRODUCT = YES;
1177
-			};
1178
-			name = Release_Detox;
1179
-		};
1180 997
 /* End XCBuildConfiguration section */
1181 998
 
1182 999
 /* Begin XCConfigurationList section */
@@ -1185,8 +1002,6 @@
1185 1002
 			buildConfigurations = (
1186 1003
 				00E356F61AD99517003FC87E /* Debug */,
1187 1004
 				00E356F71AD99517003FC87E /* Release */,
1188
-				5627D4C51CEC610E1744267F /* Debug_Detox */,
1189
-				E53E50BD43A56CF67FAAD3A5 /* Release_Detox */,
1190 1005
 			);
1191 1006
 			defaultConfigurationIsVisible = 0;
1192 1007
 			defaultConfigurationName = Release;
@@ -1196,8 +1011,6 @@
1196 1011
 			buildConfigurations = (
1197 1012
 				13B07F941A680F5B00A75B9A /* Debug */,
1198 1013
 				13B07F951A680F5B00A75B9A /* Release */,
1199
-				BEB8EFA9FD7A9DCE32773C1C /* Debug_Detox */,
1200
-				96FA810D67E56FD9D43906E6 /* Release_Detox */,
1201 1014
 			);
1202 1015
 			defaultConfigurationIsVisible = 0;
1203 1016
 			defaultConfigurationName = Release;
@@ -1207,8 +1020,6 @@
1207 1020
 			buildConfigurations = (
1208 1021
 				83CBBA201A601CBA00E9B192 /* Debug */,
1209 1022
 				83CBBA211A601CBA00E9B192 /* Release */,
1210
-				2C24A1398D388E120DDC2CA1 /* Debug_Detox */,
1211
-				EAA4DC359BE7739594666868 /* Release_Detox */,
1212 1023
 			);
1213 1024
 			defaultConfigurationIsVisible = 0;
1214 1025
 			defaultConfigurationName = Release;

+ 0
- 129
example/ios/example.xcodeproj/xcshareddata/xcschemes/example_Detox.xcscheme Datei anzeigen

@@ -1,129 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<Scheme
3
-   LastUpgradeVersion = "0620"
4
-   version = "1.3">
5
-   <BuildAction
6
-      parallelizeBuildables = "NO"
7
-      buildImplicitDependencies = "YES">
8
-      <BuildActionEntries>
9
-         <BuildActionEntry
10
-            buildForTesting = "YES"
11
-            buildForRunning = "YES"
12
-            buildForProfiling = "YES"
13
-            buildForArchiving = "YES"
14
-            buildForAnalyzing = "YES">
15
-            <BuildableReference
16
-               BuildableIdentifier = "primary"
17
-               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
-               BuildableName = "libReact.a"
19
-               BlueprintName = "React"
20
-               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23
-         <BuildActionEntry
24
-            buildForTesting = "YES"
25
-            buildForRunning = "YES"
26
-            buildForProfiling = "YES"
27
-            buildForArchiving = "YES"
28
-            buildForAnalyzing = "YES">
29
-            <BuildableReference
30
-               BuildableIdentifier = "primary"
31
-               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32
-               BuildableName = "example.app"
33
-               BlueprintName = "example"
34
-               ReferencedContainer = "container:example.xcodeproj">
35
-            </BuildableReference>
36
-         </BuildActionEntry>
37
-         <BuildActionEntry
38
-            buildForTesting = "YES"
39
-            buildForRunning = "YES"
40
-            buildForProfiling = "NO"
41
-            buildForArchiving = "NO"
42
-            buildForAnalyzing = "YES">
43
-            <BuildableReference
44
-               BuildableIdentifier = "primary"
45
-               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
-               BuildableName = "exampleTests.xctest"
47
-               BlueprintName = "exampleTests"
48
-               ReferencedContainer = "container:example.xcodeproj">
49
-            </BuildableReference>
50
-         </BuildActionEntry>
51
-      </BuildActionEntries>
52
-   </BuildAction>
53
-   <TestAction
54
-      buildConfiguration = "Debug"
55
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
-      shouldUseLaunchSchemeArgsEnv = "YES">
58
-      <Testables>
59
-         <TestableReference
60
-            skipped = "NO">
61
-            <BuildableReference
62
-               BuildableIdentifier = "primary"
63
-               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64
-               BuildableName = "exampleTests.xctest"
65
-               BlueprintName = "exampleTests"
66
-               ReferencedContainer = "container:example.xcodeproj">
67
-            </BuildableReference>
68
-         </TestableReference>
69
-      </Testables>
70
-      <MacroExpansion>
71
-         <BuildableReference
72
-            BuildableIdentifier = "primary"
73
-            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
-            BuildableName = "example.app"
75
-            BlueprintName = "example"
76
-            ReferencedContainer = "container:example.xcodeproj">
77
-         </BuildableReference>
78
-      </MacroExpansion>
79
-      <AdditionalOptions>
80
-      </AdditionalOptions>
81
-   </TestAction>
82
-   <LaunchAction
83
-      buildConfiguration = "Debug_Detox"
84
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
-      launchStyle = "0"
87
-      useCustomWorkingDirectory = "NO"
88
-      ignoresPersistentStateOnLaunch = "NO"
89
-      debugDocumentVersioning = "YES"
90
-      debugServiceExtension = "internal"
91
-      allowLocationSimulation = "YES">
92
-      <BuildableProductRunnable
93
-         runnableDebuggingMode = "0">
94
-         <BuildableReference
95
-            BuildableIdentifier = "primary"
96
-            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97
-            BuildableName = "example.app"
98
-            BlueprintName = "example"
99
-            ReferencedContainer = "container:example.xcodeproj">
100
-         </BuildableReference>
101
-      </BuildableProductRunnable>
102
-      <AdditionalOptions>
103
-      </AdditionalOptions>
104
-   </LaunchAction>
105
-   <ProfileAction
106
-      buildConfiguration = "Release"
107
-      shouldUseLaunchSchemeArgsEnv = "YES"
108
-      savedToolIdentifier = ""
109
-      useCustomWorkingDirectory = "NO"
110
-      debugDocumentVersioning = "YES">
111
-      <BuildableProductRunnable
112
-         runnableDebuggingMode = "0">
113
-         <BuildableReference
114
-            BuildableIdentifier = "primary"
115
-            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116
-            BuildableName = "example.app"
117
-            BlueprintName = "example"
118
-            ReferencedContainer = "container:example.xcodeproj">
119
-         </BuildableReference>
120
-      </BuildableProductRunnable>
121
-   </ProfileAction>
122
-   <AnalyzeAction
123
-      buildConfiguration = "Debug">
124
-   </AnalyzeAction>
125
-   <ArchiveAction
126
-      buildConfiguration = "Release"
127
-      revealArchiveInOrganizer = "YES">
128
-   </ArchiveAction>
129
-</Scheme>

+ 17
- 11
example/package.json Datei anzeigen

@@ -7,26 +7,32 @@
7 7
     "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp:8081 || true) && node node_modules/react-native/local-cli/cli.js start --reset-cache",
8 8
     "xcode": "open ios/example.xcodeproj",
9 9
     "android": "cd android && ./gradlew installDebug",
10
-    "e2e": "node ./scripts/e2e.ios.js"
10
+    "e2e": "detox test --configuration ios.sim.debug",
11
+    "e2e-release": "detox test --configuration ios.sim.release"
11 12
   },
12 13
   "dependencies": {
13 14
     "react": "16.0.0-alpha.6",
14
-    "react-native": "0.43.3",
15
+    "react-native": "0.44.2",
15 16
     "react-native-animatable": "^1.1.0",
16 17
     "react-native-navigation": "latest"
17 18
   },
18 19
   "devDependencies": {
19
-    "detox": "4.x.x",
20
-    "detox-server": "1.x.x"
20
+    "detox": "^5.0.0",
21
+    "mocha": "^3.4.2"
21 22
   },
22 23
   "detox": {
23
-    "session": {
24
-      "server": "ws://localhost:8099",
25
-      "sessionId": "example"
26
-    },
27
-    "ios-simulator": {
28
-      "app": "ios/DerivedData/example/Build/Products/Debug_Detox-iphonesimulator/example.app",
29
-      "device": "iPhone 7, iOS 10.1"
24
+    "specs": "test/e2e",
25
+    "configurations": {
26
+      "ios.sim.debug": {
27
+        "binaryPath": "ios/DerivedData/example/Build/Products/Debug-iphonesimulator/example.app",
28
+        "type": "ios.simulator",
29
+        "name": "iPhone 6s"
30
+      },
31
+      "ios.sim.release": {
32
+        "binaryPath": "ios/DerivedData/example/Build/Products/Release-iphonesimulator/example.app",
33
+        "type": "ios.simulator",
34
+        "name": "iPhone 6s"
35
+      }
30 36
     }
31 37
   }
32 38
 }

+ 0
- 44
example/scripts/e2e.ios.js Datei anzeigen

@@ -1,44 +0,0 @@
1
-const cp = require('child_process');
2
-
3
-function exec(cmd) {
4
-  cp.execSync(cmd, {stdio: ['inherit', 'inherit', 'inherit']});
5
-}
6
-
7
-function execSilent(cmd) {
8
-  cp.execSync(cmd, {stdio: ['inherit', 'ignore', 'inherit']});
9
-}
10
-
11
-function kill(process) {
12
-  execSilent(`pkill -f "${process}" || true`);
13
-}
14
-
15
-function buildXcodeReleaseProj() {
16
-//exec(`RCT_NO_LAUNCH_PACKAGER=true cd ios && xcodebuild \
17
-//-scheme example_Detox clean build \
18
-//-project example.xcodeproj \
19
-//-destination "platform=iOS Simulator,name=iPhone 7,OS=10.1" \
20
-//-derivedDataPath ./DerivedData/example`);
21
-}
22
-
23
-function e2e() {
24
-  kill(`detox-server`);
25
-
26
-  try {
27
-    cp.exec(`./node_modules/.bin/detox-server > ./detox-server.log 2>&1`);
28
-    exec(`BABEL_ENV=test ./node_modules/mocha/bin/mocha e2e --opts ./e2e/mocha.opts`);
29
-  } finally {
30
-    kill(`detox-server`);
31
-    kill(`Simulator`);
32
-    kill(`CoreSimulator`);
33
-    exec(`cat ./detox-server.log`);
34
-    exec(`sleep 5`);
35
-  }
36
-}
37
-
38
-function run() {
39
-  buildXcodeReleaseProj();
40
-  e2e();
41
-}
42
-
43
-run();
44
-

+ 2
- 1
example/src/components/Row.js Datei anzeigen

@@ -1,7 +1,7 @@
1 1
 import React, { PropTypes } from 'react';
2 2
 import { StyleSheet, View, Text, TouchableHighlight, Platform } from 'react-native';
3 3
 
4
-function Row({ title, onPress, platform }) {
4
+function Row({ title, onPress, platform, testID }) {
5 5
     if (platform && platform !== Platform.OS) {
6 6
         return <View />;
7 7
     }
@@ -9,6 +9,7 @@ function Row({ title, onPress, platform }) {
9 9
     return (
10 10
         <TouchableHighlight
11 11
             onPress={onPress}
12
+            testID={testID}
12 13
             underlayColor={'rgba(0, 0, 0, 0.054)'}
13 14
         >
14 15
             <View style={styles.row}>

+ 1
- 1
example/src/screens/Types.js Datei anzeigen

@@ -68,7 +68,7 @@ class Types extends React.Component {
68 68
         return (
69 69
             <ScrollView style={styles.container}>
70 70
                 <Row title={'Toggle Drawer'} onPress={this.toggleDrawer} />
71
-                <Row title={'Push Screen'} onPress={this.pushScreen} />
71
+                <Row title={'Push Screen'} testID={'pushScreen'} onPress={this.pushScreen} />
72 72
                 <Row title={'Top Tabs Screen'} onPress={this.pushTopTabsScreen} platform={'android'} />
73 73
                 <Row title={'Show Modal'} onPress={this.showModal} />
74 74
                 <Row title={'Show Lightbox'} onPress={this.showLightBox} />

+ 1
- 1
example/src/screens/types/Push.js Datei anzeigen

@@ -6,7 +6,7 @@ class Push extends React.Component {
6 6
     render() {
7 7
         return (
8 8
             <View style={styles.container}>
9
-                <Text>Push Screen</Text>
9
+                <Text>Pushed Screen</Text>
10 10
             </View>
11 11
         );
12 12
     }

+ 13
- 0
example/test/e2e/init.js Datei anzeigen

@@ -0,0 +1,13 @@
1
+/*eslint-disable*/
2
+const detox = require('detox');
3
+const config = require('../../package.json').detox;
4
+
5
+before(async () => {
6
+  await detox.init(config);
7
+});
8
+
9
+after(async () => {
10
+  await detox.cleanup();
11
+});
12
+
13
+

+ 4
- 0
example/test/e2e/mocha.opts Datei anzeigen

@@ -0,0 +1,4 @@
1
+--recursive
2
+--timeout 60000
3
+--require babel-polyfill
4
+--compilers js:babel-core/register

+ 11
- 0
example/test/e2e/sanity.test.js Datei anzeigen

@@ -0,0 +1,11 @@
1
+describe('sanity', () => {
2
+
3
+  beforeEach(async () => await global.device.reloadReactNative());
4
+
5
+  it('should push a screen', async () => {
6
+    await element(by.id('pushScreen')).tap();
7
+
8
+    await expect(element(by.label('Pushed Screen'))).toBeVisible();
9
+  });
10
+
11
+});