diff --git a/windmill/js/lib/builder.js b/windmill/js/lib/builder.js index 3c718aa6..ab0a7db0 100644 --- a/windmill/js/lib/builder.js +++ b/windmill/js/lib/builder.js @@ -3,7 +3,7 @@ }; - function methodSelected() { + opener.windmill.builder.methodSelected =function() { var method = $('methodDD').value; //Reset values for when the user changes the actions @@ -74,7 +74,7 @@ //Set the text to reflect whats been selected $('methodName').innerHTML = "How will you be accessing the element you would like to "+method+"."; } - function getActionString(){ + opener.windmill.builder.getActionString = function(){ var paramsString = ""; @@ -103,7 +103,7 @@ } //Create the json string - function addAction() { + opener.windmill.builder.addAction = function() { actionString = getActionString(); $('test').value = $('test').value +actionString+"\n"; @@ -118,9 +118,9 @@ } //Append action to the recorder - function addToRecorder(){ + opener.windmill.builder.addToRecorder = function(){ - action = getActionString(); + action = opener.windmill.builder.getActionString(); $("wmTest").value = $("wmTest").value + action +'}\n'; } diff --git a/windmill/js/lib/ui.js b/windmill/js/lib/ui.js index 5db5c7e5..b8d00171 100644 --- a/windmill/js/lib/ui.js +++ b/windmill/js/lib/ui.js @@ -185,6 +185,9 @@ windmill.ui = new function() { else if ((typeof(e.target.onclick) != "undefined") || (locator == 'link')){ windmill.remote.document.getElementById("wmTest").value = windmill.remote.document.getElementById("wmTest").value + '{"method": "'+e.type+'", "params":{"'+locator+'": "'+locValue+'"}}\n'; } + else if ((typeof(e.target.onclick) != "undefined") || (locator == 'link')){ + windmill.remote.document.getElementById("wmTest").value = windmill.remote.document.getElementById("wmTest").value + '{"method": "'+e.type+'", "params":{"'+locator+'": "'+locValue+'"}}\n'; + } } } windmill.ui.scrollRecorderTextArea(); @@ -271,8 +274,9 @@ windmill.ui = new function() { } //Handle key listeners for windmill remote shortcuts - this.remoteAttach = function(e){ + this.remoteKeyPress = function(e){ var tabNum = parseInt(windmill.remote.tabs.aid.replace('tab','')); + console.log(e); //If they are pressing ctrl and left arrow if ((e.keyCode == 37) && (e.ctrlKey == true)){ @@ -292,6 +296,20 @@ windmill.ui = new function() { var focusTab = 'tab'+ tabNum; windmill.remote.tabs.focus(focusTab); } + + //keyboard shortcut to run your recorded test + if ((e.charCode == 114) && (e.ctrlKey == true)){ + if (windmill.remote.document.getElementById('wmTest').value != ""){ + windmill.ui.sendPlayBack(); + } + } + + //ctrl b, gets the action from the builder and adds it to the recorder + if ((e.charCode == 98) && (e.ctrlKey == true)){ + if (windmill.remote.document.getElementById('methodDD').value != ""){ + windmill.builder.addToRecorder(); + } + } } @@ -332,6 +350,7 @@ windmill.ui = new function() { var params_obj = {}; json_object.params = params_obj; var json_string = fleegix.json.serialize(json_object) + json_string = json_string.replace('\\', ''); fleegix.xhr.doPost(resp, '/windmill-jsonrpc/', json_string); } diff --git a/windmill/js/lib/windmill.js b/windmill/js/lib/windmill.js index bfa52503..2a3d21eb 100644 --- a/windmill/js/lib/windmill.js +++ b/windmill/js/lib/windmill.js @@ -20,7 +20,7 @@ var windmill = new function () { this.init = function (b){ browser = b; } - + this.builder={}; //So that users can generate a user for the current test randomly //Usually you want one username for the test so you can set it once and leave it for the test //a user can write a method to set overWrite to true if they want to replace it each time %random% is used in a json test @@ -40,7 +40,7 @@ var windmill = new function () { windmill.ui.writePerformance("
Starting UI performance session.
User Environment: " + browser.current_ua + ".
"); load_timer.write(); - fleegix.event.listen(windmill.remote.document, 'onkeypress', windmill.ui, 'remoteAttach'); + fleegix.event.listen(windmill.remote.document, 'onkeypress', windmill.ui, 'remoteKeyPress'); fleegix.event.listen(windmill.testingApp.document, 'onkeypress', windmill.ui, 'getRemote'); } diff --git a/windmill/js/remote.html b/windmill/js/remote.html index 159b5fcc..973cce09 100644 --- a/windmill/js/remote.html +++ b/windmill/js/remote.html @@ -15,10 +15,15 @@