diff --git a/build/run-testsapp.grunt.js b/build/run-testsapp.grunt.js index e03d639a2..b90f643b7 100644 --- a/build/run-testsapp.grunt.js +++ b/build/run-testsapp.grunt.js @@ -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", diff --git a/runtestsapp.sh b/runtestsapp.sh deleted file mode 100755 index a26ba15d8..000000000 --- a/runtestsapp.sh +++ /dev/null @@ -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