Bug 1277811 - Fix test_key_actions.py by scrolling element into view before press() is called. r?automatedtester
MozReview-Commit-ID: J4X2TM5LeWF
--- 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