Skip to content

Instantly share code, notes, and snippets.

@Jorger
Created January 2, 2018 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jorger/c5a144613d110c91a220ea71d4616ab5 to your computer and use it in GitHub Desktop.
Save Jorger/c5a144613d110c91a220ea71d4616ab5 to your computer and use it in GitHub Desktop.
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