Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
emjeyforta authored Jun 15, 2019
1 parent fbdb78a commit c6bf022
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion app/first.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</button>
<button id="btnadbinfo" class="contact1-form-btn">
<span>
adb path
Get Path
<i class="fa fa-long-arrow-right" aria-hidden="true"></i>
</span>
</button>
Expand Down
26 changes: 10 additions & 16 deletions app/first.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
console.log('first js.js');
//var cmd = require('node-command-line'),Promise = require('bluebird');
var cmd=require('node-cmd');
const { exec } = require('child_process');
const { exec } = require('child_process').exec;

if(localStorage.getItem("megatron")){
if(localStorage.getItem("path")){
window.location="index.html";
}
document.querySelector('#btnfirstSubmit').addEventListener('click', navigate);
document.querySelector('#btnadbinfo').addEventListener('click', determineOS);
function navigate(){
if(document.getElementById('android_sdk_path').value!=''){
localStorage.setItem('megatron',document.getElementById('android_sdk_path').value)
localStorage.setItem('path',document.getElementById('android_sdk_path').value)
window.location='index.html';
}else{
alert("You cant proceed without entering this")
}
}
function displayadbinfo(command) {
exec(command, (error, stdout, stderr) => {
if (error) {
console.log(`exec error: ${error}`);
alert(error);
}else{
console.log(`stdout: "The adb path is" ${stdout}`);
alert(stdout)
}
});

}
function determineOS() {
const {app} = require('electron');
if (process.platform === "win32") {
alert("We detected you are using windows. Please type 'adb' in your command prompt and copy the value from 'Installed at'")
}
else {
displayadbinfo("which adb")
alert("we are still working on fetching this, please add your ANDROID_HOME path or WHICH ADB path with upto adb")

}
}
}
function deletelocalstorage() {
window.localStorage.clear();
}
10 changes: 8 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="contact1-form validate-form">
<span class="contact1-form-title">
Stress test your android app
</span>
</span>

<div class="wrap-input1 validate-input" data-validate = "Name is required">
<input id="package" class="input1" type="text" name="name" placeholder="Enter package name of application">
Expand Down Expand Up @@ -86,7 +86,13 @@
<span>
Run test
<i class="fa fa-long-arrow-right" ></i>
</span>
</span>
<div class="container-contact1-form-btn">
<button id="btnreset" class="contact1-form-btn">
<span>
Reset adb
<i class="fa fa-long-arrow-right" ></i>
</span>
</button>
</div>
</div>
Expand Down
12 changes: 9 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var cmd=require('node-cmd');
const { exec } = require('child_process');
document.querySelector('#btnEd').addEventListener('click', runSingleCommandWithoutWait);
document.querySelector('#btnSubmit').addEventListener('click', runTestfunction);
document.querySelector("#btnreset").addEventListener('click', clearlocalstorage);
function selectFunction(data){
var devices=data.trim().split('\n');
document.getElementById('selectId').innerHTML='';
Expand All @@ -14,7 +15,7 @@ function selectFunction(data){
}

function runSingleCommandWithoutWait() {
var androidSdkPath = localStorage.getItem('megatron');
var androidSdkPath = localStorage.getItem('path');
if(androidSdkPath == '') {
alert("Android sdk path is required");
return;
Expand All @@ -33,7 +34,7 @@ function runSingleCommandWithoutWait() {
});
}catch(e){
alert(e);
localStorage.removeItem('megatron');
localStorage.removeItem('path');
window.location="first.html";
}
}
Expand All @@ -43,7 +44,7 @@ function runSingleCommandWithoutWait() {
let NoofInterrupts=document.getElementById("interrupts").value;
var SelectedValue=document.getElementById("selectId").value.trim().split(/(\s+)/);
if(Packagename!='' && NoofInterrupts!='' && SelectedValue!=''){
exec(localStorage.getItem('megatron')+' -s '+SelectedValue[0]+' shell monkey -p '+Packagename+' --ignore-crashes --ignore-timeouts --monitor-native-crashes -v '+NoofInterrupts+'', (error, stdout, stderr) => {
exec(localStorage.getItem('path')+' -s '+SelectedValue[0]+' shell monkey -p '+Packagename+' --ignore-crashes --ignore-timeouts --monitor-native-crashes -v '+NoofInterrupts+'', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
alert(error);
Expand All @@ -57,3 +58,8 @@ function runSingleCommandWithoutWait() {
}
}

function clearlocalstorage() {
window.localStorage.clear();
alert("Path reset. Please quit the app and relaunch")
}

3 changes: 3 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ function createWindow(){
slashes:true
}));


win.on('closed',()=>{
win=null;
});
}
app.on('ready',createWindow);


app.on('window-all-closed',()=>{
if(process.platform!=='darwin'){
app.quit();
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"build": {
"appId": "com.electronAI.product",
"productName": "Stress test"
"productName": "StressTest"
},
"author": "Mrityunjeyan Sarvabhouman",
"license": "ISC",
Expand All @@ -21,9 +21,12 @@
"electron-installer-dmg": "^2.0.0"
},
"dependencies": {
"fix-path": "^2.1.0",
"fs-jetpack": "^1.3.0",
"node-adb": "^0.1.6",
"node-cmd": "^3.0.0",
"node-command-line": "^1.0.2"
"node-command-line": "^1.0.2",
"shell-path": "^2.1.0",
"user-home": "^2.0.0"
}
}

0 comments on commit c6bf022

Please sign in to comment.