Bug 1276533: Update test actor to scroll element into view before simulating mouse click;r=ochameau
authorSteve Melia <steve.j.melia@gmail.com>
Tue, 31 May 2016 22:03:58 +0100
changeset 340906 cb0b25c9093f75bfb94d99c9c1dc8b61253832dc
parent 340905 2df619ad3af0c76587563962023c7e2f659bdc77
child 340907 359674b9970a98e42c97184e9d7c59c89bac06d7
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1276533
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1276533: Update test actor to scroll element into view before simulating mouse click;r=ochameau MozReview-Commit-ID: ElTy62z8tl6
devtools/client/shared/test/test-actor.js
--- a/devtools/client/shared/test/test-actor.js
+++ b/devtools/client/shared/test/test-actor.js
@@ -321,29 +321,30 @@ var TestActor = exports.TestActor = prot
       selector: Arg(0, "string")
     },
     response: {
       value: RetVal("json")
     }
   }),
 
   /**
-   * Synthesize a mouse event on an element. This handler doesn't send a message
-   * back. Consumers should listen to specific events on the inspector/highlighter
-   * to know when the event got synthesized.
+   * Synthesize a mouse event on an element, after ensuring that it is visible
+   * in the viewport. This handler doesn't send a message back. Consumers
+   * should listen to specific events on the inspector/highlighter to know when
+   * the event got synthesized.
    * @param {String} selector The node selector to get the node target for the event
    * @param {Number} x
    * @param {Number} y
    * @param {Boolean} center If set to true, x/y will be ignored and
    *                  synthesizeMouseAtCenter will be used instead
    * @param {Object} options Other event options
    */
   synthesizeMouse: protocol.method(function ({ selector, x, y, center, options }) {
     let node = this._querySelector(selector);
-
+    node.scrollIntoView();
     if (center) {
       EventUtils.synthesizeMouseAtCenter(node, options, node.ownerDocument.defaultView);
     } else {
       EventUtils.synthesizeMouse(node, x, y, options, node.ownerDocument.defaultView);
     }
   }, {
     request: {
       object: Arg(0, "json")