Closed
Bug 494071
Opened 15 years ago
Closed 15 years ago
Using keypress without modifiers doesn't insert characters into text fields
Categories
(Testing Graveyard :: Mozmill, defect)
Testing Graveyard
Mozmill
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: whimboo, Assigned: whimboo)
References
Details
(Keywords: regression, Whiteboard: [mozmill-doc-complete][verified-mozmill-1.2])
Attachments
(3 files, 3 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
application/x-javascript
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
This bug is a regression from the work on bug 483172. As the summary says it is not possible to enter characters into text fields e.g. the locationbar.
As an example see attachment 377542 [details].
Comment 1•15 years ago
|
||
So it turns out that to do the kinds of things whimboo wants to do we are going to have to change the key event API.
We can translate from a string to a charCode, but there is currently no way to allow for a keyCode of a charCode of null or 0, whkch is required for something like backspace (8) and our logic currently will just guess that you meant you wanted the charCode for 8 and turn it into 56.
I want to see what other people think, but I think a better syntax for all this would be:
controller.keypress(urlbar, null, 8, modifiers);
In this example the empty string is either a string character or char code, and 8 is the keyCode. Since all the modifiers are false, this would just be an empty object.
Another example:
controller.keypress(urlbar, '1', null, {});
This way you have the control to specify what you want, and the modifier syntax is cleaner instead of a bunch of ugly booleans.
controller.keypress(urlbar, '1', null, {altKey:true, metaKey:true});
Everyone think this is reasonable?
Assignee | ||
Comment 2•15 years ago
|
||
That looks great. It's a similar way like it is used in mochitests. Having an array with the modifiers is much cleaner as having to add them as different parameters.
I would like to see this way. Any concerns? What about the Thunderbird guys? CC'ing Mark and Gary.
Comment 3•15 years ago
|
||
All my tests have worked correctly with the new api, Committed revision 465.
I also tried this test with the modified API and it works as expected:
var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);
var setupModule = function(module) {
controller = mozmill.getBrowserController();
}
var testRecorded = function () {
var urlbar = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("navigator-toolbox")/id("nav-bar")/id("urlbar-container")/id("urlbar")/anon({"class":"autocomplete-textbox-container"})/anon({"anonid":"textbox-input-box"})/anon({"anonid":"input"})');
// enter a search term into the urlbar
controller.type(urlbar, "term");
controller.sleep(1000);
// explicitely click the urlbar
controller.click(urlbar);
// Enter a letter and remove it with backspace
controller.keypress(urlbar, 49, null, {});
controller.sleep(1000);
controller.keypress(urlbar, null, 8, {});
controller.sleep(1000);
// press return
controller.keypress(urlbar, null, 13, {});
}
Assignee | ||
Comment 4•15 years ago
|
||
Adam, I'm not fully happy with this solution. Why we cannot do it the way as I have it rawly implemented inside the patch? We do not have to differentiate between special virtual keys or normal characters. That is handled inside the synthesizeKey function (which also has to be patched due to the missing window scope). Further we do not have to differentiate between window or an element as target. We just fire the same code. Probably we would need a focus check which is not implemented right now. I'll attach an example which I really love!
Assignee | ||
Updated•15 years ago
|
Attachment #379877 -
Attachment is patch: true
Attachment #379877 -
Attachment mime type: application/octet-stream → text/plain
Attachment #379877 -
Flags: review?(adam.christian)
Assignee | ||
Comment 5•15 years ago
|
||
This will work with the latest proposal.
Assignee | ||
Comment 6•15 years ago
|
||
Now with the saved content.
Attachment #379878 -
Attachment is obsolete: true
Comment 7•15 years ago
|
||
Committed revision 469.
Assignee | ||
Updated•15 years ago
|
Attachment #379877 -
Attachment description: example patch for better keypress handling → example patch for better keypress handling (checked-in)
Attachment #379877 -
Flags: review?(adam.christian)
Assignee | ||
Comment 8•15 years ago
|
||
This is a follow-up patch to fix the type and open functions which will break right now due to the changes.
Assignee | ||
Comment 9•15 years ago
|
||
Attachment #379879 -
Attachment is obsolete: true
Assignee | ||
Comment 10•15 years ago
|
||
Attachment #379976 -
Attachment is obsolete: true
Assignee | ||
Comment 11•15 years ago
|
||
Adam, you have already checked in those changes right? Further we need an updated Mozmill documentation for keypress. Adding whiteboard entry.
Whiteboard: [mozmill-doc-needed]
Comment 12•15 years ago
|
||
yes the patch is checked in.
Assignee | ||
Comment 13•15 years ago
|
||
Ok, the follow-up is http://code.google.com/p/mozmill/source/detail?r=470
Marking fixed. I'll verify with all the updated tests shortly.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [mozmill-doc-needed] → [mozmill-doc-needed][mozmill-1.2]
Assignee | ||
Updated•15 years ago
|
Attachment #379981 -
Attachment description: Follow-up patch against extension folder → Follow-up patch against extension folder (checked-in)
Assignee | ||
Updated•15 years ago
|
Assignee: nobody → hskupin
Assignee | ||
Comment 14•15 years ago
|
||
I have updated existing Mozmill tests for Firefox. Everything looks fine. With the new API we also detect if elements are not visible! Yay!
Status: RESOLVED → VERIFIED
Whiteboard: [mozmill-doc-needed][mozmill-1.2] → [mozmill-doc-needed][verified-mozmill-1.2]
Comment 15•15 years ago
|
||
So is bug 490548 still valid?
Assignee | ||
Comment 16•15 years ago
|
||
Yes, it is for mouse events. We should probably check to use those EventUtils functions too which simulates mouse events. I'll run a test the next days to check that.
Assignee | ||
Comment 17•14 years ago
|
||
Docs are already uptodate.
Whiteboard: [mozmill-doc-needed][verified-mozmill-1.2] → [mozmill-doc-complete][verified-mozmill-1.2]
Updated•8 years ago
|
Product: Testing → Testing Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•