Bug 1277811 - Fix test_key_actions.py by scrolling element into view before press() is called. r=automatedtester, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Mon, 22 Aug 2016 14:07:51 +0200
changeset 349923 0801ef134cad49e7da4011ff04ba9f7c0738bf1a
parent 349922 1d42160deab394f3c81d35f2897c6d660b2d3d41
child 349924 b6d35508be5b9bb4049e3902cd371751993cb86a
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1277811
milestone50.0a2
Bug 1277811 - Fix test_key_actions.py by scrolling element into view before press() is called. r=automatedtester, a=test-only MozReview-Commit-ID: J4X2TM5LeWF
testing/marionette/harness/marionette/tests/unit/test_key_actions.py
--- a/testing/marionette/harness/marionette/tests/unit/test_key_actions.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_key_actions.py
@@ -64,18 +64,21 @@ class TestKeyActions(MarionetteTestCase)
         (self.key_action.key_down(self.mod_key)
                         .key_down("a")
                         .wait(.5)
                         .key_down("x")
                         .perform())
         self.assertEqual(self.key_reporter_value, "")
 
     def test_open_in_new_window_shortcut(self):
+        start_win = self.marionette.current_chrome_window_handle
         el = self.marionette.find_element(By.ID, "updatediv")
-        start_win = self.marionette.current_chrome_window_handle
+        # Ensure that the element is in the current view port because press() doesn't
+        # handle that inside the action chain (bug 1295538).
+        self.marionette.execute_script('arguments[0].scrollIntoView()', script_args=[el])
         (self.key_action.key_down(Keys.SHIFT)
                         .press(el)
                         .release()
                         .key_up(Keys.SHIFT)
                         .perform())
         self.wait_for_condition(
             lambda mn: len(self.marionette.window_handles) == 2)
         chrome_window_handles = self.marionette.chrome_window_handles