Bug 1387447 - Update accessibility pointer-events expectations. r?yzen draft
authorAndreas Tolfsen <ato@sny.no>
Fri, 04 Aug 2017 15:16:37 +0100
changeset 621296 c4fa6c88500ef1f7e03a22b51ef5edd6827d400d
parent 620862 32083f24a1bb2c33050b4c972783f066432194eb
child 640962 db886ae195c4806e4261a2a76d9b7edbe4a761ed
push id72323
push userbmo:ato@sny.no
push dateFri, 04 Aug 2017 16:02:09 +0000
reviewersyzen
bugs1387447
milestone57.0a1
Bug 1387447 - Update accessibility pointer-events expectations. r?yzen With a WebDriver-conforming Element Click implementation, the element click intercepted error is returned when an element with pointer-events: "none" causes the click to hit the underlying element. This patch does not functionally change anything yet about the accessibility tests, but splits disabled_accessibility_elementIDs into two lists, aria_disabled_elements and pointer_events_none_elements, in anticipation of moving Marionette to use a different click implementation. In the future, the ARIA tests will fail with "element not accessible" errors as they do now, but the pointer-events tests will fail with "element click intercepted" instead. MozReview-Commit-ID: Ks1hyUVyLK7
testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
@@ -3,17 +3,18 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import sys
 import unittest
 
 from marionette_driver.by import By
 from marionette_driver.errors import (
     ElementNotAccessibleException,
-    ElementNotInteractableException
+    ElementNotInteractableException,
+    ElementClickInterceptedException,
 )
 
 from marionette_harness import MarionetteTestCase
 
 
 
 class TestAccessibility(MarionetteTestCase):
     def setUp(self):
@@ -77,18 +78,25 @@ class TestAccessibility(MarionetteTestCa
         "button1", "button2", "button3", "button4", "button5", "button6",
         "button9", "no_accessible_but_displayed"
     ]
 
     displayed_but_a11y_hidden_elementIDs = ["button7", "button8"]
 
     disabled_elementIDs = ["button11", "no_accessible_but_disabled"]
 
-    # Elements that are enabled but otherwise disabled or not explorable via the accessibility API
-    disabled_accessibility_elementIDs = ["button12", "button15", "button16"]
+    # Elements that are enabled but otherwise disabled or not explorable
+    # via the accessibility API
+    aria_disabled_elementIDs = ["button12"]
+
+    # pointer-events: "none", which will return
+    # ElementClickInterceptedException if clicked
+    # when Marionette switches
+    # to using WebDriver conforming interaction
+    pointer_events_none_elementIDs = ["button15", "button16"]
 
     # Elements that are reporting selected state
     valid_option_elementIDs = ["option1", "option2"]
 
     def run_element_test(self, ids, testFn):
         for id in ids:
             element = self.marionette.find_element(By.ID, id)
             testFn(element)
@@ -162,30 +170,41 @@ class TestAccessibility(MarionetteTestCa
     def test_element_is_visible_to_accessibility(self):
         self.setup_accessibility()
         # No exception should be raised
         self.run_element_test(self.displayed_elementIDs, lambda element: element.is_displayed())
 
     def test_element_is_not_enabled_to_accessbility(self):
         self.setup_accessibility()
         # Buttons are enabled but disabled/not-explorable via the accessibility API
-        self.run_element_test(self.disabled_accessibility_elementIDs,
+        self.run_element_test(self.aria_disabled_elementIDs,
+                              lambda element: self.assertRaises(ElementNotAccessibleException,
+                                                                element.is_enabled))
+        self.run_element_test(self.pointer_events_none_elementIDs,
                               lambda element: self.assertRaises(ElementNotAccessibleException,
                                                                 element.is_enabled))
 
-        # Buttons are enabled but disabled/not-explorable via the accessibility API and thus are not
-        # clickable via the accessibility API
-        self.run_element_test(self.disabled_accessibility_elementIDs,
+        # Buttons are enabled but disabled/not-explorable via
+        # the accessibility API and thus are not clickable via the
+        # accessibility API.
+        self.run_element_test(self.aria_disabled_elementIDs,
+                              lambda element: self.assertRaises(ElementNotAccessibleException,
+                                                                element.click))
+        self.run_element_test(self.pointer_events_none_elementIDs,
                               lambda element: self.assertRaises(ElementNotAccessibleException,
                                                                 element.click))
 
         self.setup_accessibility(False, False)
-        self.run_element_test(self.disabled_accessibility_elementIDs,
+        self.run_element_test(self.aria_disabled_elementIDs,
+                              lambda element: element.is_enabled())
+        self.run_element_test(self.pointer_events_none_elementIDs,
                               lambda element: element.is_enabled())
-        self.run_element_test(self.disabled_accessibility_elementIDs,
+        self.run_element_test(self.aria_disabled_elementIDs,
+                              lambda element: element.click())
+        self.run_element_test(self.pointer_events_none_elementIDs,
                               lambda element: element.click())
 
     def test_element_is_enabled_to_accessibility(self):
         self.setup_accessibility()
         # No exception should be raised
         self.run_element_test(self.disabled_elementIDs, lambda element: element.is_enabled())
 
     def test_send_keys_raises_no_exception(self):