Removes old automation tests.

This commit is contained in:
Krunoslav Zaher 2016-08-20 23:02:59 +02:00
parent b68fc4260e
commit ff6e4fd651
9 changed files with 9 additions and 452 deletions

View File

@ -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 Zahers iPhone" test
done
for configuration in ${CONFIGURATIONS[@]}
do
rx "RxSwift-tvOS" ${configuration} $DEFAULT_TVOS_SIMULATOR test
done
fi
#make sure all tvOS tests pass

View File

@ -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 Zahers 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

View File

@ -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)
});

View File

@ -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();
});

View File

@ -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()
});

View File

@ -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();
});

View File

@ -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()
});

View File

@ -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);
}

View File

@ -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();
}