Uninstall, install and start the app

This commit is contained in:
Erjan Gavalji
2015-10-28 15:53:40 +02:00
parent 094f9f4870
commit c1b30428d0
2 changed files with 47 additions and 27 deletions

View File

@ -45,7 +45,8 @@ module.exports = {
testsAppName:"TestsApp", testsAppName:"TestsApp",
applicationDir: pathModule.join(".testsapprun", "TestsApp"), applicationDir: pathModule.join(".testsapprun", "TestsApp"),
appDir: pathModule.join(".testsapprun", "TestsApp", "app"), appDir: pathModule.join(".testsapprun", "TestsApp", "app"),
pathToApk:"./platforms/android/build/outputs/apk/TestsApp-debug.apk", pathToApk: "./platforms/android/build/outputs/apk/TestsApp-debug.apk",
pathToApp: "./platforms/ios/build/emulator/TestsApp.app",
deployedAppName:"org.nativescript.TestsApp", deployedAppName:"org.nativescript.TestsApp",
mainActivityName:"com.tns.NativeScriptActivity", mainActivityName:"com.tns.NativeScriptActivity",
pathToCompiledTests: "bin/dist/apps/tests", pathToCompiledTests: "bin/dist/apps/tests",
@ -140,9 +141,9 @@ module.exports = {
cmd: "pkill '" + localCfg.emulatorProcessIdentifier + "'", cmd: "pkill '" + localCfg.emulatorProcessIdentifier + "'",
exitCode: [0, 1] exitCode: [0, 1]
}, },
startAndroidEmulator: { killiOSEmulator: {
cmd: "emulator -avd " + localCfg.emuAvdName + " -no-audio " + (args.showEmu ? "" : "-no-window") + "&", cmd: "pkill Simulator",
stdout: true exitCode: [0, 1]
}, },
createApp: { createApp: {
cmd: localCfg.tnsPath + " create " + localCfg.testsAppName, cmd: localCfg.tnsPath + " create " + localCfg.testsAppName,
@ -166,8 +167,16 @@ module.exports = {
cmd: "adb shell am start -n " + localCfg.deployedAppName + "/" + localCfg.mainActivityName cmd: "adb shell am start -n " + localCfg.deployedAppName + "/" + localCfg.mainActivityName
}, },
uninstallExistingiOSApp: { uninstallExistingiOSApp: {
cmd: "bash -c 'exit 1'" cmd: "xcrun simctl uninstall " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName,
} cwd: localCfg.applicationDir
},
installNewiOSApp: {
cmd: "xcrun simctl install " + localCfg.emuAvdName + " " + localCfg.pathToApp,
cwd: localCfg.applicationDir
},
startiOSApp: {
cmd: "xcrun simctl launch " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName
},
}, },
untar: { untar: {
modules: { modules: {
@ -184,6 +193,15 @@ module.exports = {
} }
} }
}, },
startAndroidEmulator: {
command: "emulator -avd " + localCfg.emuAvdName + " -no-audio " + (args.showEmu ? "" : "-no-window") + "&"
},
startiOSEmulator: {
command: "xcrun instruments -w " + localCfg.emuAvdName,
options: {
failOnError: false
},
},
buildApp: { buildApp: {
command: "tns build " + localCfg.platform.toLowerCase(), command: "tns build " + localCfg.platform.toLowerCase(),
options: { options: {
@ -213,32 +231,34 @@ module.exports = {
grunt.registerTask("doPostPlatformAddiOS", [ grunt.registerTask("doPostPlatformAddiOS", [
]); ]);
//xcrun instruments -s
grunt.registerTask("testsapp", [ grunt.registerTask("testsapp", [
"clean:workingDir", // "clean:workingDir",
"mkdir:workingDir", // "mkdir:workingDir",
// getPlatformSpecificTask("exec:kill{platform}Emulator"), // getPlatformSpecificTask("exec:kill{platform}Emulator"),
// getPlatformSpecificTask("exec:start{platform}Emulator"), // getPlatformSpecificTask("shell:start{platform}Emulator"),
//
"exec:createApp", // "exec:createApp",
"clean:originalAppDir", // "clean:originalAppDir",
"copy:testsAppToRunDir", // "copy:testsAppToRunDir",
"clean:modules", // "clean:modules",
"untar:modules", // "untar:modules",
"copy:modulesToDir", // "copy:modulesToDir",
"clean:tempExtractedModules", // "clean:tempExtractedModules",
//
"exec:addPlatform", // "exec:addPlatform",
getPlatformSpecificTask("copy:add{platform}Permissions"), // getPlatformSpecificTask("copy:add{platform}Permissions"),
"shell:buildApp", // "shell:buildApp",
getPlatformSpecificTask("doPostPlatformAdd{platform}"), // getPlatformSpecificTask("doPostPlatformAdd{platform}"),
getPlatformSpecificTask("exec:uninstallExisting{platform}App"), getPlatformSpecificTask("exec:uninstallExisting{platform}App"),
getPlatformSpecificTask("exec:installNew{platform}App"), getPlatformSpecificTask("exec:installNew{platform}App"),
getPlatformSpecificTask("exec:start{platform}App"), getPlatformSpecificTask("exec:start{platform}App"),
getPlatformSpecificTask("shell:collect{platform}Log"), // getPlatformSpecificTask("shell:collect{platform}Log"),
//
getPlatformSpecificTask("exec:kill{platform}Emulator"), // getPlatformSpecificTask("exec:kill{platform}Emulator"),
"clean:workingDir" // "clean:workingDir"
]); ]);
} }
} }

2
run.sh
View File

@ -2,6 +2,6 @@
#grunt testsapp --verbose --platform=Android --emuPId=".*emulator64-x86" --avd="Api19" --logFilePath="./TestRunResult.txt" --runtimePath="/Users/erjan/tns-android.tgz" --showEmu=true --modulesPath=/Volumes/distributions/DailyBuilds/NativeScript/tns-modules/Stable/tns-core-modules.tgz #grunt testsapp --verbose --platform=Android --emuPId=".*emulator64-x86" --avd="Api19" --logFilePath="./TestRunResult.txt" --runtimePath="/Users/erjan/tns-android.tgz" --showEmu=true --modulesPath=/Volumes/distributions/DailyBuilds/NativeScript/tns-modules/Stable/tns-core-modules.tgz
grunt testsapp --verbose --platform=iOS --logFilePath="./TestRunResult.txt" --runtimePath="/Users/erjan/tns-ios.tgz" --showEmu=true --modulesPath=/Volumes/distributions/DailyBuilds/NativeScript/tns-modules/Stable/tns-core-modules.tgz grunt testsapp --verbose --platform=iOS --logFilePath="./TestRunResult.txt" --runtimePath="/Users/erjan/tns-ios.tgz" --showEmu=true --modulesPath=/Volumes/distributions/DailyBuilds/NativeScript/tns-modules/Stable/tns-core-modules.tgz --avd="2ADF1A49-F09E-4D5F-A099-AD557ABFA91C"