Created
January 2, 2018 21:30
-
-
Save Jorger/c5a144613d110c91a220ea71d4616ab5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createSHFile = (test) => { | |
return new Promise((resolve, reject) => { | |
const fileSH = `${APK_DIRECTORY}/${test.idapk}/${test.token_apk}.sh`; | |
//Se debe renombrar el archivo... | |
try { | |
const stream = fs.createWriteStream(fileSH); | |
stream.once('open', (fd) => { | |
stream.write("#!/bin/sh\n"); | |
stream.write(`cd ${APK_DIRECTORY}/${test.idapk}\n`); | |
//Renombrar el archivo de features que existe... | |
stream.write(`mv ${test.file_features} my_first.feature\n`); | |
//Genera el proyecto de Calabash... | |
stream.write("echo | calabash-android gen\n"); | |
//Mover y reemplazar el features por defecto con el features que se ha subido... | |
stream.write(`cp ${APK_DIRECTORY}/${test.idapk}/my_first.feature ${APK_DIRECTORY}/${test.idapk}/features\n`); | |
//Ejecutar la prueba de Calabash... | |
stream.write(`calabash-android resign ${test.file_apk}\n`); | |
stream.write(`calabash-android run ${test.file_apk} ADB_DEVICE_ARG=${test.device.id_device}\n`); | |
stream.end(); | |
resolve( | |
true | |
); | |
}); | |
} catch(e) { | |
resolve( | |
false | |
); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment