diff --git a/expect.exp b/expect.exp index cd52e3e24..7483184b4 100755 --- a/expect.exp +++ b/expect.exp @@ -2,8 +2,14 @@ #exp_internal 1 -set timeout 600 +#set timeout 600 -spawn grunt -expect "TypeScript compilation complete" +#spawn grunt +#expect "TypeScript compilation complete" +#send \003 + + +set timeout 600 +spawn adb logcat +expect 'Done.' send \003 diff --git a/gruntfile.js b/gruntfile.js index 1c5e3f259..e08999367 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -365,17 +365,21 @@ module.exports = function(grunt) { mochaNode: { cmd: "grunt simplemocha:node" }, + setupTestsApp: { + cmd: "./runtestsapp.sh" + } // setupTestsApp: { ////TODO: TNS PATH MIGHT GET PASSED FROM OUTSIDE! // cmd: [ -// "pkill emulator64-arm && true", -// "emulator -avd Api19 -no-skin -no-audio -no-window &", +// 'pkill ".*emulator64-arm" && true', +// "emulator -avd Api19 -no-skin -no-audio &", +//// "emulator -avd Api19 -no-skin -no-audio -no-window &", // "tns create TestsApp", // "cd TestsApp", // "rm app/*.*", // "cp -r " + pathModule.join(localCfg.outAppsDir, "tests") + "/* ./app/", // "tns platform add android", -// DO THE REPLACEMENTS IN THE Info.plist and AndroidManifest.xml +////TODO: DO THE REPLACEMENTS IN THE Info.plist and AndroidManifest.xml // "tns build android", // // "adb kill-server", @@ -383,8 +387,9 @@ module.exports = function(grunt) { // // "adb install ./platforms/android/build/outputs/apk/TestsApp-debug.apk", // "adb shell am start -n org.nativescript.TestsApp/com.tns.NativeScriptActivity", -// "expect -c ' -// } +//// "expect -c ' + ].join(" && ") + } }, multidest: { copyLicenseFiles: { @@ -579,6 +584,6 @@ module.exports = function(grunt) { ]); grunt.registerTask("testsapp", [ - "exec:..." + "exec:setupTestsApp" ]); }; diff --git a/runtestsapp.sh b/runtestsapp.sh new file mode 100755 index 000000000..1a774fef8 --- /dev/null +++ b/runtestsapp.sh @@ -0,0 +1,65 @@ +workingdir=__TESTSAPP__ +startdir=$(pwd) +rm -rd $workingdir +mkdir $workingdir +cd $workingdir + +#if [ 1 == 2 ] ; then + echo "------------------------------------------------" + echo "Killing the emulator..." + time pkill ".*emulator64-x86" && true + + echo "------------------------------------------------" + echo "Starting the emulator..." + time emulator -avd Api19 -no-skin -no-audio & + #emulator -avd Api19 -no-skin -no-audio -no-window & + + echo "------------------------------------------------" + echo "Creating the app..." + time tns create TestsApp + cd TestsApp + + echo "------------------------------------------------" + echo "Removing the original template files..." + time rm app/*.* + + echo "------------------------------------------------" + echo "Copying the test app files..." + time cp -r ./bin/dist/apps/tests* ./app/ + + echo "------------------------------------------------" + echo "Adding the android platform..." + time tns platform add android + # #DO THE REPLACEMENTS IN THE Info.plist and AndroidManifest.xml + + echo "------------------------------------------------" + echo "Building the application..." + time tns build android + + echo "------------------------------------------------" + echo "Killing the adb server..." + time adb kill-server + + echo "------------------------------------------------" + echo "Starting the adb server..." + time adb start-server + +#fi + +echo "------------------------------------------------" +echo "Uninstalling the app..." +time adb uninstall org.nativescript.TestApp + +echo "------------------------------------------------" +echo "Installing the app..." +time adb install ./platforms/android/build/outputs/apk/TestsApp-debug.apk + +echo "------------------------------------------------" +echo "Starting the app..." +time adb shell am start -n org.nativescript.TestsApp/com.tns.NativeScriptActivity + +cd $startdir + +echo "------------------------------------------------" +echo "Waiting for the tests to finish executing..." +./expect.exp