Closed Bug 1432864 Opened 5 years ago Closed 5 years ago

Marionette interaction commands uses incorrect focussing and unfocussing steps

Categories

(Testing :: Marionette, enhancement)

Version 3
enhancement
Not set
normal

Tracking

(firefox59 fixed, firefox60 fixed)

RESOLVED FIXED
mozilla60
Tracking Status
firefox59 --- fixed
firefox60 --- fixed

People

(Reporter: ato, Assigned: ato)

References

(Blocks 1 open bug)

Details

Attachments

(8 files)

Marionette fires custom events from event.focus and event.blur,
but doesn’t actually focus or unfocus the element.  We can rely
on HTMLElement.focus() and HTMLElement.blur() for these operations,
which will do the right thing and fire the correct DOM events.

A sidenote is that the unfocussing steps especially are difficult
to get right without HTMLElement.blur() as there are certain ranges
of elements where HTMLElement.focus() will not work for.  Also,
Gecko does not support its .focus({preventScroll: true}) option.
Assignee: nobody → ato
Blocks: webdriver
Comment on attachment 8945190 [details]
Bug 1432864 - Unfocussing steps will target <body> element.

https://reviewboard.mozilla.org/r/215426/#review221062

::: commit-message-6c860:1
(Diff revision 1)
> +Bug 1432864 - Unfocussing steps will target the <bdoy> element. r?automatedtester

body?
Attachment #8945190 - Flags: review?(dburns) → review+
Comment on attachment 8945164 [details]
Bug 1432864 - Decouple focussing from moving caret in textual form controls.

https://reviewboard.mozilla.org/r/215404/#review221078
Attachment #8945164 - Flags: review?(dburns) → review+
Comment on attachment 8945165 [details]
Bug 1432864 - Run native focussing steps on interaction commands.

https://reviewboard.mozilla.org/r/215406/#review221080
Attachment #8945165 - Flags: review?(dburns) → review+
Comment on attachment 8945166 [details]
Bug 1432864 - Run unfocussing steps after interaction.

https://reviewboard.mozilla.org/r/215408/#review221082
Attachment #8945166 - Flags: review?(dburns) → review+
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s 91bf7dacb5a358e62b9f0e2d2a9e835de5bee32a -d 9218e87c25fb: rebasing 443945:91bf7dacb5a3 "Bug 1432864 - Decouple focussing from moving caret in textual form controls. r=automatedtester"
merging testing/marionette/interaction.js
rebasing 443946:58366e1c36c0 "Bug 1432864 - Run native focussing steps on interaction commands. r=automatedtester"
merging testing/marionette/interaction.js
merging testing/web-platform/tests/webdriver/tests/interaction/element_clear.py
warning: conflicts while merging testing/marionette/interaction.js! (edit, then use 'hg resolve --mark')
warning: conflicts while merging testing/web-platform/tests/webdriver/tests/interaction/element_clear.py! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s b3c36dffa03c93e14cba7c108f090cfd4c6a5641 -d 9218e87c25fb: rebasing 443949:b3c36dffa03c "Bug 1432864 - Decouple focussing from moving caret in textual form controls. r=automatedtester"
merging testing/marionette/interaction.js
rebasing 443950:94eb6d3a5b33 "Bug 1432864 - Run native focussing steps on interaction commands. r=automatedtester"
merging testing/marionette/interaction.js
merging testing/web-platform/tests/webdriver/tests/interaction/element_clear.py
warning: conflicts while merging testing/marionette/interaction.js! (edit, then use 'hg resolve --mark')
warning: conflicts while merging testing/web-platform/tests/webdriver/tests/interaction/element_clear.py! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by atolfsen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8f2ff0bdb474
Decouple focussing from moving caret in textual form controls. r=automatedtester
https://hg.mozilla.org/integration/autoland/rev/00bab9cabf56
Run native focussing steps on interaction commands. r=automatedtester
https://hg.mozilla.org/integration/autoland/rev/ea20d86a27d4
Run unfocussing steps after interaction. r=automatedtester
https://hg.mozilla.org/integration/autoland/rev/d43aafb30632
Unfocussing steps will target <body> element. r=automatedtester
Blocks: 1433422
No longer depends on: 1433422
Blocks: 1433463
No longer depends on: 1433463
Instead of generating custom focus events when interacting with elements,
we can run the HTMLElement.focus() function will do the correct thing.

Before this patch we only simulated focus events, whereas this
patch will actually focus the element.

MozReview-Commit-ID: IoBV2ngqOA5
A couple of commands were not running the appropriate unfocussing
steps as the WebDriver standards says they should.

MozReview-Commit-ID: FyuRvkct19m
The WebDriver Element Send Keys command is meant to run the HTML
unfocussing steps after clearing the element.  When HTMLElement.blur()
is called on the root document element (<html>) it is the <body>
that is in focus when the unfocussing steps have run.

The same applies in the case of typing into an <iframe> element.
The controlling element of the <iframe> is the <body>, as this is
the element ath will receive focus should you blur the frame.

MozReview-Commit-ID: 19Ox3W9CF8O
Renames the interaction.focusElement, which also happened to move
the caret in textual form controls, to interaction.moveCaretToEnd,
focussed solely on moving the caret.  It doesn't make sense to
coalesce these two operations into one function.

MozReview-Commit-ID: 2QxV8FllW8J
No longer blocks: 1433463
Depends on: 1433463
You need to log in before you can comment on or make changes to this bug.