Browse Source

added tests to RNNViewController

Ran Greenberg 7 years ago
parent
commit
e8da1cdf10

+ 59
- 26
example/ios/example.xcodeproj/project.pbxproj View File

@@ -7,23 +7,26 @@
7 7
 	objects = {
8 8
 
9 9
 /* Begin PBXBuildFile section */
10
-		00C302E51ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11
-		00C302E71ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
12
-		00C302E81ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
13
-		00C302E91ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
14
-		00C302EA1ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
10
+		00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11
+		00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
12
+		00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
13
+		00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
14
+		00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
15 15
 		00E356F31AD99517003FC87E /* exampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* exampleTests.m */; };
16
-		133E29F31AD74F7200F7D852 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
17
-		139105C61AF99C1200B5F7CC /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
18
-		139FDEF61B0652A700C62182 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
16
+		133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
17
+		139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
18
+		139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
19 19
 		13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
20 20
 		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
21 21
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
22 22
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
23
-		146834051AC3E58100842450 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24
-		2647D65F1DB175C200B23722 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 2647D65E1DB175B300B23722 /* libReactNativeNavigation.a */; };
25
-		7B9B39861DEB4091004A6281 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B9B39631DEB4076004A6281 /* libRCTAnimation.a */; };
26
-		832341BD1AAA6AB300B99B32 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
23
+		146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24
+		263617451E1151D300D88A13 /* commands.json in Resources */ = {isa = PBXBuildFile; fileRef = 2636F1D51E114FF5007ABB09 /* commands.json */; };
25
+		2636F1CD1E11309B007ABB09 /* RNNViewControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2636F1CC1E11309B007ABB09 /* RNNViewControllerTests.m */; };
26
+		2636F1D61E114FF5007ABB09 /* commands.json in Resources */ = {isa = PBXBuildFile; fileRef = 2636F1D51E114FF5007ABB09 /* commands.json */; };
27
+		2647D65F1DB175C200B23722 /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2647D65E1DB175B300B23722 /* libReactNativeNavigation.a */; };
28
+		7B9B39861DEB4091004A6281 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B9B39631DEB4076004A6281 /* libRCTAnimation.a */; };
29
+		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
27 30
 /* End PBXBuildFile section */
28 31
 
29 32
 /* Begin PBXContainerItemProxy section */
@@ -196,6 +199,8 @@
196 199
 		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = "<group>"; };
197 200
 		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = example/main.m; sourceTree = "<group>"; };
198 201
 		146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
202
+		2636F1CC1E11309B007ABB09 /* RNNViewControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNViewControllerTests.m; sourceTree = "<group>"; };
203
+		2636F1D51E114FF5007ABB09 /* commands.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = commands.json; path = "../node_modules/react-native-navigation/example/commands.json"; sourceTree = "<group>"; };
199 204
 		2647D6591DB175B300B23722 /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/ios/ReactNativeNavigation.xcodeproj"; sourceTree = "<group>"; };
200 205
 		78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
201 206
 		7B9B395C1DEB4076004A6281 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
@@ -214,18 +219,18 @@
214 219
 			isa = PBXFrameworksBuildPhase;
215 220
 			buildActionMask = 2147483647;
216 221
 			files = (
217
-				7B9B39861DEB4091004A6281 /* ReferenceProxy in Frameworks */,
218
-				2647D65F1DB175C200B23722 /* ReferenceProxy in Frameworks */,
219
-				146834051AC3E58100842450 /* ReferenceProxy in Frameworks */,
220
-				00C302E51ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
221
-				00C302E71ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
222
-				00C302E81ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
223
-				133E29F31AD74F7200F7D852 /* ReferenceProxy in Frameworks */,
224
-				00C302E91ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
225
-				139105C61AF99C1200B5F7CC /* ReferenceProxy in Frameworks */,
226
-				832341BD1AAA6AB300B99B32 /* ReferenceProxy in Frameworks */,
227
-				00C302EA1ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
228
-				139FDEF61B0652A700C62182 /* ReferenceProxy in Frameworks */,
222
+				7B9B39861DEB4091004A6281 /* libRCTAnimation.a in Frameworks */,
223
+				2647D65F1DB175C200B23722 /* libReactNativeNavigation.a in Frameworks */,
224
+				146834051AC3E58100842450 /* libReact.a in Frameworks */,
225
+				00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
226
+				00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
227
+				00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
228
+				133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
229
+				00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
230
+				139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
231
+				832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
232
+				00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
233
+				139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
229 234
 			);
230 235
 			runOnlyForDeploymentPostprocessing = 0;
231 236
 		};
@@ -278,6 +283,7 @@
278 283
 			isa = PBXGroup;
279 284
 			children = (
280 285
 				00E356F21AD99517003FC87E /* exampleTests.m */,
286
+				2636F1CC1E11309B007ABB09 /* RNNViewControllerTests.m */,
281 287
 				00E356F01AD99517003FC87E /* Supporting Files */,
282 288
 			);
283 289
 			path = exampleTests;
@@ -312,6 +318,7 @@
312 318
 		13B07FAE1A68108700A75B9A /* example */ = {
313 319
 			isa = PBXGroup;
314 320
 			children = (
321
+				2636F1D51E114FF5007ABB09 /* commands.json */,
315 322
 				008F07F21AC5B25A0029DE68 /* main.jsbundle */,
316 323
 				13B07FAF1A68108700A75B9A /* AppDelegate.h */,
317 324
 				13B07FB01A68108700A75B9A /* AppDelegate.m */,
@@ -454,7 +461,7 @@
454 461
 			isa = PBXProject;
455 462
 			attributes = {
456 463
 				LastUpgradeCheck = 0610;
457
-				ORGANIZATIONNAME = Facebook;
464
+				ORGANIZATIONNAME = Wix;
458 465
 				TargetAttributes = {
459 466
 					00E356ED1AD99517003FC87E = {
460 467
 						CreatedOnToolsVersion = 6.2;
@@ -679,6 +686,7 @@
679 686
 			isa = PBXResourcesBuildPhase;
680 687
 			buildActionMask = 2147483647;
681 688
 			files = (
689
+				2636F1D61E114FF5007ABB09 /* commands.json in Resources */,
682 690
 			);
683 691
 			runOnlyForDeploymentPostprocessing = 0;
684 692
 		};
@@ -686,6 +694,7 @@
686 694
 			isa = PBXResourcesBuildPhase;
687 695
 			buildActionMask = 2147483647;
688 696
 			files = (
697
+				263617451E1151D300D88A13 /* commands.json in Resources */,
689 698
 				13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
690 699
 				13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
691 700
 			);
@@ -721,7 +730,6 @@
721 730
 			runOnlyForDeploymentPostprocessing = 0;
722 731
 			shellPath = /bin/bash;
723 732
 			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";
724
-			showEnvVarsInLog = 1;
725 733
 		};
726 734
 /* End PBXShellScriptBuildPhase section */
727 735
 
@@ -731,6 +739,7 @@
731 739
 			buildActionMask = 2147483647;
732 740
 			files = (
733 741
 				00E356F31AD99517003FC87E /* exampleTests.m in Sources */,
742
+				2636F1CD1E11309B007ABB09 /* RNNViewControllerTests.m in Sources */,
734 743
 			);
735 744
 			runOnlyForDeploymentPostprocessing = 0;
736 745
 		};
@@ -778,6 +787,12 @@
778 787
 					"DEBUG=1",
779 788
 					"$(inherited)",
780 789
 				);
790
+				HEADER_SEARCH_PATHS = (
791
+					"$(inherited)",
792
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
793
+					"$(SRCROOT)/../node_modules/react-native/React/**",
794
+					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
795
+				);
781 796
 				INFOPLIST_FILE = exampleTests/Info.plist;
782 797
 				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
783 798
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -795,6 +810,12 @@
795 810
 					"$(SDKROOT)/Developer/Library/Frameworks",
796 811
 					"$(inherited)",
797 812
 				);
813
+				HEADER_SEARCH_PATHS = (
814
+					"$(inherited)",
815
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
816
+					"$(SRCROOT)/../node_modules/react-native/React/**",
817
+					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
818
+				);
798 819
 				INFOPLIST_FILE = exampleTests/Info.plist;
799 820
 				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
800 821
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -905,6 +926,12 @@
905 926
 					"DEBUG=1",
906 927
 					"$(inherited)",
907 928
 				);
929
+				HEADER_SEARCH_PATHS = (
930
+					"$(inherited)",
931
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
932
+					"$(SRCROOT)/../node_modules/react-native/React/**",
933
+					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
934
+				);
908 935
 				INFOPLIST_FILE = exampleTests/Info.plist;
909 936
 				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
910 937
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -1067,6 +1094,12 @@
1067 1094
 					"$(SDKROOT)/Developer/Library/Frameworks",
1068 1095
 					"$(inherited)",
1069 1096
 				);
1097
+				HEADER_SEARCH_PATHS = (
1098
+					"$(inherited)",
1099
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
1100
+					"$(SRCROOT)/../node_modules/react-native/React/**",
1101
+					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
1102
+				);
1070 1103
 				INFOPLIST_FILE = exampleTests/Info.plist;
1071 1104
 				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
1072 1105
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";

+ 115
- 0
example/ios/exampleTests/RNNViewControllerTests.m View File

@@ -0,0 +1,115 @@
1
+//
2
+//  RNNViewControllerTests.m
3
+//  example
4
+//
5
+//  Created by Ran Greenberg on 26/12/2016.
6
+//  Copyright © 2016 Facebook. All rights reserved.
7
+//
8
+
9
+#import <XCTest/XCTest.h>
10
+#import "RCCManager.h"
11
+#import "RNNViewController.h"
12
+#import "MMDrawerController.h"
13
+
14
+#define COMMAND_SINGLE_SCREEN_APP               @"singleScreenApp"
15
+#define COMMAND_TAB_BASED_APP                   @"tabBasedApp"
16
+#define COMMAND_SINGLE_WITH_LEFT_SIDE_MENU      @"singleWithLeftSideMenu"
17
+#define COMMAND_SINGLE_WITH_RIGHT_SIDE_MENU     @"singleWithRightSideMenu"
18
+#define COMMAND_SINGLE_WITH_BOTH_SIDE_MENU      @"singleWithBothMenus"
19
+#define COMMAND_TAB_BASED_WITH_SIDE_MENT        @"tabBasedWithSideMenu"
20
+
21
+
22
+@interface RNNViewControllerTests : XCTestCase
23
+@property (nonatomic, strong) RCTBridge *bridge;
24
+@property (nonatomic, strong) NSDictionary *jsonCommands;
25
+@end
26
+
27
+@implementation RNNViewControllerTests
28
+
29
+- (void)setUp {
30
+  [super setUp];
31
+  // Put setup code here. This method is called before the invocation of each test method in the class.
32
+  self.bridge = [[RCCManager sharedInstance] getBridge];
33
+  self.jsonCommands = [self loadCommandsJsonAsDictionary];
34
+}
35
+
36
+- (void)tearDown {
37
+  // Put teardown code here. This method is called after the invocation of each test method in the class.
38
+  self.bridge = nil;
39
+  self.jsonCommands = nil;
40
+  [super tearDown];
41
+}
42
+
43
+-(NSDictionary*)loadCommandsJsonAsDictionary {
44
+  NSString *filePath = [[NSBundle mainBundle] pathForResource:@"commands" ofType:@"json"];
45
+  NSData *data = [NSData dataWithContentsOfFile:filePath];
46
+  NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
47
+  return json;
48
+}
49
+
50
+- (void)testWrongSyntax {
51
+  
52
+  NSDictionary *layout = @{@"key": @"com.example.FirstTabScreen"};
53
+  id vc = [RNNViewController controllerWithLayout:layout bridge:self.bridge];
54
+  XCTAssertNil(vc);
55
+}
56
+
57
+-(void)testSingleScreenApp {
58
+  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_SCREEN_APP] bridge:self.bridge];
59
+  XCTAssertTrue([vc isKindOfClass:[UINavigationController class]]);
60
+}
61
+
62
+-(void)testTabBasedApp {
63
+  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_TAB_BASED_APP] bridge:self.bridge];
64
+  XCTAssertTrue([vc isKindOfClass:[UITabBarController class]]);
65
+  UITabBarController *tabsController = (UITabBarController*)vc;
66
+  for (id tab in tabsController.viewControllers) {
67
+    XCTAssertTrue([tab isKindOfClass:[UINavigationController class]]);
68
+  }
69
+}
70
+
71
+-(void)testSingleWithLeftSideMenu {
72
+  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_WITH_LEFT_SIDE_MENU] bridge:self.bridge];
73
+  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
74
+  MMDrawerController *sideMenuLeft = (MMDrawerController*)vc;
75
+  XCTAssertNotNil(sideMenuLeft.leftDrawerViewController);
76
+  XCTAssertNotNil(sideMenuLeft.centerViewController);
77
+  XCTAssertNil(sideMenuLeft.rightDrawerViewController);
78
+}
79
+
80
+-(void)testSingleWithRightSideMenu {
81
+  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_WITH_RIGHT_SIDE_MENU] bridge:self.bridge];
82
+  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
83
+  MMDrawerController *sideMenuRight = (MMDrawerController*)vc;
84
+  XCTAssertNil(sideMenuRight.leftDrawerViewController);
85
+  XCTAssertNotNil(sideMenuRight.centerViewController);
86
+  XCTAssertNotNil(sideMenuRight.rightDrawerViewController);
87
+
88
+}
89
+
90
+-(void)testSingleWithBothSideMenu {
91
+  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_SINGLE_WITH_BOTH_SIDE_MENU] bridge:self.bridge];
92
+  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
93
+  MMDrawerController *sideMenuBoth = (MMDrawerController*)vc;
94
+  XCTAssertNotNil(sideMenuBoth.leftDrawerViewController);
95
+  XCTAssertNotNil(sideMenuBoth.centerViewController);
96
+  XCTAssertNotNil(sideMenuBoth.rightDrawerViewController);
97
+}
98
+
99
+-(void)testTabBasedWithBothSideMenu {
100
+  id vc = [RNNViewController controllerWithLayout:self.jsonCommands[COMMAND_TAB_BASED_WITH_SIDE_MENT] bridge:self.bridge];
101
+  XCTAssertTrue([vc isKindOfClass:[MMDrawerController class]]);
102
+  MMDrawerController *sideMenuBothWithTabs = (MMDrawerController*)vc;
103
+  XCTAssertNotNil(sideMenuBothWithTabs.leftDrawerViewController);
104
+  XCTAssertNotNil(sideMenuBothWithTabs.centerViewController);
105
+  XCTAssertNotNil(sideMenuBothWithTabs.rightDrawerViewController);
106
+  XCTAssertTrue([sideMenuBothWithTabs.centerViewController isKindOfClass:[UITabBarController class]]);
107
+}
108
+//- (void)testPerformanceExample {
109
+//  // This is an example of a performance test case.
110
+//  [self measureBlock:^{
111
+//    // Put the code you want to measure the time of here.
112
+//  }];
113
+//}
114
+
115
+@end

+ 3
- 44
example/ios/exampleTests/exampleTests.m View File

@@ -11,7 +11,9 @@
11 11
 #import <XCTest/XCTest.h>
12 12
 
13 13
 #import "RCTLog.h"
14
-#import "RCTRootView.h"
14
+
15
+
16
+
15 17
 
16 18
 #define TIMEOUT_SECONDS 240
17 19
 #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
@@ -22,49 +24,6 @@
22 24
 
23 25
 @implementation exampleTests
24 26
 
25
-- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26
-{
27
-  if (test(view)) {
28
-    return YES;
29
-  }
30
-  for (UIView *subview in [view subviews]) {
31
-    if ([self findSubviewInView:subview matching:test]) {
32
-      return YES;
33
-    }
34
-  }
35
-  return NO;
36
-}
37
-
38
-- (void)testRendersWelcomeScreen
39
-{
40
-  UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
41
-  NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42
-  BOOL foundElement = NO;
43
-
44
-  __block NSString *redboxError = nil;
45
-  RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46
-    if (level >= RCTLogLevelError) {
47
-      redboxError = message;
48
-    }
49
-  });
50
-
51
-  while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52
-    [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53
-    [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54
-
55
-    foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56
-      if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57
-        return YES;
58
-      }
59
-      return NO;
60
-    }];
61
-  }
62
-
63
-  RCTSetLogFunction(RCTDefaultLogFunction);
64
-
65
-  XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66
-  XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67
-}
68 27
 
69 28
 
70 29
 @end