mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 08:26:23 +00:00
[ReactKit] Fail tests when redbox shows up
This commit is contained in:
parent
2aafcd0e58
commit
e07c8db607
@ -3,6 +3,8 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <XCTest/XCTest.h>
|
#import <XCTest/XCTest.h>
|
||||||
|
|
||||||
|
#import "RCTRedBox.h"
|
||||||
|
|
||||||
#define TIMEOUT_SECONDS 240
|
#define TIMEOUT_SECONDS 240
|
||||||
|
|
||||||
@interface UIExplorerTests : XCTestCase
|
@interface UIExplorerTests : XCTestCase
|
||||||
@ -29,11 +31,14 @@
|
|||||||
|
|
||||||
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
|
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
|
||||||
BOOL foundElement = NO;
|
BOOL foundElement = NO;
|
||||||
|
NSString *redboxError = nil;
|
||||||
|
|
||||||
while ([date timeIntervalSinceNow] > 0 && !foundElement) {
|
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
|
||||||
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
|
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
|
||||||
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
|
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
|
||||||
|
|
||||||
|
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
|
||||||
|
|
||||||
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
|
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
|
||||||
if ([view respondsToSelector:@selector(attributedText)]) {
|
if ([view respondsToSelector:@selector(attributedText)]) {
|
||||||
NSString *text = [(id)view attributedText].string;
|
NSString *text = [(id)view attributedText].string;
|
||||||
@ -45,6 +50,7 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
|
||||||
XCTAssertTrue(foundElement, @"Cound't find element with '<View>' text in %d seconds", TIMEOUT_SECONDS);
|
XCTAssertTrue(foundElement, @"Cound't find element with '<View>' text in %d seconds", TIMEOUT_SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user