Second Update from Tue 24 Mar

This commit is contained in:
Christopher Chedeau
2015-03-24 19:34:12 -07:00
parent 8068c65f12
commit ead3a740ca
121 changed files with 6808 additions and 667 deletions

View File

@@ -18,11 +18,11 @@
580C37631AB0F62C0015E709 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580C37551AB0F56E0015E709 /* libRCTImage.a */; };
580C37641AB0F6350015E709 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580C375A1AB0F5970015E709 /* libRCTNetwork.a */; };
580C37651AB0F63E0015E709 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580C375F1AB0F5D10015E709 /* libRCTText.a */; };
580C37921AB1090B0015E709 /* libRCTTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580C378F1AB104B00015E709 /* libRCTTest.a */; };
58B80D5F1ABA4147004008FB /* libRCTTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580C378F1AB104B00015E709 /* libRCTTest.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
004D28A41AAF61C70097A701 /* PBXContainerItemProxy */ = {
58005BCB1ABA44F10062E044 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
proxyType = 1;
@@ -117,8 +117,8 @@
580C37621AB0F6260015E709 /* libRCTGeolocation.a in Frameworks */,
580C37631AB0F62C0015E709 /* libRCTImage.a in Frameworks */,
580C37641AB0F6350015E709 /* libRCTNetwork.a in Frameworks */,
58B80D5F1ABA4147004008FB /* libRCTTest.a in Frameworks */,
580C37651AB0F63E0015E709 /* libRCTText.a in Frameworks */,
580C37921AB1090B0015E709 /* libRCTTest.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -258,7 +258,7 @@
buildRules = (
);
dependencies = (
004D28A51AAF61C70097A701 /* PBXTargetDependency */,
58005BCC1ABA44F10062E044 /* PBXTargetDependency */,
);
name = IntegrationTestsTests;
productName = IntegrationTestsTests;
@@ -438,10 +438,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
004D28A51AAF61C70097A701 /* PBXTargetDependency */ = {
58005BCC1ABA44F10062E044 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 13B07F861A680F5B00A75B9A /* IntegrationTests */;
targetProxy = 004D28A41AAF61C70097A701 /* PBXContainerItemProxy */;
targetProxy = 58005BCB1ABA44F10062E044 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@@ -468,6 +468,7 @@
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages\\\"\"",
"$(inherited)",
);
INFOPLIST_FILE = IntegrationTestsTests/Info.plist;

View File

@@ -25,6 +25,7 @@ var TESTS = [
require('./IntegrationTestHarnessTest'),
require('./TimersTest'),
require('./AsyncStorageTest'),
require('./SimpleSnapshotTest'),
];
TESTS.forEach(

View File

@@ -24,34 +24,57 @@
- (void)setUp
{
_runner = [[RCTTestRunner alloc] initWithApp:@"IntegrationTests/IntegrationTestsApp"];
#ifdef __LP64__
RCTAssert(!__LP64__, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#endif
NSString *version = [[UIDevice currentDevice] systemVersion];
RCTAssert([version isEqualToString:@"8.1"], @"Tests should be run on iOS 8.1, found %@", version);
_runner = initRunnerForApp(@"IntegrationTests/IntegrationTestsApp");
// If tests have changes, set recordMode = YES below and run the affected tests on an iPhone5, iOS 8.1 simulator.
_runner.recordMode = NO;
}
#pragma mark Logic Tests
- (void)testTheTester
{
[_runner runTest:@"IntegrationTestHarnessTest"];
[_runner runTest:_cmd module:@"IntegrationTestHarnessTest"];
}
- (void)testTheTester_waitOneFrame
{
[_runner runTest:@"IntegrationTestHarnessTest" initialProps:@{@"waitOneFrame": @YES} expectErrorBlock:nil];
[_runner runTest:_cmd module:@"IntegrationTestHarnessTest" initialProps:@{@"waitOneFrame": @YES} expectErrorBlock:nil];
}
- (void)testTheTester_ExpectError
{
[_runner runTest:@"IntegrationTestHarnessTest"
[_runner runTest:_cmd
module:@"IntegrationTestHarnessTest"
initialProps:@{@"shouldThrow": @YES}
expectErrorRegex:[NSRegularExpression regularExpressionWithPattern:@"because shouldThrow" options:0 error:nil]];
}
- (void)testTimers
{
[_runner runTest:@"TimersTest"];
[_runner runTest:_cmd module:@"TimersTest"];
}
- (void)testAsyncStorage
{
[_runner runTest:@"AsyncStorageTest"];
[_runner runTest:_cmd module:@"AsyncStorageTest"];
}
#pragma mark Snapshot Tests
- (void)testSimpleSnapshot
{
[_runner runTest:_cmd module:@"SimpleSnapshotTest"];
}
- (void)testZZZ_NotInRecordMode
{
RCTAssert(_runner.recordMode == NO, @"Don't forget to turn record mode back to NO before commit.");
}
@end

View File

@@ -0,0 +1,56 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var React = require('react-native');
var {
StyleSheet,
View,
} = React;
var { TestModule } = React.addons;
var SimpleSnapshotTest = React.createClass({
componentDidMount() {
if (!TestModule.verifySnapshot) {
throw new Error('TestModule.verifySnapshot not defined.');
}
requestAnimationFrame(() => TestModule.verifySnapshot(this.done));
},
done() {
TestModule.markTestCompleted();
},
render() {
return (
<View style={{backgroundColor: 'white', padding: 100}}>
<View style={styles.box1} />
<View style={styles.box2} />
</View>
);
}
});
var styles = StyleSheet.create({
box1: {
width: 80,
height: 50,
backgroundColor: 'red',
},
box2: {
top: -10,
left: 20,
width: 70,
height: 90,
backgroundColor: 'blue',
},
});
module.exports = SimpleSnapshotTest;

View File

@@ -13,9 +13,9 @@ var React = require('react-native');
var {
StyleSheet,
Text,
TimerMixin,
View,
} = React;
var TimerMixin = require('react-timer-mixin');
var TimersTest = React.createClass({
mixins: [TimerMixin],