Bug 1255955 - Run element enabled check before accessibility checks; r=automatedtester, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Sat, 13 Aug 2016 20:59:14 +0200
changeset 332811 f4aa3c3af595bf44fcfbc8ec7b6190ed207090e2
parent 332810 393b9382b1fcc5b4d373a2698b7c1f257fdb922a
child 332812 6f1c9caedd87771d03d5e2808a4e821136679221
push id9925
push userryanvm@gmail.com
push dateSat, 20 Aug 2016 01:43:22 +0000
treeherdermozilla-aurora@f4aa3c3af595 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1255955
milestone50.0a2
Bug 1255955 - Run element enabled check before accessibility checks; r=automatedtester, a=test-only MozReview-Commit-ID: 18OtOKtox3K
testing/marionette/interaction.js
--- a/testing/marionette/interaction.js
+++ b/testing/marionette/interaction.js
@@ -113,35 +113,35 @@ interaction.clickElement = function*(el,
   let win = getWindow(el);
   let a11y = accessibility.get(strict);
 
   let visibilityCheckEl  = el;
   if (el.localName == "option") {
     visibilityCheckEl = interaction.getSelectForOptionElement(el);
   }
 
-  let visible = false;
+  let interactable = false;
   if (specCompat) {
     if (!element.isInteractable(visibilityCheckEl)) {
       el.scrollIntoView(false);
     }
-    visible = element.isInteractable(visibilityCheckEl);
+    interactable = element.isInteractable(visibilityCheckEl);
   } else {
-    visible = element.isVisible(visibilityCheckEl);
+    interactable = element.isVisible(visibilityCheckEl);
+  }
+  if (!interactable) {
+    throw new ElementNotVisibleError();
   }
 
-  if (!visible) {
-    throw new ElementNotVisibleError("Element not visible");
+  if (!atom.isElementEnabled(el)) {
+    throw new InvalidElementStateError("Element is not enabled");
   }
 
   yield a11y.getAccessible(el, true).then(acc => {
-    a11y.assertVisible(acc, el, visible);
-    if (!atom.isElementEnabled(el)) {
-      throw new InvalidElementStateError("Element is not enabled");
-    }
+    a11y.assertVisible(acc, el, interactable);
     a11y.assertEnabled(acc, el, true);
     a11y.assertActionable(acc, el);
   });
 
   // chrome elements
   if (element.isXULElement(el)) {
     if (el.localName == "option") {
       interaction.selectOption(el);