Hi,
I am trying few things with doh.robot. And have few problems. I must say that the first time I heard about dojo was two days ago, when I buped into doh.robot during a websearch.
My dojo version is the latest svn checkout.
I have tried the following code that is based on the example dojo provides:
...
doh.register("doh.robot",
{
name:"dojorobot1",
timeout:6900,
setUp:function(){
},
runTest:function(){
var d=new doh.Deferred();
var targetX = getX(document.getElementById('targetlink'));
var targetY = getY(document.getElementById('targetlink'));
doh.robot.mouseMove(targetX, targetY, 0, 500);
doh.robot.mouseMove(0, 0, 5000, 1000);
doh.robot.mouseMove(targetX, targetY, 0, 500);
var leaveX = getX(document.getElementById('leave'));
var leaveY = getY(document.getElementById('leave'));
doh.robot.mouseMove(leaveX, leaveY, 5000, 500);
doh.robot.mouseClick({left:true}, 100)
doh.robot.sequence(function(){
d.callback(true);
}, 10000);
return d;
}
});
doh.run();
The aim of the code is to automate the following sequense:
- Hover mouse over a link for 5 seconds
- Move out of the link
- Hover agin for 5 seconds
- Redirect to another page
First of all a question: what does doh.robot.sequence mean and what is it's delay param represents?
The problems are
1. Sometimes robot test refuse working, the cursor just stucks on the corner of the screen and does nothing. Opening a new instance of IE or FF (and re-accepting the applet) solves the issue.
2. I get the following js error running the test: "already called!". If I play with the delay and duration parameters I it sometimes goes. My guess is that a mouse action is being called before the previous finished, but I can't find documentation explaining how it should be used correctly.
3. Can someone show me an example of how to use dijit.robot (a full example, including the files I need to include). I prefer some kind of working "hello world" page.
More questions coming soon.
Thank you for your patience.

The biggest problem with
The biggest problem with this test is that the timeout parameter is too short. DOH says "already called!" because the test timed out, but then your callback fires after the test officially finished.
The math:
- doh.robot.mouseMove(targetX, targetY, 0, 500) takes 500ms to move the mouse
- doh.robot.mouseMove(0, 0, 5000, 1000) then waits 5000 ms after that then takes 1000ms to move the mouse
- ditto on next mouseMove
- doh.robot.mouseMove(leaveX, leaveY, 5000, 500) then waits 5000 ms after that then takes 500ms to move the mouse
- doh.robot.mouseClick({left:true}, 100) then waits 100ms after that to click the mouse
- doh.robot.sequence(function(){d.callback(true);{, 10000); then waits 10000ms after that to end the test
Total time: 22600. I would go with 30000 just because it is a nice round number. The robot terminates after all tests are finished or have timed out. Hence why your test acts up.
dijit.robot features are easy to add into your tests. After you dojo.require('dijit.robot'), just replace your mouseMove with mouseMoveAt, e.g:
doh.robot.mouseMove(targetX, targetY, 0, 500);
becomes:
doh.robot.mouseMoveAt('targetlink',0,500)
It will compute the targetX/Y for you! That is all there is to using dijit.robot.
It sounds like you are using the robot to navigate across pages. dijit.robotx enables you to keep the doh.robot running in the background and separate your test scripts from your pages. I will have to write an article on this . . .