--- a/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
@@ -1,16 +1,17 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
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):
@@ -74,18 +75,23 @@ 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_elements = ["button12"]
+
+ # pointer-events: "none", which will return
+ # ElementClickInterceptedException if clicked
+ pointer_events_none_elements = ["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)
@@ -159,31 +165,42 @@ 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_elements,
+ lambda element: self.assertRaises(ElementNotAccessibleException,
+ element.is_enabled))
+ self.run_element_test(self.pointer_events_none_elements,
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,
+ self.run_element_test(self.aria_disabled_elements,
lambda element: self.assertRaises(ElementNotAccessibleException,
element.click))
+ self.run_element_test(self.pointer_events_none_elements,
+ lambda element: self.assertRaises(ElementClickInterceptedException,
+ element.click))
self.setup_accessibility(False, False)
- self.run_element_test(self.disabled_accessibility_elementIDs,
+ self.run_element_test(self.aria_disabled_elements,
+ lambda element: element.is_enabled())
+ self.run_element_test(self.pointer_events_none_elements,
lambda element: element.is_enabled())
- self.run_element_test(self.disabled_accessibility_elementIDs,
+ self.run_element_test(self.aria_disabled_elements,
lambda element: element.click())
+ self.run_element_test(self.pointer_events_none_elements,
+ lambda element: self.assertRaises(ElementClickInterceptedException,
+ 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):
self.setup_accessibility()