Skip to content

Commit c23ce64

Browse files
committed
Make the test run as a bash script first
1 parent 7c691a9 commit c23ce64

3 files changed

Lines changed: 85 additions & 9 deletions

File tree

expect.exp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
#exp_internal 1
44

5-
set timeout 600
5+
#set timeout 600
6+
7+
#spawn grunt
8+
#expect "TypeScript compilation complete"
9+
#send \003
610

7-
spawn grunt
8-
expect "TypeScript compilation complete"
11+
12+
set timeout 600
13+
spawn adb logcat
14+
expect 'Done.'
915
send \003

gruntfile.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,26 +365,31 @@ module.exports = function(grunt) {
365365
mochaNode: {
366366
cmd: "grunt simplemocha:node"
367367
},
368+
setupTestsApp: {
369+
cmd: "./runtestsapp.sh"
370+
}
368371
// setupTestsApp: {
369372
////TODO: TNS PATH MIGHT GET PASSED FROM OUTSIDE!
370373
// cmd: [
371-
// "pkill emulator64-arm && true",
372-
// "emulator -avd Api19 -no-skin -no-audio -no-window &",
374+
// 'pkill ".*emulator64-arm" && true',
375+
// "emulator -avd Api19 -no-skin -no-audio &",
376+
//// "emulator -avd Api19 -no-skin -no-audio -no-window &",
373377
// "tns create TestsApp",
374378
// "cd TestsApp",
375379
// "rm app/*.*",
376380
// "cp -r " + pathModule.join(localCfg.outAppsDir, "tests") + "/* ./app/",
377381
// "tns platform add android",
378-
// DO THE REPLACEMENTS IN THE Info.plist and AndroidManifest.xml
382+
////TODO: DO THE REPLACEMENTS IN THE Info.plist and AndroidManifest.xml
379383
// "tns build android",
380384
//
381385
// "adb kill-server",
382386
// "adb start-server",
383387
//
384388
// "adb install ./platforms/android/build/outputs/apk/TestsApp-debug.apk",
385389
// "adb shell am start -n org.nativescript.TestsApp/com.tns.NativeScriptActivity",
386-
// "expect -c '
387-
// }
390+
//// "expect -c '
391+
].join(" && ")
392+
}
388393
},
389394
multidest: {
390395
copyLicenseFiles: {
@@ -579,6 +584,6 @@ module.exports = function(grunt) {
579584
]);
580585

581586
grunt.registerTask("testsapp", [
582-
"exec:..."
587+
"exec:setupTestsApp"
583588
]);
584589
};

runtestsapp.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
workingdir=__TESTSAPP__
2+
startdir=$(pwd)
3+
rm -rd $workingdir
4+
mkdir $workingdir
5+
cd $workingdir
6+
7+
#if [ 1 == 2 ] ; then
8+
echo "------------------------------------------------"
9+
echo "Killing the emulator..."
10+
time pkill ".*emulator64-x86" && true
11+
12+
echo "------------------------------------------------"
13+
echo "Starting the emulator..."
14+
time emulator -avd Api19 -no-skin -no-audio &
15+
#emulator -avd Api19 -no-skin -no-audio -no-window &
16+
17+
echo "------------------------------------------------"
18+
echo "Creating the app..."
19+
time tns create TestsApp
20+
cd TestsApp
21+
22+
echo "------------------------------------------------"
23+
echo "Removing the original template files..."
24+
time rm app/*.*
25+
26+
echo "------------------------------------------------"
27+
echo "Copying the test app files..."
28+
time cp -r ./bin/dist/apps/tests* ./app/
29+
30+
echo "------------------------------------------------"
31+
echo "Adding the android platform..."
32+
time tns platform add android
33+
# #DO THE REPLACEMENTS IN THE Info.plist and AndroidManifest.xml
34+
35+
echo "------------------------------------------------"
36+
echo "Building the application..."
37+
time tns build android
38+
39+
echo "------------------------------------------------"
40+
echo "Killing the adb server..."
41+
time adb kill-server
42+
43+
echo "------------------------------------------------"
44+
echo "Starting the adb server..."
45+
time adb start-server
46+
47+
#fi
48+
49+
echo "------------------------------------------------"
50+
echo "Uninstalling the app..."
51+
time adb uninstall org.nativescript.TestApp
52+
53+
echo "------------------------------------------------"
54+
echo "Installing the app..."
55+
time adb install ./platforms/android/build/outputs/apk/TestsApp-debug.apk
56+
57+
echo "------------------------------------------------"
58+
echo "Starting the app..."
59+
time adb shell am start -n org.nativescript.TestsApp/com.tns.NativeScriptActivity
60+
61+
cd $startdir
62+
63+
echo "------------------------------------------------"
64+
echo "Waiting for the tests to finish executing..."
65+
./expect.exp

0 commit comments

Comments
 (0)