diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index c48ff3dd..a703e5ec 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -64,7 +64,15 @@ if [ "${RELEASE_TEST}" -eq 1 ]; then fi if [ "${RELEASE_TEST}" -eq 1 ]; then - . scripts/automation-tests.sh + for configuration in ${CONFIGURATIONS[@]} + do + rx "RxSwift-tvOS" ${configuration} "Krunoslav Zaher’s iPhone" test + done + + for configuration in ${CONFIGURATIONS[@]} + do + rx "RxSwift-tvOS" ${configuration} $DEFAULT_TVOS_SIMULATOR test + done fi #make sure all tvOS tests pass diff --git a/scripts/automation-tests.sh b/scripts/automation-tests.sh deleted file mode 100755 index 0e1f3ee8..00000000 --- a/scripts/automation-tests.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -set -e - -NUM_OF_TESTS=13 -CURRENT_DIR="$( dirname "${BASH_SOURCE[0]}" )" -BUILD_DIRECTORY=build -APP=RxExample -CONFIGURATIONS=(Debug Release-Tests Release) - -. scripts/common.sh - -cd "${CURRENT_DIR}/.." - -ROOT=`pwd` -BUILD_DIRECTORY="${ROOT}/build" - -function runAutomation() { - SCHEME=$1 - CONFIGURATION=$2 - SIMULATOR=$3 - - APP="${SCHEME}" - - echo - printf "${GREEN}Building example for automation ${BOLDCYAN}${SIMULATOR} - ${CONFIGURATION}${RESET}" - echo - - rx $SCHEME $CONFIGURATION $SIMULATOR build - - echo - printf "${GREEN}Quitting iOS Simulator ...${RESET}" - echo - - osascript -e 'quit app "iOS Simulator.app"' > /dev/null - - if is_real_device "${SIMULATOR}"; then - SIMULATOR_ID="${SIMULATOR}" - else - SIMULATOR_ID=`simulator_ids "${SIMULATOR}"` - echo - printf "${GREEN}Firing up simulator ${BOLDCYAN}${SIMULATOR}${GREEN}...${RESET}\n" - echo - xcrun instruments -w ${SIMULATOR_ID} > /dev/null 2>&1 || echo - fi - - echo - if is_real_device "${SIMULATOR}"; then - OUTPUT_DIR=${CONFIGURATION}-iphoneos - else - OUTPUT_DIR=${CONFIGURATION}-iphonesimulator - fi - APP_PATH="${BUILD_DIRECTORY}/Build/Products/${OUTPUT_DIR}/${APP}.app" - printf "${GREEN}Installing the app ${BOLDCYAN}'${APP_PATH}'${GREEN} (${CONFIGURATION}) ${RESET}...\n" - echo - - if is_real_device "${SIMULATOR}"; then - /Users/kzaher/Projects/ios-deploy/ios-deploy --bundle "${APP_PATH}" - else - xcrun simctl install ${SIMULATOR_ID} "${APP_PATH}" - fi - - 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_ID}" -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; - else - printf "${GREEN}Automation says ok on ${BOLDCYAN}${SIMULATOR} - ${CONFIGURATION}${RESET}\n" - fi - popd -} - -AUTOMATION_SIMULATORS=("Krunoslav Zaher’s iPhone" ${DEFAULT_IOS_SIMULATOR}) -#AUTOMATION_SIMULATORS=(${DEFAULT_IOS_SIMULATOR}) - -IFS="" -for simulator in ${AUTOMATION_SIMULATORS[@]} -do - for configuration in ${CONFIGURATIONS[@]} - do - runAutomation "RxExample-iOS" ${configuration} ${simulator} - done -done diff --git a/scripts/automation-tests/01_githubSignUp.js b/scripts/automation-tests/01_githubSignUp.js deleted file mode 100644 index 0d287fd7..00000000 --- a/scripts/automation-tests/01_githubSignUp.js +++ /dev/null @@ -1,32 +0,0 @@ - - -test("----- githubSignUp -----", function (check, pass) { - - var target = UIATarget.localTarget(); - - UIATarget.onAlert = function(alert){ - var okButton = UIATarget.localTarget().frontMostApp().alert().cancelButton().tap(); - - sleep(1) - goBack() - - pass() - return false; - } - - target.frontMostApp().mainWindow().tableViews()[0].cells()[3].tap(); - - target.frontMostApp().mainWindow().textFields()[0].tap(); - target.frontMostApp().keyboard().typeString("rxrevolution") - - target.frontMostApp().mainWindow().secureTextFields()[0].tap(); - target.frontMostApp().keyboard().typeString("mypassword") - - target.frontMostApp().mainWindow().secureTextFields()[1].tap(); - target.frontMostApp().keyboard().typeString("mypassword") - - UIATarget.localTarget().tap({x:14.50, y:80.00}); - target.frontMostApp().mainWindow().buttons()["Sign up"].tap(); - - sleep(2) -}); diff --git a/scripts/automation-tests/02_searchWikipedia.js b/scripts/automation-tests/02_searchWikipedia.js deleted file mode 100644 index fe5d4737..00000000 --- a/scripts/automation-tests/02_searchWikipedia.js +++ /dev/null @@ -1,37 +0,0 @@ - - -test("----- searchWikipedia -----", function (check, pass) { - - var target = UIATarget.localTarget() - - var width = target.frontMostApp().mainWindow().rect().size.width - - target.frontMostApp().mainWindow().tableViews()[0].cells()[12].tap(); - - target.delay(2); - - var searchBar = target.frontMostApp().mainWindow().searchBars()[0]; - - searchBar.tap() - target.frontMostApp().keyboard().typeString("banana"); - - target.delay(1); - - target.tap({x:width - 40, y:43}); - - target.delay(1); - - searchBar.tap(); - target.delay(1); - - target.frontMostApp().keyboard().typeString("Yosemite"); - target.delay(1); - - target.tap({x:width - 40, y:43}); - - target.delay(1); - - goBack(); - - pass(); -}); diff --git a/scripts/automation-tests/03_masterDetail.js b/scripts/automation-tests/03_masterDetail.js deleted file mode 100644 index 96f18ed0..00000000 --- a/scripts/automation-tests/03_masterDetail.js +++ /dev/null @@ -1,32 +0,0 @@ - - -test("----- masterDetail -----", function (check, pass) { - - function yOffset (pixels) { - return pixels / UIATarget.localTarget().frontMostApp().mainWindow().rect().size.height - } - - var target = UIATarget.localTarget() - - target.delay(2) - - target.frontMostApp().mainWindow().tableViews()[0].cells()[10].tap(); - target.frontMostApp().navigationBar().rightButton().tap(); - target.frontMostApp().mainWindow().dragInsideWithOptions({startOffset:{x:0.93, y:yOffset(300)}, endOffset:{x:0.95, y:yOffset(200)}, duration:1.5}); - target.frontMostApp().mainWindow().dragInsideWithOptions({startOffset:{x:0.93, y:yOffset(300)}, endOffset:{x:0.95, y:yOffset(100)}, duration:1.5}); - - var firstCell = UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].cells()[0] - - firstCell.tapWithOptions({tapOffset:{x:0.05, y:0.77}}); - - firstCell.tapWithOptions({tapOffset:{x:0.95, y:0.77}}); - - target.delay( 3 ); - - target.frontMostApp().navigationBar().rightButton().tap(); - target.frontMostApp().mainWindow().tableViews()[0].cells()[0].tap(); - goBack(); - goBack(); - - pass() -}); diff --git a/scripts/automation-tests/04_controlsTests.js b/scripts/automation-tests/04_controlsTests.js deleted file mode 100644 index 639b03fb..00000000 --- a/scripts/automation-tests/04_controlsTests.js +++ /dev/null @@ -1,160 +0,0 @@ - -var apiTestIndex = 5 - -var firstScrollView = function () { - return UIATarget.localTarget().frontMostApp().mainWindow().scrollViews()[0] -} - -var goToControlsScreen = function() { - var target = UIATarget.localTarget(); - target.frontMostApp().mainWindow().tableViews()[0].cells()[apiTestIndex].tap(); - sleep(1) -} - -test("----- UIDatePicker date -----", function (check, pass) { - - goToControlsScreen(); - - var scrollView = firstScrollView(); - - var picker = scrollView.pickers()[0]; - picker.wheels()[0].tapWithOptions({tapOffset:{x:0.49, y:0.65}}); - picker.wheels()[1].tapWithOptions({tapOffset:{x:0.35, y:0.64}}); - picker.wheels()[2].tapWithOptions({tapOffset:{x:0.46, y:0.64}}); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UIDatePicker date 1970-01-02 00:00:00 +0000"; - }); - - goBack(); -}); - -test("----- UIBarButtonItem tap -----", function (check, pass) { - goToControlsScreen(); - - var scrollView = firstScrollView(); - - UIATarget.localTarget().frontMostApp().navigationBar().rightButton().tap(); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UIBarButtonItem Tapped"; - }); - - goBack(); -}); - - -test("----- UIButton tap -----", function (check, pass) { - goToControlsScreen(); - - var scrollView = firstScrollView(); - scrollView.buttons()["TapMe"].tap(); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UIButton Tapped"; - }); - - goBack(); -}); - - -test("----- UISegmentedControl tap -----", function (check, pass) { - goToControlsScreen(); - - var scrollView = firstScrollView(); - - scrollView.segmentedControls()[0].buttons()["Second"].tap(); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UISegmentedControl value 1"; - }); - - scrollView.segmentedControls()[0].buttons()["First"].tap(); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UISegmentedControl value 0"; - }); - - goBack(); -}); - - - - -test("----- UISwitch tap -----", function (check, pass) { - goToControlsScreen(); - - var scrollView = firstScrollView(); - - scrollView.switches()[0].setValue(0); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UISwitch value false"; - }); - - scrollView.switches()[0].setValue(1); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UISwitch value true"; - }); - - goBack(); -}); - - -test("----- UITextField text -----", function (check, pass) { - - goToControlsScreen(); - - var scrollView = firstScrollView(); - - scrollView.textFields()[0].tap(); - typeString("t"); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UITextField text t"; - }); - - goBack(); -}); - -test("----- UITextView text -----", function (check, pass) { - - goToControlsScreen(); - - var scrollView = firstScrollView(); - - scrollView.textViews()[0].tap(); - typeString("t"); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UITextView text t"; - }); - - goBack(); -}); - -test("----- UISlider value -----", function (check, pass) { - - goToControlsScreen(); - - var scrollView = firstScrollView(); - - scrollView.sliders()[0].dragToValue(0.00); - - check(function () { - var textValue = scrollView.staticTexts()["debugLabel"].value(); - return textValue === "UISlider value 0.0"; - }); - - goBack(); -}); diff --git a/scripts/automation-tests/05_reactivePartialUpdates.js b/scripts/automation-tests/05_reactivePartialUpdates.js deleted file mode 100644 index 2f5e436c..00000000 --- a/scripts/automation-tests/05_reactivePartialUpdates.js +++ /dev/null @@ -1,20 +0,0 @@ - - -test("----- reactivePartialUpdates -----", function (check, pass) { - var target = UIATarget.localTarget() - - target.frontMostApp().mainWindow().tableViews()[0].cells()[11].tap(); - - var rightButton = target.frontMostApp().navigationBar().rightButton(); - rightButton.tap(); - rightButton.tap(); - rightButton.tap(); - rightButton.tap(); - rightButton.tap(); - rightButton.tap(); - rightButton.tap(); - - goBack() - - pass() -}); diff --git a/scripts/automation-tests/common.js b/scripts/automation-tests/common.js deleted file mode 100644 index 4e90121f..00000000 --- a/scripts/automation-tests/common.js +++ /dev/null @@ -1,55 +0,0 @@ -var goBack = function() { - UIATarget.localTarget().frontMostApp().navigationBar().leftButton().tap() -} - -var typeString = function(value) { - UIATarget.localTarget().frontMostApp().keyboard().typeString(value) -} - -function test(testName, callback) { - - function pass() { - UIALogger.logPass( testName ); - } - - function fail() { - UIALogger.logFail( testName ); - } - - function check(f) { - if (f()){ - pass() - } - else { - fail() - } - } - - sleep(1) - UIALogger.logStart( testName ); - callback(check, pass) -} - -function log(element) { - UIALogger.logMessage(element.toString()) -} - -function debug(element) { - UIALogger.logDebug(element.toString()) -} - -function logElement(element) { - UIALogger.logDebug(element.toString()) -} - -function error(string) { - UIALogger.logError(string) -} - -function warning(string) { - UIALogger.logWarning(string) -} - -function sleep(time) { - UIATarget.localTarget().delay(time); -} \ No newline at end of file diff --git a/scripts/automation-tests/main.js b/scripts/automation-tests/main.js deleted file mode 100644 index af083eb4..00000000 --- a/scripts/automation-tests/main.js +++ /dev/null @@ -1,17 +0,0 @@ - -#import "common.js" -#import "01_githubSignUp.js" -#import "02_searchWikipedia.js" -#import "03_masterDetail.js" -#import "04_controlsTests.js" -#import "05_reactivePartialUpdates.js" - -var target = UIATarget.localTarget(); - -// open all screens -for (var i = 0; i < 14; ++i) { - log(i); - target.delay( 0.5 ); - target.frontMostApp().mainWindow().tableViews()[0].cells()[i].tap(); - target.frontMostApp().navigationBar().leftButton().tap(); -}