Bug 1255955 -Run element enabled check before accessibility checks; r=automatedtester
authorAndreas Tolfsen <ato@mozilla.com>
Sat, 13 Aug 2016 20:59:14 +0200
changeset 335481 da03fe82ba9de1fdd59294fad5e74aa24bce3dd9
parent 335480 2b2e61f6c66bf52c5d4dea4e5d2f3d45ef14c85d
child 335482 4030666f6c50c963645afab80caf373eb7ee1d06
push id10033
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:50:26 +0000
treeherdermozilla-aurora@5dddbefdf759 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1255955
milestone51.0a1
Bug 1255955 -Run element enabled check before accessibility checks; r=automatedtester 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);