Bug 1317386 - Swap expectation of which button causes scroll. r=automatedtester, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 15 Nov 2016 11:41:23 +0000
changeset 352571 0d440483f80c9b8072b3aa6b55e91824c92f7f61
parent 352570 229a089df41414b71536dcbfadd93f0afd205f0d
child 352572 8bcdcb64549b43a1c6025ee4170c182567f70248
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1317386
milestone52.0a2
Bug 1317386 - Swap expectation of which button causes scroll. r=automatedtester, a=test-only When we scroll the element into the bottom of the viewport, it is the first button that does not cause a scroll. MozReview-Commit-ID: 1zv3uyUcnRn
testing/marionette/harness/marionette/tests/unit/test_click_scrolling.py
--- a/testing/marionette/harness/marionette/tests/unit/test_click_scrolling.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_click_scrolling.py
@@ -4,16 +4,17 @@
 
 from marionette_driver.by import By
 from marionette_driver.errors import MoveTargetOutOfBoundsException
 from marionette import MarionetteTestCase, skip
 
 
 class TestClickScrolling(MarionetteTestCase):
 
+
     def test_clicking_on_anchor_scrolls_page(self):
         scrollScript = """
             var pageY;
             if (typeof(window.pageYOffset) == 'number') {
                 pageY = window.pageYOffset;
             } else {
                 pageY = document.documentElement.scrollTop;
             }
@@ -59,19 +60,23 @@ class TestClickScrolling(MarionetteTestC
         item.click()
         y_offset = self.marionette.execute_script("return arguments[0].scrollTop;", script_args=[list_el])
         self.assertEqual(0, y_offset)
 
     def test_should_not_scroll_if_already_scrolled_and_element_is_in_view(self):
         test_html = self.marionette.absolute_url("scroll3.html")
         self.marionette.navigate(test_html)
 
-        self.marionette.find_element(By.ID, "button1").click()
+        button1 = self.marionette.find_element(By.ID, "button1")
+        button2 = self.marionette.find_element(By.ID, "button2")
+
+        button2.click()
         scroll_top = self.marionette.execute_script("return document.body.scrollTop;")
-        self.marionette.find_element(By.ID, "button2").click()
+        button1.click()
+
         self.assertEqual(scroll_top, self.marionette.execute_script("return document.body.scrollTop;"))
 
     def test_should_be_able_to_click_radio_button_scrolled_into_view(self):
         test_html = self.marionette.absolute_url("scroll4.html")
         self.marionette.navigate(test_html)
 
         # If we dont throw we are good
         self.marionette.find_element(By.ID, "radio").click()