From 1eccea65f87f9ef4ccd8ce5ef88317d7ec94158f Mon Sep 17 00:00:00 2001 From: Krunoslav Zaher Date: Sun, 2 Aug 2015 12:00:39 +0200 Subject: [PATCH] Adding CI. --- .travis.yml | 10 ++ .../Subjects.playground/contents.xcplayground | 4 +- RxExample/RxExample.xcodeproj/project.pbxproj | 15 ++- .../xcschemes/RxExample-OSX.xcscheme | 88 +++++++++++++++++ .../RxExample-iOS-no-module.xcscheme | 88 +++++++++++++++++ .../xcschemes/RxExample-iOS.xcscheme | 96 ++++++++++++++++++ .../Schedulers/RecursiveScheduler.swift | 2 +- .../Tests/Observable+TimeTest.swift | 8 +- .../xcschemes/RxTests-OSX.xcscheme | 96 ++++++++++++++++++ .../xcschemes/RxTests-iOS.xcscheme | 99 +++++++++++++++++++ automation-tests.sh | 83 ---------------- automation-tests/01_githubSignUp.js | 72 -------------- automation-tests/02_searchWikipedia.js | 50 ---------- scripts/automation-tests.sh | 99 +++++++++++++++++++ scripts/automation-tests/01_githubSignUp.js | 40 ++++++++ .../automation-tests/02_searchWikipedia.js | 36 +++++++ .../automation-tests}/03_masterDetail.js | 0 .../automation-tests}/04_controlsTests.js | 0 .../05_reactivePartialUpdates.js | 0 .../automation-tests}/common.js | 6 ++ .../automation-tests}/main.js | 0 scripts/common.sh | 45 +++++---- .../pre-release-tests.sh | 12 ++- 23 files changed, 707 insertions(+), 242 deletions(-) create mode 100644 .travis.yml create mode 100644 RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-OSX.xcscheme create mode 100644 RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS-no-module.xcscheme create mode 100644 RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS.xcscheme create mode 100644 RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-OSX.xcscheme create mode 100644 RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-iOS.xcscheme delete mode 100755 automation-tests.sh delete mode 100644 automation-tests/01_githubSignUp.js delete mode 100644 automation-tests/02_searchWikipedia.js create mode 100755 scripts/automation-tests.sh create mode 100644 scripts/automation-tests/01_githubSignUp.js create mode 100644 scripts/automation-tests/02_searchWikipedia.js rename {automation-tests => scripts/automation-tests}/03_masterDetail.js (100%) rename {automation-tests => scripts/automation-tests}/04_controlsTests.js (100%) rename {automation-tests => scripts/automation-tests}/05_reactivePartialUpdates.js (100%) rename {automation-tests => scripts/automation-tests}/common.js (82%) rename {automation-tests => scripts/automation-tests}/main.js (100%) rename pre-release-tests.sh => scripts/pre-release-tests.sh (65%) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..de8372cb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: objective-c + +osx_image: xcode6.4 +xcode_sdk: iphonesimulator8.4 + +notifications: + email: false + + +script: ./scripts/pre-release-tests.sh diff --git a/Playgrounds/Subjects.playground/contents.xcplayground b/Playgrounds/Subjects.playground/contents.xcplayground index 0b962190..832f045e 100644 --- a/Playgrounds/Subjects.playground/contents.xcplayground +++ b/Playgrounds/Subjects.playground/contents.xcplayground @@ -1,4 +1,2 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/RxExample/RxExample.xcodeproj/project.pbxproj b/RxExample/RxExample.xcodeproj/project.pbxproj index 5d48f844..e70c13e3 100644 --- a/RxExample/RxExample.xcodeproj/project.pbxproj +++ b/RxExample/RxExample.xcodeproj/project.pbxproj @@ -171,7 +171,6 @@ C8297F511B6CF94B000589EA /* SchedulerServices+Emulation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297EE01B6CF94B000589EA /* SchedulerServices+Emulation.swift */; }; C8297F521B6CF94B000589EA /* SerialDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297EE11B6CF94B000589EA /* SerialDispatchQueueScheduler.swift */; }; C8297F531B6CF94B000589EA /* DispatchQueueSchedulerPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297EE21B6CF94B000589EA /* DispatchQueueSchedulerPriority.swift */; }; - C8297F541B6CF94B000589EA /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8297EE41B6CF94B000589EA /* Info.plist */; }; C8297FA21B6CF953000589EA /* RxCLLocationManagerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297F551B6CF953000589EA /* RxCLLocationManagerDelegateProxy.swift */; }; C8297FA31B6CF953000589EA /* ControlTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297F571B6CF953000589EA /* ControlTarget.swift */; }; C8297FA41B6CF953000589EA /* Deallocating.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297F581B6CF953000589EA /* Deallocating.swift */; }; @@ -226,7 +225,6 @@ C8297FDA1B6CF953000589EA /* UIAlertView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297F9A1B6CF953000589EA /* UIAlertView+Rx.swift */; }; C8297FDB1B6CF953000589EA /* UISegmentedControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297F9B1B6CF953000589EA /* UISegmentedControl+Rx.swift */; }; C8297FDC1B6CF953000589EA /* UISwitch+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8297F9C1B6CF953000589EA /* UISwitch+Rx.swift */; }; - C8297FDD1B6CF953000589EA /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8297F9F1B6CF953000589EA /* Info.plist */; }; C83367231AD029AE00C668A7 /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = C833670F1AD029AE00C668A7 /* Example.swift */; }; C83367241AD029AE00C668A7 /* HtmlParsing.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83367111AD029AE00C668A7 /* HtmlParsing.swift */; }; C83367251AD029AE00C668A7 /* ImageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C83367121AD029AE00C668A7 /* ImageService.swift */; }; @@ -460,7 +458,7 @@ C8297F5D1B6CF953000589EA /* NSObject+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSObject+Rx.swift"; sourceTree = ""; }; C8297F5E1B6CF953000589EA /* NSObject+Rx+CoreGraphics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSObject+Rx+CoreGraphics.swift"; sourceTree = ""; }; C8297F5F1B6CF953000589EA /* NSNotificationCenter+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSNotificationCenter+Rx.swift"; sourceTree = ""; }; - C8297F601B6CF953000589EA /* NSURLSession+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSURLSession+Rx.swift"; sourceTree = ""; }; + C8297F601B6CF953000589EA /* NSURLSession+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSURLSession+Rx.swift"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; C8297F621B6CF953000589EA /* CLLocationManager+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "CLLocationManager+Rx.swift"; sourceTree = ""; }; C8297F631B6CF953000589EA /* DelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DelegateProxy.swift; sourceTree = ""; }; C8297F641B6CF953000589EA /* DelegateProxyType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DelegateProxyType.swift; sourceTree = ""; }; @@ -511,7 +509,7 @@ C8297F9C1B6CF953000589EA /* UISwitch+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "UISwitch+Rx.swift"; sourceTree = ""; }; C8297F9E1B6CF953000589EA /* RxCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RxCocoa.h; sourceTree = ""; }; C8297F9F1B6CF953000589EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C83366DD1AD0293800C668A7 /* RxExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C83366DD1AD0293800C668A7 /* RxExample-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RxExample-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; C833670F1AD029AE00C668A7 /* Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Example.swift; sourceTree = ""; }; C83367111AD029AE00C668A7 /* HtmlParsing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HtmlParsing.swift; sourceTree = ""; }; C83367121AD029AE00C668A7 /* ImageService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageService.swift; sourceTree = ""; }; @@ -1003,7 +1001,7 @@ C83366DE1AD0293800C668A7 /* Products */ = { isa = PBXGroup; children = ( - C83366DD1AD0293800C668A7 /* RxExample.app */, + C83366DD1AD0293800C668A7 /* RxExample-iOS.app */, C88BB8DC1B07E6C90064D411 /* RxExample.app */, C8297E691B6CF905000589EA /* RxExample-iOS-no-module.app */, ); @@ -1226,7 +1224,7 @@ ); name = "RxExample-iOS"; productName = RxExample; - productReference = C83366DD1AD0293800C668A7 /* RxExample.app */; + productReference = C83366DD1AD0293800C668A7 /* RxExample-iOS.app */; productType = "com.apple.product-type.application"; }; C88BB8B91B07E6C90064D411 /* RxExample-OSX */ = { @@ -1287,9 +1285,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - C8297F541B6CF94B000589EA /* Info.plist in Resources */, C8297E5D1B6CF905000589EA /* WikipediaSearchCell.xib in Resources */, - C8297FDD1B6CF953000589EA /* Info.plist in Resources */, C8297E5E1B6CF905000589EA /* LaunchScreen.xib in Resources */, C8297F181B6CF94B000589EA /* CombineLatest+arity.tt in Resources */, C8297E5F1B6CF905000589EA /* WikipediaImageCell.xib in Resources */, @@ -1743,6 +1739,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = "-objc_loadall"; + PRODUCT_NAME = "RxExample-iOS"; SDKROOT = iphoneos; }; name = Debug; @@ -1754,6 +1751,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = "-objc_loadall"; + PRODUCT_NAME = "RxExample-iOS"; SDKROOT = iphoneos; }; name = Release; @@ -1829,6 +1827,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = "-objc_loadall"; + PRODUCT_NAME = "RxExample-iOS"; SDKROOT = iphoneos; }; name = "Release-Tests"; diff --git a/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-OSX.xcscheme b/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-OSX.xcscheme new file mode 100644 index 00000000..7cf565a2 --- /dev/null +++ b/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-OSX.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS-no-module.xcscheme b/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS-no-module.xcscheme new file mode 100644 index 00000000..076800ec --- /dev/null +++ b/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS-no-module.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS.xcscheme b/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS.xcscheme new file mode 100644 index 00000000..95d39d82 --- /dev/null +++ b/RxExample/RxExample.xcodeproj/xcshareddata/xcschemes/RxExample-iOS.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift b/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift index 884ae5a5..73370448 100644 --- a/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift +++ b/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift @@ -201,7 +201,7 @@ class RecursiveImmediateSchedulerOf : Disposable { }) } - public func dispose() { + func dispose() { self.lock.performLocked { self.action = nil } diff --git a/RxTests/RxSwiftTests/Tests/Observable+TimeTest.swift b/RxTests/RxSwiftTests/Tests/Observable+TimeTest.swift index bacf5a36..d7b2f8b6 100644 --- a/RxTests/RxSwiftTests/Tests/Observable+TimeTest.swift +++ b/RxTests/RxSwiftTests/Tests/Observable+TimeTest.swift @@ -271,12 +271,12 @@ extension ObservableTimeTest { let start = NSDate() let a = concat(from([just(0), never()])) - >- throttle(0.5, scheduler) + >- throttle(2, scheduler) >- first let end = NSDate() - XCTAssertEqualWithAccuracy(0.5, end.timeIntervalSinceDate(start), 0.15) + XCTAssertEqualWithAccuracy(2, end.timeIntervalSinceDate(start), 0.5) XCTAssertEqual(a.get()!, 0) } } @@ -813,13 +813,13 @@ extension ObservableTimeTest { let start = NSDate() - let a = interval(0.5, scheduler) + let a = interval(1, scheduler) >- take(2) >- toArray let end = NSDate() - XCTAssertEqualWithAccuracy(1, end.timeIntervalSinceDate(start), 0.15) + XCTAssertEqualWithAccuracy(2, end.timeIntervalSinceDate(start), 0.3) XCTAssertEqual(a.get(), [0, 1]) } } diff --git a/RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-OSX.xcscheme b/RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-OSX.xcscheme new file mode 100644 index 00000000..4af5b8bb --- /dev/null +++ b/RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-OSX.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-iOS.xcscheme b/RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-iOS.xcscheme new file mode 100644 index 00000000..991cd42c --- /dev/null +++ b/RxTests/RxTests.xcodeproj/xcshareddata/xcschemes/RxTests-iOS.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/automation-tests.sh b/automation-tests.sh deleted file mode 100755 index 30e4d88b..00000000 --- a/automation-tests.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - - -set -e -NUM_OF_TESTS=14 -CURRENT_DIR="$( dirname "${BASH_SOURCE[0]}" )" -BUILD_DIRECTORY=$TMPDIR/build -APP=RxExample -CONFIGURATIONS="Debug Release-Tests Release" -SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4 RxSwiftTest-iPhone4s-iOS_8.1 RxSwiftTest-iPhone5-iOS_8.1 RxSwiftTest-iPhone5s-iOS_8.1 RxSwiftTest-iPhone6-iOS_8.1 RxSwiftTest-iPhone6Plus-iOS_8.1" - -open $TMPDIR - -cd $CURRENT_DIR - -. scripts/common.sh - -echo "(Rx root ${CURRENT_DIR})" - -cd "${CURRENT_DIR}" - -CURRENT_DIR=`pwd` - -function runAutomation() { - SIMULATOR=$1 - CONFIGURATION=$2 - - echo - echo - echo - echo - printf "${GREEN}Building example for automation ${BOLDCYAN}${SIMULATOR} - ${CONFIGURATION}${RESET}" - echo - - OS=`echo $SIMULATOR| cut -d'_' -f 2` - xcodebuild -workspace Rx.xcworkspace -scheme RxExample-iOS -derivedDataPath ${BUILD_DIRECTORY} -configuration ${CONFIGURATION} -destination platform='iOS Simulator',OS="${OS}",name="${SIMULATOR}" build > /dev/null - - echo - printf "${GREEN}Quitting iOS Simulator ...${RESET}" - echo - - osascript -e 'quit app "iOS Simulator.app"' > /dev/null - - echo - printf "${GREEN}Firing up simulator ${BOLDCYAN}${SIMULATOR}${GREEN}...${RESET}\n" - echo - - xcrun instruments -w ${SIMULATOR} > /dev/null 2>&1 || echo - - echo - printf "${GREEN}Installing the app ...${RESET}\n" - echo - - xcrun simctl install ${SIMULATOR} ${BUILD_DIRECTORY}/Build/Products/${CONFIGURATION}-iphonesimulator/${APP}.app - - pushd $TMPDIR - rm -rf instrumentscli0.trace || echo - echo - printf "${GREEN}Running instruments ...${RESET}\n" - echo - - instruments -w ${SIMULATOR} -t Automation ${APP} -e UIASCRIPT $CURRENT_DIR/automation-tests/main.js > $TMPDIR/output.txt #|| (open instrumentscli0.trace; exit -1;) - COUNT=`grep Pass: $TMPDIR/output.txt | wc -l` - - if [ "$COUNT" -lt "$NUM_OF_TESTS" ]; then - echo - printf "${RED}${SIMULATOR} - ${CONFIGURATION} tests do not passes${RESET}" - echo - printf "${RED}Pases ${COUNT} tests of ${NUM_OF_TESTS} ${RESET}" - echo - open ./instrumentscli0.trace; - exit; - fi - popd -} - -for simulator in ${SIMULATORS} -do - for configuration in ${CONFIGURATIONS} - do - runAutomation ${simulator} ${configuration} - done -done diff --git a/automation-tests/01_githubSignUp.js b/automation-tests/01_githubSignUp.js deleted file mode 100644 index 1a561410..00000000 --- a/automation-tests/01_githubSignUp.js +++ /dev/null @@ -1,72 +0,0 @@ - - -test("----- githubSignUp -----", function (check, pass) { - - UIATarget.onAlert = function(alert){ - UIATarget.localTarget().frontMostApp().alert().buttons()["Cancel"].tap(); - UIATarget.localTarget().frontMostApp().navigationBar().leftButton().tap(); - - pass() - return false; - } - - UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()[0].tapWithOptions({tapOffset:{x:0.24, y:0.20}}); - - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].tap(); - // UIATarget.localTarget().frontMostApp().keyboard().typeString("rxrevolution"); // fails if software keyboard is disabled - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("r"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rx"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxr"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxre"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrev"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevo"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevol"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevolu"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevolut"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevoluti"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevolutio"); - UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue("rxrevolution"); - - - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].tap(); - // UIATarget.localTarget().frontMostApp().keyboard().typeString("mypassword"); // fails if software keyboard is disabled - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("m"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("my"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("myp"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypa"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypas"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypass"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypassw"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypasswo"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypasswor"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].setValue("mypassword"); - - - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].tap(); - // UIATarget.localTarget().frontMostApp().keyboard().typeString("mypassword"); // fails if software keyboard is disabled - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("m"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("my"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("myp"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypa"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypas"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypass"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypassw"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypasswo"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypasswor"); - UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].setValue("mypassword"); - - UIATarget.localTarget().tap({x:14.50, y:80.00}); - UIATarget.localTarget().frontMostApp().mainWindow().buttons()["Sign up"].tap(); -}); - - - - - - - - - - - - diff --git a/automation-tests/02_searchWikipedia.js b/automation-tests/02_searchWikipedia.js deleted file mode 100644 index ddca778e..00000000 --- a/automation-tests/02_searchWikipedia.js +++ /dev/null @@ -1,50 +0,0 @@ - - -test("----- searchWikipedia -----", function (check, pass) { - - var width = UIATarget.localTarget().frontMostApp().mainWindow().rect().size.width - - UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()[1].tap(); - - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].tap(); - // UIATarget.localTarget().frontMostApp().keyboard().typeString("banana"); // fails if software keyboard is disabled - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("b"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("ba"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("ban"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("bana"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("banan"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("banana"); - UIATarget.localTarget().delay(2); - - UIATarget.localTarget().tap({x:width - 40, y:43}); - - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].tap(); - // UIATarget.localTarget().frontMostApp().keyboard().typeString("Yosemite"); // fails if software keyboard is disabled - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Y"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yo"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yos"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yose"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yosem"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yosemi"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yosemit"); - UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].setValue("Yosemite"); - UIATarget.localTarget().delay(2); - - - UIATarget.localTarget().tap({x:width - 40, y:43}); - UIATarget.localTarget().frontMostApp().navigationBar().leftButton().tap(); - - pass() -}); - - - - - - - - - - - - diff --git a/scripts/automation-tests.sh b/scripts/automation-tests.sh new file mode 100755 index 00000000..1e54c836 --- /dev/null +++ b/scripts/automation-tests.sh @@ -0,0 +1,99 @@ +#!/bin/bash + + +set -e +NUM_OF_TESTS=14 +CURRENT_DIR="$( dirname "${BASH_SOURCE[0]}" )" +BUILD_DIRECTORY=build +APP=RxExample +CONFIGURATIONS="Debug Release-Tests Release" +#SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4 RxSwiftTest-iPhone4s-iOS_8.1 RxSwiftTest-iPhone5-iOS_8.1 RxSwiftTest-iPhone5s-iOS_8.1 RxSwiftTest-iPhone6-iOS_8.1 RxSwiftTest-iPhone6Plus-iOS_8.1" +IOS7_SIMULATORS="RxSwiftTest-iPhone4s-iOS_7.1 RxSwiftTest-iPhone5-iOS_7.1 RxSwiftTest-iPhone5s-iOS_7.1" +IOS8_SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4" + +#open $TMPDIR + +. scripts/common.sh + +cd "${CURRENT_DIR}/.." + +ROOT=`pwd` +BUILD_DIRECTORY="${ROOT}/build" + +function runAutomation() { + SIMULATOR=$1 + CONFIGURATION=$2 + SCHEME=$3 + + APP="${SCHEME}" + + echo + echo + echo + echo + printf "${GREEN}Building example for automation ${BOLDCYAN}${SIMULATOR} - ${CONFIGURATION}${RESET}" + echo + + OS=`echo $SIMULATOR| cut -d'_' -f 2` + xcodebuild -workspace Rx.xcworkspace -scheme ${SCHEME} -derivedDataPath ${BUILD_DIRECTORY} -configuration ${CONFIGURATION} -destination platform='iOS Simulator',OS="${OS}",name="${SIMULATOR}" build | xcpretty -c + + echo + printf "${GREEN}Quitting iOS Simulator ...${RESET}" + echo + + osascript -e 'quit app "iOS Simulator.app"' > /dev/null + + echo + printf "${GREEN}Firing up simulator ${BOLDCYAN}${SIMULATOR}${GREEN}...${RESET}\n" + echo + + xcrun instruments -w ${SIMULATOR} > /dev/null 2>&1 || echo + + echo + APP_PATH="${BUILD_DIRECTORY}/Build/Products/${CONFIGURATION}-iphonesimulator/${APP}.app" + printf "${GREEN}Installing the app ${BOLDCYAN}'${APP_PATH}'${GREEN} ...${RESET}\n" + echo + + xcrun simctl install ${SIMULATOR} "${APP_PATH}" + + pushd $TMPDIR + rm -rf instrumentscli0.trace || echo + echo + printf "${GREEN}Running instruments ${BOLDCYAN}'${APP}'${GREEN}...${RESET}\n" + echo + + OUTPUT="${TMPDIR}/output.txt" + instruments -w ${SIMULATOR} -t Automation "${APP_PATH}" -e UIASCRIPT "${ROOT}/scripts/automation-tests/main.js" | tee "${OUTPUT}" #| grep "Pass" #|| (open instrumentscli0.trace; exit -1;) + COUNT=`grep Pass: "$TMPDIR/output.txt" | wc -l` + + if [ "$COUNT" -lt "$NUM_OF_TESTS" ]; then + echo + printf "${RED}${SIMULATOR} - ${CONFIGURATION} tests do not pass${RESET}" + echo + cat "${OUTPUT}" + echo + printf "${RED}Only ${COUNT} of ${NUM_OF_TESTS} pass ${RESET}" + echo + open ./instrumentscli0.trace; + exit -1; + fi + popd +} + +# ios 7 +for simulator in ${IOS7_SIMULATORS} +do + for configuration in ${CONFIGURATIONS} + do + runAutomation ${simulator} ${configuration} "RxExample-iOS-no-module" + done +done + +# ios 8 +for simulator in ${IOS8_SIMULATORS} +do + for configuration in ${CONFIGURATIONS} + do + runAutomation ${simulator} ${configuration} "RxExample-iOS" + done +done diff --git a/scripts/automation-tests/01_githubSignUp.js b/scripts/automation-tests/01_githubSignUp.js new file mode 100644 index 00000000..83374dd4 --- /dev/null +++ b/scripts/automation-tests/01_githubSignUp.js @@ -0,0 +1,40 @@ + + +test("----- githubSignUp -----", function (check, pass) { + + UIATarget.onAlert = function(alert){ + UIATarget.localTarget().frontMostApp().alert().buttons()["Cancel"].tap(); + UIATarget.localTarget().frontMostApp().navigationBar().leftButton().tap(); + + pass() + return false; + } + + UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()[0].tapWithOptions({tapOffset:{x:0.24, y:0.20}}); + + UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].tap(); + writeInElement(UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0], "rxrevolution") + + + UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0].tap(); + writeInElement(UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[0], "mypassword") + + + UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1].tap(); + writeInElement(UIATarget.localTarget().frontMostApp().mainWindow().secureTextFields()[1], "mypassword") + + UIATarget.localTarget().tap({x:14.50, y:80.00}); + UIATarget.localTarget().frontMostApp().mainWindow().buttons()["Sign up"].tap(); +}); + + + + + + + + + + + + diff --git a/scripts/automation-tests/02_searchWikipedia.js b/scripts/automation-tests/02_searchWikipedia.js new file mode 100644 index 00000000..381300f4 --- /dev/null +++ b/scripts/automation-tests/02_searchWikipedia.js @@ -0,0 +1,36 @@ + + +test("----- searchWikipedia -----", function (check, pass) { + + var width = UIATarget.localTarget().frontMostApp().mainWindow().rect().size.width + + UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()[1].tap(); + + UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].tap(); + writeInElement(UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0], "banana") + UIATarget.localTarget().delay(2); + + UIATarget.localTarget().tap({x:width - 40, y:43}); + + UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0].tap(); + writeInElement(UIATarget.localTarget().frontMostApp().mainWindow().searchBars()[0].searchBars()[0], "Yosemite") + UIATarget.localTarget().delay(2); + + + UIATarget.localTarget().tap({x:width - 40, y:43}); + UIATarget.localTarget().frontMostApp().navigationBar().leftButton().tap(); + + pass() +}); + + + + + + + + + + + + diff --git a/automation-tests/03_masterDetail.js b/scripts/automation-tests/03_masterDetail.js similarity index 100% rename from automation-tests/03_masterDetail.js rename to scripts/automation-tests/03_masterDetail.js diff --git a/automation-tests/04_controlsTests.js b/scripts/automation-tests/04_controlsTests.js similarity index 100% rename from automation-tests/04_controlsTests.js rename to scripts/automation-tests/04_controlsTests.js diff --git a/automation-tests/05_reactivePartialUpdates.js b/scripts/automation-tests/05_reactivePartialUpdates.js similarity index 100% rename from automation-tests/05_reactivePartialUpdates.js rename to scripts/automation-tests/05_reactivePartialUpdates.js diff --git a/automation-tests/common.js b/scripts/automation-tests/common.js similarity index 82% rename from automation-tests/common.js rename to scripts/automation-tests/common.js index 37bdf90b..bb334f76 100644 --- a/automation-tests/common.js +++ b/scripts/automation-tests/common.js @@ -47,5 +47,11 @@ function sleep(time) { UIATarget.localTarget().delay(time); } +function writeInElement(element, text) { + var char + for (var i = 1; i < text.length + 1; i++) { + element.setValue(text.substring(0, i)); + } +} diff --git a/automation-tests/main.js b/scripts/automation-tests/main.js similarity index 100% rename from automation-tests/main.js rename to scripts/automation-tests/main.js diff --git a/scripts/common.sh b/scripts/common.sh index 97244e2e..a2a4d9c0 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,17 +1,6 @@ #!/bin/bash set -e -CLEAN="" - -if [ "$#" -eq 1 ]; then - echo "Not cleaning up" - CLEAN=" clean " -else - echo "Cleaning up first" -fi - -echo "CLEAN=${CLEAN}" - RESET="\033[0m" BLACK="\033[30m" RED="\033[31m" @@ -38,7 +27,8 @@ function runTests() { echo printf "${GREEN}Running tests for ${BOLDCYAN}$1 - $2${RESET}\n" echo - xcodebuild -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" -derivedDataPath ${BUILD_DIRECTORY} ${CLEAN} test > /dev/null + + xcodebuild -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" -derivedDataPath ${BUILD_DIRECTORY} test | xcpretty -c #if [[ $scheme == *"iOS"* ]] #then @@ -52,7 +42,7 @@ function buildExample() { printf "${GREEN}Building example for ${BOLDCYAN}$1 - $2${RESET}\n" echo - xcodebuild -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" ${CLEAN} build > /dev/null + xcodebuild -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" build | xcpretty -c } # simulators @@ -60,14 +50,31 @@ function buildExample() { # xcrun simctl list devicetypes # xcrun simctl list runtimes +#IOS7_SIMULATORS="RxSwiftTest-iPhone4s-iOS_7.1 RxSwiftTest-iPhone5-iOS_7.1 RxSwiftTest-iPhone5s-iOS_7.1" +#IOS8_SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4" + function createDevices() { - xcrun simctl create RxSwiftTest-iPhone5s-iOS7.1 'iPhone 5s' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1' - xcrun simctl create RxSwiftTest-iPhone5-iOS7.1 'iPhone 5' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1' - xcrun simctl create RxSwiftTest-iPhone6-iOS8.4 'iPhone 6' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4' + xcrun simctl create RxSwiftTest-iPhone4s-iOS_7.1 'iPhone 4s' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1' + xcrun simctl create RxSwiftTest-iPhone5-iOS_7.1 'iPhone 5' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1' + xcrun simctl create RxSwiftTest-iPhone5s-iOS_7.1 'iPhone 5s' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1' + + xcrun simctl create RxSwiftTest-iPhone4s-iOS_8.4 'iPhone 4s' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4' + xcrun simctl create RxSwiftTest-iPhone5-iOS_8.4 'iPhone 5' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4' + xcrun simctl create RxSwiftTest-iPhone5s-iOS_8.4 'iPhone 5s' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4' + + xcrun simctl create RxSwiftTest-iPhone6-iOS_8.4 'iPhone 6' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4' + xcrun simctl create RxSwiftTest-iPhone6Plus-iOS_8.4 'iPhone 6 Plus' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4' } function deleteDevices() { - xcrun simctl delete RxSwiftTest-iPhone5s-iOS7.1 - xcrun simctl delete RxSwiftTest-iPhone5-iOS7.1 - xcrun simctl delete RxSwiftTest-iPhone6-iOS8.4 + xcrun simctl delete RxSwiftTest-iPhone4s-iOS_7.1 + xcrun simctl delete RxSwiftTest-iPhone5-iOS_7.1 + xcrun simctl delete RxSwiftTest-iPhone5s-iOS_7.1 + + xcrun simctl delete RxSwiftTest-iPhone4s-iOS_8.4 + xcrun simctl delete RxSwiftTest-iPhone5-iOS_8.4 + xcrun simctl delete RxSwiftTest-iPhone5s-iOS_8.4 + + xcrun simctl delete RxSwiftTest-iPhone6-iOS_8.4 + xcrun simctl delete RxSwiftTest-iPhone6Plus-iOS_8.4 } diff --git a/pre-release-tests.sh b/scripts/pre-release-tests.sh similarity index 65% rename from pre-release-tests.sh rename to scripts/pre-release-tests.sh index 6d6e4fae..8296b3d8 100755 --- a/pre-release-tests.sh +++ b/scripts/pre-release-tests.sh @@ -1,5 +1,11 @@ . scripts/common.sh +IS_LOCAL=0 +if [ "$#" -eq 1 ]; then + echo "Local test" + IS_LOCAL=1 +fi + #runTests "RxTests-iOS" "Release-Tests" #make sure all unit tests pass @@ -13,7 +19,7 @@ done # make sure it all build -for scheme in "RxExample-iOS" "RxExample-OSX" +for scheme in "RxExample-iOS" "RxExample-iOS-no-module" "RxExample-OSX" do for configuration in "Debug" "Release-Tests" "Release" do @@ -21,4 +27,6 @@ do done done -./automation-tests.sh +if [ "${IS_LOCAL}" -eq 1 ]; then + . scripts/automation-tests.sh +fi