Finish the transfer to grunt. Remove the bash script running the app

This commit is contained in:
Erjan Gavalji
2015-10-21 09:55:34 +03:00
parent d2f5bae597
commit 1543283f4a
2 changed files with 45 additions and 53 deletions

View File

@@ -17,7 +17,7 @@ module.exports = {
applicationDir: pathModule.join(".testsapprun", "TestsApp"),
appDir: pathModule.join(".testsapprun", "TestsApp", "app"),
pathToApk:"./platforms/android/build/outputs/apk/TestsApp-debug.apk",
deployedAppName:"org.nativescript.$testsAppName",
deployedAppName:"org.nativescript.TestsApp",
mainActivityName:"com.tns.NativeScriptActivity",
pathToCompiledTests: "bin/dist/apps/tests"
}
@@ -94,13 +94,38 @@ module.exports = {
},
restartAdb: {
cmd: "adb kill-server && adb start-server"
},
uninstallExistingApp: {
cmd: "adb uninstall " + localCfg.deployedAppName
},
installNewApp: {
cmd: "adb install " + localCfg.pathToApk,
cwd: localCfg.applicationDir
},
startApp: {
cmd: "adb shell am start -n " + localCfg.deployedAppName + "/" + localCfg.mainActivityName
},
collectLog: {
cmd: "./expect.exp " + localCfg.outfile,
stdout: false,
strerr: false
}
},
shell: {
collectLog: {
command: "./expect.exp " + localCfg.outfile,
options: {
execOptions: {
maxBuffer: Infinity
}
}
}
}
});
// grunt.loadNpmTasks("grunt-tslint");
// grunt.loadNpmTasks("grunt-multi-dest");
// grunt.loadNpmTasks("grunt-shell");
grunt.loadNpmTasks("grunt-shell");
// grunt.loadNpmTasks("grunt-env");
// grunt.loadNpmTasks("grunt-simple-mocha");
grunt.loadNpmTasks("grunt-exec");
@@ -109,19 +134,24 @@ module.exports = {
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.registerTask("testsapp", [
"clean:workingDir",
"mkdir:workingDir",
"exec:killEmulator",
"exec:startEmulator",
"exec:createApp",
"clean:originalAppDir",
"copy:testsAppToRunDir",
"exec:addAndroidPlatform",
"copy:addAndroidPermissions",
"exec:buildAppAndroid",
"exec:restartAdb",
// "clean:workingDir",
// "mkdir:workingDir",
// "exec:killEmulator",
// "exec:startEmulator",
//
// "exec:createApp",
// "clean:originalAppDir",
// "copy:testsAppToRunDir",
//
// "exec:addAndroidPlatform",
// "copy:addAndroidPermissions",
// "exec:buildAppAndroid",
// "exec:restartAdb",
//
"exec:uninstallExistingApp",
"exec:installNewApp",
"exec:startApp",
"shell:collectLog",
// "exec:killEmulator",

View File

@@ -1,38 +0,0 @@
workingdir=./.testsapprun
startdir=$(pwd)
emuProcId=".*emulator64-x86"
emuAvdName=Api19
androidRuntimePath=/Users/erjan/tns-android.tgz
outfile=./TestRunResult.txt
testsAppName=TestsApp
pathToApk=./platforms/android/build/outputs/apk/$testsAppName-debug.apk
deployedAppName=org.nativescript.$testsAppName
mainActivityName=com.tns.NativeScriptActivity
# Creating the emulator with:
#android create avd -t "android-21" -n Api21 -b "default/x86"
# GET THIS ONE FROM SOME PLACE...
cp /Volumes/distributions/DailyBuilds/NativeScript/android-widgets/Stable/widgets.jar platforms/android/libs/
echo "------------------------------------------------"
echo "Uninstalling the app..."
time adb uninstall $deployedAppName
echo "------------------------------------------------"
echo "Installing the app..."
time adb install $pathToApk
echo "------------------------------------------------"
echo "Starting the app..."
time adb shell am start -n $deployedAppName/$mainActivityName
cd $startdir
echo "------------------------------------------------"
echo "Waiting for the tests to finish executing..."
time ./expect.exp $outfile
rm -rd $workingdir