From 378e59b90a402a110551742112eb4e1c7589b47b Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Tue, 10 Mar 2015 18:57:27 -0700 Subject: [PATCH] [ReactNative] Make tests run on TravisCI --- .../UIExplorer/UIExplorer.xcodeproj/project.pbxproj | 12 ++++++------ .../UIExplorer/UIExplorerTests/UIExplorerTests.m | 6 ++++-- package.json | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj b/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj index c2a4940c5..d9a201502 100644 --- a/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj +++ b/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj @@ -73,7 +73,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 004D289E1AAF61C70097A701 /* UIExplorerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UIExplorerTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 004D289E1AAF61C70097A701 /* UIExplorerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UIExplorerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 004D28A11AAF61C70097A701 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 004D28A21AAF61C70097A701 /* UIExplorerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIExplorerTests.m; sourceTree = ""; }; 13417FE31AA91428003F314A /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; @@ -121,7 +121,7 @@ 004D28A21AAF61C70097A701 /* UIExplorerTests.m */, 004D28A01AAF61C70097A701 /* Supporting Files */, ); - path = "UIExplorerTests"; + path = UIExplorerTests; sourceTree = ""; }; 004D28A01AAF61C70097A701 /* Supporting Files */ = { @@ -241,8 +241,8 @@ dependencies = ( 004D28A51AAF61C70097A701 /* PBXTargetDependency */, ); - name = "UIExplorerTests"; - productName = "UIExplorerTests"; + name = UIExplorerTests; + productName = UIExplorerTests; productReference = 004D289E1AAF61C70097A701 /* UIExplorerTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; @@ -439,7 +439,7 @@ "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = "UIExplorerTests/Info.plist"; + INFOPLIST_FILE = UIExplorerTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -455,7 +455,7 @@ "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); - INFOPLIST_FILE = "UIExplorerTests/Info.plist"; + INFOPLIST_FILE = UIExplorerTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m b/Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m index 4fcbeb488..1a7a70d78 100644 --- a/Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m +++ b/Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m @@ -3,6 +3,8 @@ #import #import +#define TIMEOUT_SECONDS 30 + @interface UIExplorerTests : XCTestCase @end @@ -25,7 +27,7 @@ - (void)testRootViewLoadsAndRenders { UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:5]; + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; BOOL foundElement = NO; while ([date timeIntervalSinceNow] > 0 && !foundElement) { @@ -43,7 +45,7 @@ }]; } - XCTAssertTrue(foundElement, @"Cound't find element with '' text in 5 seconds"); + XCTAssertTrue(foundElement, @"Cound't find element with '' text in %d seconds", TIMEOUT_SECONDS); } diff --git a/package.json b/package.json index f0af6823e..13a3467e8 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "scriptPreprocessor": "jestSupport/scriptPreprocess.js", "setupEnvScriptFile": "jestSupport/env.js", "testPathIgnorePatterns": [ - "/node_modules/" + "/node_modules/", + "packager/react-packager/src/Activity/" ], "testFileExtensions": [ "js"