Closed Bug 497852 Opened 15 years ago Closed 15 years ago

controller.click has to be replaced by synthesizeMouse in EventUtils.js

Categories

(Testing Graveyard :: Mozmill, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: whimboo, Assigned: adam.christian)

References

Details

(Whiteboard: [mozmill-doc-needed][verified-mozmill-1.2])

Attachments

(1 file)

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1pre) Gecko/20090611 Shiretoko/3.5pre ID:20090611030802

Today I did some testing with focusing the search bar and noticed that our current click code is working poorly. We should really replace it with the synthesizeMouse function which is implemented inside EventUtils.js.

Just to give an example: What do you expect to see by running this code?

searchBar = new elementslib.ID(controller.window.document, 'searchbar');
controller.click(searchBar);

First I thought that I'll set the focus inside the textbox. But that's wrong. These two statements do nothing. No focus is set into the search bar. So I took some minutes to check how we can implement the supported functions from the EventUtils.js. And the following solution works perfectly:

EventUtils.synthesizeMouse(searchBar.getNode(), 10, 10, {}, controller.window);

Running this code in a Mozmill test the search bar gets clicked at the position 10/10 (relative inside the widget). As result the search bar dropdown menu gets opened. You can change it to:

EventUtils.synthesizeMouse(searchBar.getNode(), 50, 10, {}, controller.window);

This way we click directly inside the textbox and are able to enter some text which we weren't able before.

Having this changes in place will also fix the following bug 487584 and probably others. Further bug 482359 can take advantage of it.

Do we have the resources to get this into Mozmill 1.2? That would help us a lot.
Setting as P2 since we have a way which works but could be improved to make tests more reliable.
Severity: blocker → critical
Priority: -- → P2
Summary: controller.click works poorly and has to be replaced by synthesizeMouse in EventUtils.js → controller.click has to be replaced by synthesizeMouse in EventUtils.js
Blocks: 493226
This test shows the difference between the current way we are firing click events and the way how it should be done.
Whiteboard: [mozmill-1.2?]
I don't know how much work it is but click is one of our most used API functions. If it will not make into 1.2 we have to call the function from EventUtils ourself like the way I have demonstrated it in the attached test. Or shall we create utilsAPI functions for left, middle, and right click in-between.

Clint, what do you think? Marking it with mozmill-1.2?
When we moved from just firing events on elements to using EventUtils we introduce a whole new swarm of focus related bugs.

I'm working on an attempt at fixing those issues for the work we've already one in type and keypress. If it works, I'm confident we can take this without worrying about a huge amount of regressions, but if it doesn't work we may end up backing out some of the changes we already made in type and keypress and certainly won't be taking this.
Look like we cannot get this into 1.2. As a workaround we should put the EventUtils usage into a shared module.
We don't have the time to tear all this down in 1.2, according to Henrik we have a workaround we can use for the few cases that are currently failing and we can, instead, take this work in the next release.
Whiteboard: [mozmill-1.2?] → [mozmill-1.3]
Blocks: 482359
Committed revision 515.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Verified fixed by code checkin:
http://code.google.com/p/mozmill/source/detail?r=515

Adam, I forgot to mention the doubleClick function. Will we convert this function too?
Assignee: nobody → adam.christian
Status: RESOLVED → VERIFIED
Whiteboard: [mozmill-1.3] → [mozmill-doc-needed][verified-mozmill-1.2]
Depends on: 502330
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: