fix update issues

This commit is contained in:
Geoffrey Goh
2015-10-06 20:21:59 -07:00
parent 38fbf641f9
commit eaf12e904a
6 changed files with 13 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
#import "RCTRootView.h"
#import "RCTRedBox.h"
#import "RCTAssert.h"
#import "RCTLog.h"
#define FB_REFERENCE_IMAGE_DIR "\"$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages\""
@@ -66,16 +67,24 @@
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:scriptURL
moduleProvider:nil
launchOptions:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"DownloadAndApplyUpdateTest"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"DownloadAndApplyUpdateTest"
initialProperties:nil];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;
NSString *redboxError = nil;
__block NSString *redboxError = nil;
RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
UIViewController *vc = [UIApplication sharedApplication].delegate.window.rootViewController;
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([NSStringFromClass([view class]) isEqualToString:@"RCTText"]){