Skip to content

Commit 014065b

Browse files
committed
Updates from Fri 17 Apr
2 parents 0e07407 + 1883ba5 commit 014065b

48 files changed

Lines changed: 1283 additions & 294 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
1616
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
1717
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
18+
00E356F31AD99517003FC87E /* SampleAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* SampleAppTests.m */; };
1819
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
1920
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
2021
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
@@ -74,6 +75,13 @@
7475
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
7576
remoteInfo = RCTVibration;
7677
};
78+
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
79+
isa = PBXContainerItemProxy;
80+
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
81+
proxyType = 1;
82+
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
83+
remoteInfo = SampleApp;
84+
};
7785
146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
7886
isa = PBXContainerItemProxy;
7987
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
@@ -106,6 +114,9 @@
106114
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
107115
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
108116
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../../Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
117+
00E356EE1AD99517003FC87E /* SampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
118+
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
119+
00E356F21AD99517003FC87E /* SampleAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SampleAppTests.m; sourceTree = "<group>"; };
109120
13B07F961A680F5B00A75B9A /* SampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
110121
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = "<group>"; };
111122
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = "<group>"; };
@@ -119,6 +130,13 @@
119130
/* End PBXFileReference section */
120131

121132
/* Begin PBXFrameworksBuildPhase section */
133+
00E356EB1AD99517003FC87E /* Frameworks */ = {
134+
isa = PBXFrameworksBuildPhase;
135+
buildActionMask = 2147483647;
136+
files = (
137+
);
138+
runOnlyForDeploymentPostprocessing = 0;
139+
};
122140
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
123141
isa = PBXFrameworksBuildPhase;
124142
buildActionMask = 2147483647;
@@ -195,6 +213,23 @@
195213
name = Products;
196214
sourceTree = "<group>";
197215
};
216+
00E356EF1AD99517003FC87E /* SampleAppTests */ = {
217+
isa = PBXGroup;
218+
children = (
219+
00E356F21AD99517003FC87E /* SampleAppTests.m */,
220+
00E356F01AD99517003FC87E /* Supporting Files */,
221+
);
222+
path = SampleAppTests;
223+
sourceTree = "<group>";
224+
};
225+
00E356F01AD99517003FC87E /* Supporting Files */ = {
226+
isa = PBXGroup;
227+
children = (
228+
00E356F11AD99517003FC87E /* Info.plist */,
229+
);
230+
name = "Supporting Files";
231+
sourceTree = "<group>";
232+
};
198233
13B07FAE1A68108700A75B9A /* SampleApp */ = {
199234
isa = PBXGroup;
200235
children = (
@@ -255,6 +290,7 @@
255290
children = (
256291
13B07FAE1A68108700A75B9A /* SampleApp */,
257292
832341AE1AAA6A7D00B99B32 /* Libraries */,
293+
00E356EF1AD99517003FC87E /* SampleAppTests */,
258294
83CBBA001A601CBA00E9B192 /* Products */,
259295
);
260296
indentWidth = 2;
@@ -265,13 +301,32 @@
265301
isa = PBXGroup;
266302
children = (
267303
13B07F961A680F5B00A75B9A /* SampleApp.app */,
304+
00E356EE1AD99517003FC87E /* SampleAppTests.xctest */,
268305
);
269306
name = Products;
270307
sourceTree = "<group>";
271308
};
272309
/* End PBXGroup section */
273310

274311
/* Begin PBXNativeTarget section */
312+
00E356ED1AD99517003FC87E /* SampleAppTests */ = {
313+
isa = PBXNativeTarget;
314+
buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "SampleAppTests" */;
315+
buildPhases = (
316+
00E356EA1AD99517003FC87E /* Sources */,
317+
00E356EB1AD99517003FC87E /* Frameworks */,
318+
00E356EC1AD99517003FC87E /* Resources */,
319+
);
320+
buildRules = (
321+
);
322+
dependencies = (
323+
00E356F51AD99517003FC87E /* PBXTargetDependency */,
324+
);
325+
name = SampleAppTests;
326+
productName = SampleAppTests;
327+
productReference = 00E356EE1AD99517003FC87E /* SampleAppTests.xctest */;
328+
productType = "com.apple.product-type.bundle.unit-test";
329+
};
275330
13B07F861A680F5B00A75B9A /* SampleApp */ = {
276331
isa = PBXNativeTarget;
277332
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SampleApp" */;
@@ -297,6 +352,12 @@
297352
attributes = {
298353
LastUpgradeCheck = 0610;
299354
ORGANIZATIONNAME = Facebook;
355+
TargetAttributes = {
356+
00E356ED1AD99517003FC87E = {
357+
CreatedOnToolsVersion = 6.2;
358+
TestTargetID = 13B07F861A680F5B00A75B9A;
359+
};
360+
};
300361
};
301362
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "SampleApp" */;
302363
compatibilityVersion = "Xcode 3.2";
@@ -354,6 +415,7 @@
354415
projectRoot = "";
355416
targets = (
356417
13B07F861A680F5B00A75B9A /* SampleApp */,
418+
00E356ED1AD99517003FC87E /* SampleAppTests */,
357419
);
358420
};
359421
/* End PBXProject section */
@@ -432,6 +494,13 @@
432494
/* End PBXReferenceProxy section */
433495

434496
/* Begin PBXResourcesBuildPhase section */
497+
00E356EC1AD99517003FC87E /* Resources */ = {
498+
isa = PBXResourcesBuildPhase;
499+
buildActionMask = 2147483647;
500+
files = (
501+
);
502+
runOnlyForDeploymentPostprocessing = 0;
503+
};
435504
13B07F8E1A680F5B00A75B9A /* Resources */ = {
436505
isa = PBXResourcesBuildPhase;
437506
buildActionMask = 2147483647;
@@ -445,6 +514,14 @@
445514
/* End PBXResourcesBuildPhase section */
446515

447516
/* Begin PBXSourcesBuildPhase section */
517+
00E356EA1AD99517003FC87E /* Sources */ = {
518+
isa = PBXSourcesBuildPhase;
519+
buildActionMask = 2147483647;
520+
files = (
521+
00E356F31AD99517003FC87E /* SampleAppTests.m in Sources */,
522+
);
523+
runOnlyForDeploymentPostprocessing = 0;
524+
};
448525
13B07F871A680F5B00A75B9A /* Sources */ = {
449526
isa = PBXSourcesBuildPhase;
450527
buildActionMask = 2147483647;
@@ -456,6 +533,14 @@
456533
};
457534
/* End PBXSourcesBuildPhase section */
458535

536+
/* Begin PBXTargetDependency section */
537+
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
538+
isa = PBXTargetDependency;
539+
target = 13B07F861A680F5B00A75B9A /* SampleApp */;
540+
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
541+
};
542+
/* End PBXTargetDependency section */
543+
459544
/* Begin PBXVariantGroup section */
460545
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
461546
isa = PBXVariantGroup;
@@ -469,6 +554,43 @@
469554
/* End PBXVariantGroup section */
470555

471556
/* Begin XCBuildConfiguration section */
557+
00E356F61AD99517003FC87E /* Debug */ = {
558+
isa = XCBuildConfiguration;
559+
buildSettings = {
560+
BUNDLE_LOADER = "$(TEST_HOST)";
561+
FRAMEWORK_SEARCH_PATHS = (
562+
"$(SDKROOT)/Developer/Library/Frameworks",
563+
"$(inherited)",
564+
);
565+
GCC_PREPROCESSOR_DEFINITIONS = (
566+
"DEBUG=1",
567+
"$(inherited)",
568+
);
569+
INFOPLIST_FILE = SampleAppTests/Info.plist;
570+
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
571+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
572+
PRODUCT_NAME = "$(TARGET_NAME)";
573+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SampleApp.app/SampleApp";
574+
};
575+
name = Debug;
576+
};
577+
00E356F71AD99517003FC87E /* Release */ = {
578+
isa = XCBuildConfiguration;
579+
buildSettings = {
580+
BUNDLE_LOADER = "$(TEST_HOST)";
581+
COPY_PHASE_STRIP = NO;
582+
FRAMEWORK_SEARCH_PATHS = (
583+
"$(SDKROOT)/Developer/Library/Frameworks",
584+
"$(inherited)",
585+
);
586+
INFOPLIST_FILE = SampleAppTests/Info.plist;
587+
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
588+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
589+
PRODUCT_NAME = "$(TARGET_NAME)";
590+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SampleApp.app/SampleApp";
591+
};
592+
name = Release;
593+
};
472594
13B07F941A680F5B00A75B9A /* Debug */ = {
473595
isa = XCBuildConfiguration;
474596
buildSettings = {
@@ -590,6 +712,15 @@
590712
/* End XCBuildConfiguration section */
591713

592714
/* Begin XCConfigurationList section */
715+
00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "SampleAppTests" */ = {
716+
isa = XCConfigurationList;
717+
buildConfigurations = (
718+
00E356F61AD99517003FC87E /* Debug */,
719+
00E356F71AD99517003FC87E /* Release */,
720+
);
721+
defaultConfigurationIsVisible = 0;
722+
defaultConfigurationName = Release;
723+
};
593724
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SampleApp" */ = {
594725
isa = XCConfigurationList;
595726
buildConfigurations = (

Examples/SampleApp/SampleApp.xcodeproj/xcshareddata/xcschemes/SampleApp.xcscheme

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
ReferencedContainer = "container:SampleApp.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
32+
BuildableName = "SampleAppTests.xctest"
33+
BlueprintName = "SampleAppTests"
34+
ReferencedContainer = "container:SampleApp.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
2337
</BuildActionEntries>
2438
</BuildAction>
2539
<TestAction
@@ -28,6 +42,16 @@
2842
shouldUseLaunchSchemeArgsEnv = "YES"
2943
buildConfiguration = "Debug">
3044
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
50+
BuildableName = "SampleAppTests.xctest"
51+
BlueprintName = "SampleAppTests"
52+
ReferencedContainer = "container:SampleApp.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
3155
</Testables>
3256
<MacroExpansion>
3357
<BuildableReference
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
</dict>
24+
</plist>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import <UIKit/UIKit.h>
11+
#import <XCTest/XCTest.h>
12+
13+
#import "RCTAssert.h"
14+
#import "RCTRedBox.h"
15+
#import "RCTRootView.h"
16+
17+
#define TIMEOUT_SECONDS 240
18+
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
19+
20+
@interface SampleAppTests : XCTestCase
21+
22+
@end
23+
24+
@implementation SampleAppTests
25+
26+
27+
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
28+
{
29+
if (test(view)) {
30+
return YES;
31+
}
32+
for (UIView *subview in [view subviews]) {
33+
if ([self findSubviewInView:subview matching:test]) {
34+
return YES;
35+
}
36+
}
37+
return NO;
38+
}
39+
40+
- (void)testRendersWelcomeScreen {
41+
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
42+
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
43+
BOOL foundElement = NO;
44+
NSString *redboxError = nil;
45+
46+
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
47+
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
48+
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
49+
50+
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
51+
52+
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
53+
if ([view respondsToSelector:@selector(attributedText)]) {
54+
NSString *text = [(id)view attributedText].string;
55+
if ([text isEqualToString:TEXT_TO_LOOK_FOR]) {
56+
return YES;
57+
}
58+
}
59+
return NO;
60+
}];
61+
}
62+
63+
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64+
XCTAssertTrue(foundElement, @"Cound't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65+
}
66+
67+
68+
@end

0 commit comments

Comments
 (0)