Trying to get started with windmill, could use some feedback

11 views
Skip to first unread message

Aaron

unread,
Aug 7, 2010, 10:48:11 PM8/7/10
to Windmill Developers
Hi all,

My name is Aaron Newton. I'm a principal developer of the MooTools
Framework and we're looking at windmill for automated testing of our
UI widgets and whatnot.

I've spent the last two days hacking at a single drag and drop test
and I have a feeling I'm doing things the hard way. I've written this
test probably, oh, 30 different ways and I've finally got a test that
passes and seems marginally sane, but the effort that went into
getting this far - for one test - was not encouraging.

What I could use is a little code review of my test to point out where
I'm doing things the hard way (I have a feeling that's the case).

I tried writing this test with mousedown + mousemove + mouseup
behavior, but couldn't get it to work and with dragDropElem, but the
behavior was somewhat bizarre and unpredictable. I finally got a
predictable test with dragDropAbs, but I'm doing all sorts of DOM
measurement to get the result that I want.

Here's my test: http://paste.mootools.net/f2ccc6135

Note that this test runs against http://review.mootools.net:9876 so
you can run it yourself.

Any help or feedback is greatly appreciated.

Josip Lisec

unread,
Aug 8, 2010, 8:14:39 AM8/8/10
to windmi...@googlegroups.com
Hi Aaron,

have you used 'scriptappend' command flag[1] to starting windmill?
It's necessary for MooTools as they agument native objects. (note:
you'll have to build windmill from source, the easy_install version
doesn't contain the fix necessary for this)

I'm using Windmill for testing an MooTools-powered app, and it works just fine.

[1] http://wiki.github.com/windmill/windmill/javascript-tests, bottom
of the page

> --
> You received this message because you are subscribed to the Google Groups
> "Windmill Developers" group.
> To post to this group, send email to windmi...@googlegroups.com.
> To unsubscribe from this group, send email to
> windmill-dev...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/windmill-dev?hl=en.
>
>

--
Sent from my mobile device

Josip Lisec

Aaron

unread,
Aug 8, 2010, 3:07:11 PM8/8/10
to Windmill Developers
That's a good suggestion, but the way I read it was that you only need
to do this if your *tests* expect native objects to be altered. My
example test that I posted here only uses MooTools specific functions
on element, which I run through $, and that aspect seems to work fine.
I take your point though - sooner or later I'll have more complex
tests.

Do you have any suggestions about the one I posted though? I feel like
this is too much effort to simulate a rather simple drag and drop
test. It seems to me my test should be something simple like:

mousedown $("box");
mousemove over 100px down 100px
mouseup

and then assert that the box moved 100px. Instead I have all this
other stuff in there to get it working and it took a LOT of trial and
error. If this is as good as it gets - that this much tinkering is
required to write a test - then I don't see how I can expect the other
MooTools developers to adopt it. This is what makes me think that I'm
doing something the hard way...

-aaron

On Aug 8, 5:14 am, Josip Lisec <josipli...@gmail.com> wrote:
> Hi Aaron,
>
> have you used 'scriptappend' command flag[1] to starting windmill?
> It's necessary for MooTools as they agument native objects. (note:
> you'll have to build windmill from source, the easy_install version
> doesn't contain the fix necessary for this)
>
> I'm using Windmill for testing an MooTools-powered app, and it works just fine.
>
> [1]http://wiki.github.com/windmill/windmill/javascript-tests, bottom
> of the page
>

Adam Christian

unread,
Aug 8, 2010, 4:57:47 PM8/8/10
to windmi...@googlegroups.com
Hi Aaron,

I tested with dragDropElemToElem which worked fine, but to drag something relative to itself this should be easy using dragDropElem and I am able to repro your erratic behavior which I believe is due to the automatic scrolling.

I have another bug for this same situation with mootools so I will do some poking around and hopefully get a patch committed to trunk tonight.

Sorry about all that wasted time, this needs to work OOTB :)

Adam

Aaron Newton

unread,
Aug 8, 2010, 5:39:23 PM8/8/10
to windmi...@googlegroups.com
I installed w/ easy install per the instructions on the wiki. Can you give me some quick install steps to get running off the version you mentioned earlier?

I've been fooling around with this more, here's the ideal test:

new function(){
// load the test
this.test_open = {
method: "open",
params: {
}
};
this.test_drag = [
{
method: 'mouseDown',
params: {
id: 'box'
}
},
{
method: 'mouseMove',
params: {
coords: '(0,0),(100,100)'
}
},
{
method: 'mouseUp'
},
function(){
var end = $('box').getPosition();
jum.assertEquals(100, end.x);
jum.assertEquals(100, end.y);
}
]
};

Note that this doesn't come close to working. For starters, the actual position that the box ends up is way out of place. Secondly, the mouseUp doesn't seem to fire right, as the MooTools drag behavior is still engaged (if you move the mouse around yourself after the test finishes, the box follows it; MooTools adds a document level event for mouseUp and this doesn't seem be firing).

I'm on IM (anutron on gtalk) if you're around and would be willing to help me troubleshoot. I'm also happy to get involved and help fix bugs as I find them via github.

Adam Christian

unread,
Aug 9, 2010, 2:33:03 AM8/9/10
to windmi...@googlegroups.com
Hi Aaron,

I have done some investigating today on our drag drop stuff and found a couple issues.

The first thing is that the auto scrolling stuff was causing some problems with the x,y calculations, so I turned that off for the drag and drop methods (it was also just kind of annoying with those).

I also found that dragrDropElem works correctly, except that it's movements are a pixel short in the Y direction. I have been staring at the code and since ive had a long weekend and am pretty tired I can't seem to spot the bug but it will be in:

windmill/html/js/controller/controller.js line 326.

My guess is that it's somewhere in the looping logic around line 442. 

Fixing this should make this method do exactly what it's supposed to, but sadly I am going on vacation tomorrow on a boat far from a computer until the following monday.

In the meantime I have added a new method called dragDropElemToAbs, which is pretty straight forward and moves a draggable dom element to an absolute coordinate. I have tested it with your draggable objects on the mootools test page you gave me and according to firebug the coords are consistently correct.

I exported it to JS test format and it looks like this:

// Generated by the windmill services transformer
var test_recordingSuite0 = new function() {
    this.test_actions = [
       {"method": "dragDropElemToAbs","params": {"coords": "100,100", "id": "box"}}
    ];
}
That simply moves the little box to x(left):100, y(top):100.

You can also look at that dragDrop controller code to figure out what you should be firing in order to get the mouseup to work correctly, we have a bunch of code in the triggerMouseEvent method to work around browser weirdness with firing mouse events.

If you want to fork windmill and are able to find/fix that bug, mde can check it out and get it checked in for you. Hopefully this is some help, when I get back i'd like to do whatever I can to help build a test suite for mootools dragdrop stuff to prevent future regressions.

Adam

Aaron Newton

unread,
Aug 9, 2010, 11:20:41 AM8/9/10
to windmi...@googlegroups.com
Thanks for all this Adam. Bummer you're headed out of town, well, for me at least. Have a good trip. I'll update this thread with any progress I make and you can catch up when you're back.

Thanks again,
Aaron

Adam Christian

unread,
Aug 16, 2010, 5:10:40 PM8/16/10
to windmi...@googlegroups.com
Hi Aaron,

I am back in town and trying to remember where we left off with this -- have you done any more with this?

Adam

Aaron Newton

unread,
Aug 16, 2010, 7:31:12 PM8/16/10
to windmi...@googlegroups.com
Yeah, I haven't pushed it anywhere. I'll try and do so this week.
Reply all
Reply to author
Forward
0 new messages