2015-03-23 20:28:42 +00:00
/ * *
* 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 .
* /
2015-03-14 01:32:38 +00:00
# import < UIKit / UIKit . h >
# import < XCTest / XCTest . h >
# import < RCTTest / RCTTestRunner . h >
# import "RCTAssert.h"
2015-09-04 10:30:18 +00:00
# define RCT_TEST ( name ) \
- ( void ) test # # name \
{ \
[ _runner runTest : _cmd module : @ # name ] ; \
}
@ interface UIExplorerIntegrationTests : XCTestCase
2015-03-14 01:32:38 +00:00
@ end
2015-09-04 10:30:18 +00:00
@ implementation UIExplorerIntegrationTests
2015-04-15 00:51:28 +00:00
{
2015-03-14 01:32:38 +00:00
RCTTestRunner * _runner ;
}
- ( void ) setUp
{
2015-06-16 09:51:29 +00:00
# if __LP64 __
2015-08-01 08:44:05 +00:00
RCTAssert ( NO , @ "Tests should be run on 32-bit device simulators (e.g. iPhone 5)" ) ;
2015-03-24 17:20:13 +00:00
# endif
2015-06-16 09:51:29 +00:00
2015-08-24 10:14:33 +00:00
NSOperatingSystemVersion version = [ NSProcessInfo processInfo ] . operatingSystemVersion ;
2015-10-21 16:30:00 +00:00
RCTAssert ( ( version . majorVersion = = 8 && version . minorVersion >= 3 ) || version . majorVersion >= 9 , @ "Tests should be run on iOS 8.3+, found %zd.%zd.%zd" , version . majorVersion , version . minorVersion , version . patchVersion ) ;
2015-07-07 23:19:40 +00:00
_runner = RCTInitRunnerForApp ( @ "Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp" , nil ) ;
2015-03-14 01:32:38 +00:00
}
2015-03-24 17:20:13 +00:00
# pragma mark Logic Tests
2015-06-09 12:11:40 +00:00
- ( void ) testTheTester_waitOneFrame
2015-03-14 01:32:38 +00:00
{
2015-04-15 00:51:28 +00:00
[ _runner runTest : _cmd
module : @ "IntegrationTestHarnessTest"
initialProps : @ { @ "waitOneFrame" : @ YES }
2015-11-13 16:34:26 +00:00
configurationBlock : nil ] ;
2015-03-14 01:32:38 +00:00
}
2015-06-17 14:09:23 +00:00
- ( void ) testTheTester_ExpectError
2015-03-14 01:32:38 +00:00
{
2015-03-24 17:20:13 +00:00
[ _runner runTest : _cmd
module : @ "IntegrationTestHarnessTest"
2015-03-14 01:32:38 +00:00
initialProps : @ { @ "shouldThrow" : @ YES }
2015-11-13 16:34:26 +00:00
configurationBlock : nil
2015-04-15 00:51:28 +00:00
expectErrorRegex : @ "because shouldThrow" ] ;
2015-03-14 01:32:38 +00:00
}
2015-10-06 14:34:44 +00:00
// This list should be kept in sync with IntegrationTestsApp . js
2015-09-04 10:30:18 +00:00
RCT_TEST ( IntegrationTestHarnessTest )
2015-10-06 14:34:44 +00:00
RCT_TEST ( TimersTest )
2015-09-04 10:30:18 +00:00
RCT_TEST ( AsyncStorageTest )
RCT_TEST ( AppEventsTest )
2015-11-05 17:23:30 +00:00
// RCT_TEST ( ImageSnapshotTest ) // Disabled : #8985988
2015-10-06 14:34:44 +00:00
RCT_TEST ( SimpleSnapshotTest )
2015-10-13 10:22:40 +00:00
// Disable due to flakiness : #8686784
// RCT_TEST ( LayoutEventsTest )
// RCT_TEST ( PromiseTest )
2015-03-24 17:20:13 +00:00
2015-03-14 01:32:38 +00:00
@ end