2015-03-23 20:28:42 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-03-23 20:28:42 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-03-23 20:28:42 +00:00
|
|
|
*/
|
2015-03-14 01:32:38 +00:00
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <XCTest/XCTest.h>
|
|
|
|
|
|
|
|
#import <RCTTest/RCTTestRunner.h>
|
|
|
|
|
2015-09-04 10:30:18 +00:00
|
|
|
#define RCT_TEST(name) \
|
|
|
|
- (void)test##name \
|
|
|
|
{ \
|
|
|
|
[_runner runTest:_cmd module:@#name]; \
|
|
|
|
}
|
|
|
|
|
2017-01-16 21:23:33 +00:00
|
|
|
#define RCT_TEST_ONLY_WITH_PACKAGER(name) \
|
|
|
|
- (void)test##name \
|
|
|
|
{ \
|
|
|
|
if (getenv("CI_USE_PACKAGER")) { \
|
|
|
|
[_runner runTest:_cmd module:@#name]; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2017-05-06 03:50:47 +00:00
|
|
|
@interface RNTesterIntegrationTests : XCTestCase
|
2015-03-14 01:32:38 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2017-05-06 03:50:47 +00:00
|
|
|
@implementation RNTesterIntegrationTests
|
2015-04-15 00:51:28 +00:00
|
|
|
{
|
2015-03-14 01:32:38 +00:00
|
|
|
RCTTestRunner *_runner;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setUp
|
|
|
|
{
|
2017-11-12 21:30:13 +00:00
|
|
|
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil, nil);
|
2016-12-19 14:26:07 +00:00
|
|
|
_runner.recordMode = NO;
|
2015-03-14 01:32:38 +00:00
|
|
|
}
|
|
|
|
|
2015-11-18 16:25:30 +00:00
|
|
|
#pragma mark - Test harness
|
2015-03-24 17:20:13 +00:00
|
|
|
|
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-11-18 16:25:30 +00:00
|
|
|
#pragma mark - JS tests
|
|
|
|
|
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)
|
2018-05-04 17:56:14 +00:00
|
|
|
//RCT_TEST(ImageCachePolicyTest) // This test never passed.
|
2017-02-14 01:35:43 +00:00
|
|
|
RCT_TEST(ImageSnapshotTest)
|
2015-11-18 16:25:30 +00:00
|
|
|
//RCT_TEST(LayoutEventsTest) // Disabled due to flakiness: #8686784
|
2015-10-06 14:34:44 +00:00
|
|
|
RCT_TEST(SimpleSnapshotTest)
|
2017-04-27 18:49:50 +00:00
|
|
|
RCT_TEST(SyncMethodTest)
|
2015-11-18 16:25:30 +00:00
|
|
|
RCT_TEST(PromiseTest)
|
2017-01-16 21:23:33 +00:00
|
|
|
RCT_TEST_ONLY_WITH_PACKAGER(WebSocketTest)
|
2017-06-21 01:42:46 +00:00
|
|
|
RCT_TEST(AccessibilityManagerTest)
|
2015-10-13 10:22:40 +00:00
|
|
|
|
2017-07-28 18:32:00 +00:00
|
|
|
#if !TARGET_OS_TV // tvOS does not fully support WebView
|
|
|
|
RCT_TEST(WebViewTest)
|
|
|
|
#endif
|
|
|
|
|
2015-03-14 01:32:38 +00:00
|
|
|
@end
|