mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Make the test run as a bash script first
This commit is contained in:
12
expect.exp
12
expect.exp
@@ -2,8 +2,14 @@
|
|||||||
|
|
||||||
#exp_internal 1
|
#exp_internal 1
|
||||||
|
|
||||||
set timeout 600
|
#set timeout 600
|
||||||
|
|
||||||
spawn grunt
|
#spawn grunt
|
||||||
expect "TypeScript compilation complete"
|
#expect "TypeScript compilation complete"
|
||||||
|
#send \003
|
||||||
|
|
||||||
|
|
||||||
|
set timeout 600
|
||||||
|
spawn adb logcat
|
||||||
|
expect 'Done.'
|
||||||
send \003
|
send \003
|
||||||
|
|||||||
17
gruntfile.js
17
gruntfile.js
@@ -365,17 +365,21 @@ module.exports = function(grunt) {
|
|||||||
mochaNode: {
|
mochaNode: {
|
||||||
cmd: "grunt simplemocha:node"
|
cmd: "grunt simplemocha:node"
|
||||||
},
|
},
|
||||||
|
setupTestsApp: {
|
||||||
|
cmd: "./runtestsapp.sh"
|
||||||
|
}
|
||||||
// setupTestsApp: {
|
// setupTestsApp: {
|
||||||
////TODO: TNS PATH MIGHT GET PASSED FROM OUTSIDE!
|
////TODO: TNS PATH MIGHT GET PASSED FROM OUTSIDE!
|
||||||
// cmd: [
|
// cmd: [
|
||||||
// "pkill emulator64-arm && true",
|
// 'pkill ".*emulator64-arm" && true',
|
||||||
// "emulator -avd Api19 -no-skin -no-audio -no-window &",
|
// "emulator -avd Api19 -no-skin -no-audio &",
|
||||||
|
//// "emulator -avd Api19 -no-skin -no-audio -no-window &",
|
||||||
// "tns create TestsApp",
|
// "tns create TestsApp",
|
||||||
// "cd TestsApp",
|
// "cd TestsApp",
|
||||||
// "rm app/*.*",
|
// "rm app/*.*",
|
||||||
// "cp -r " + pathModule.join(localCfg.outAppsDir, "tests") + "/* ./app/",
|
// "cp -r " + pathModule.join(localCfg.outAppsDir, "tests") + "/* ./app/",
|
||||||
// "tns platform add android",
|
// "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",
|
// "tns build android",
|
||||||
//
|
//
|
||||||
// "adb kill-server",
|
// "adb kill-server",
|
||||||
@@ -383,8 +387,9 @@ module.exports = function(grunt) {
|
|||||||
//
|
//
|
||||||
// "adb install ./platforms/android/build/outputs/apk/TestsApp-debug.apk",
|
// "adb install ./platforms/android/build/outputs/apk/TestsApp-debug.apk",
|
||||||
// "adb shell am start -n org.nativescript.TestsApp/com.tns.NativeScriptActivity",
|
// "adb shell am start -n org.nativescript.TestsApp/com.tns.NativeScriptActivity",
|
||||||
// "expect -c '
|
//// "expect -c '
|
||||||
// }
|
].join(" && ")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
multidest: {
|
multidest: {
|
||||||
copyLicenseFiles: {
|
copyLicenseFiles: {
|
||||||
@@ -579,6 +584,6 @@ module.exports = function(grunt) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.registerTask("testsapp", [
|
grunt.registerTask("testsapp", [
|
||||||
"exec:..."
|
"exec:setupTestsApp"
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|||||||
65
runtestsapp.sh
Executable file
65
runtestsapp.sh
Executable file
@@ -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
|
||||||
Reference in New Issue
Block a user