Bug 1324529 - Rename Marionette capability raisesAccessibilityExceptions to moz:accessibilityChecks; r=whimboo,yzen

This change renames the `raisesAccessibilityExceptions` capability to
`moz:accessibilityChecks` to conform with the format of extension
capabilities as defined in the WebDriver specification.

As this feature is not tested or used in the Firefox upgrade tests and
has limited deployment outside Mozilla, it is considered safe for this
to be a breaking change.

MozReview-Commit-ID: DRA16cWJDX0

--HG--
extra : rebase_source : 42fac27f655ce431ae68bbaeeec6a208d91e9033
This commit is contained in:
Andreas Tolfsen 2016-12-19 19:28:17 +00:00
parent 22418ad00d
commit 892dd1cb42
4 changed files with 22 additions and 18 deletions

View File

@ -156,7 +156,6 @@ this.GeckoDriver = function (appName, server) {
"acceptInsecureCerts": !this.secureTLS,
// supported features
"raisesAccessibilityExceptions": false,
"rotatable": this.appName == "B2G",
"proxy": {},
@ -164,6 +163,7 @@ this.GeckoDriver = function (appName, server) {
"specificationLevel": 0,
"moz:processID": Services.appinfo.processID,
"moz:profile": Services.dirsvc.get("ProfD", Ci.nsIFile).path,
"moz:accessibilityChecks": false,
};
this.mm = globalMessageManager;
@ -183,6 +183,10 @@ this.GeckoDriver = function (appName, server) {
this.actions = new action.Chain();
};
Object.defineProperty(GeckoDriver.prototype, "a11yChecks", {
get: function () { return this.sessionCapabilities["moz:accessibilityChecks"]; }
});
GeckoDriver.prototype.QueryInterface = XPCOMUtils.generateQI([
Ci.nsIMessageListener,
Ci.nsIObserver,
@ -532,8 +536,7 @@ GeckoDriver.prototype.newSession = function*(cmd, resp) {
// If we are testing accessibility with marionette, start a11y service in
// chrome first. This will ensure that we do not have any content-only
// services hanging around.
if (this.sessionCapabilities.raisesAccessibilityExceptions &&
accessibility.service) {
if (this.a11yChecks && accessibility.service) {
logger.info("Preemptively starting accessibility service in Chrome");
}
@ -1784,8 +1787,7 @@ GeckoDriver.prototype.clickElement = function*(cmd, resp) {
case Context.CHROME:
let win = this.getCurrentWindow();
let el = this.curBrowser.seenEls.get(id, {frame: win});
yield interaction.clickElement(
el, this.sessionCapabilities.raisesAccessibilityExceptions);
yield interaction.clickElement(el, this.a11yChecks);
break;
case Context.CONTENT:
@ -1915,7 +1917,7 @@ GeckoDriver.prototype.isElementDisplayed = function*(cmd, resp) {
let win = this.getCurrentWindow();
let el = this.curBrowser.seenEls.get(id, {frame: win});
resp.body.value = yield interaction.isElementDisplayed(
el, this.sessionCapabilities.raisesAccessibilityExceptions);
el, this.a11yChecks);
break;
case Context.CONTENT:
@ -1964,7 +1966,7 @@ GeckoDriver.prototype.isElementEnabled = function*(cmd, resp) {
let win = this.getCurrentWindow();
let el = this.curBrowser.seenEls.get(id, {frame: win});
resp.body.value = yield interaction.isElementEnabled(
el, this.sessionCapabilities.raisesAccessibilityExceptions);
el, this.a11yChecks);
break;
case Context.CONTENT:
@ -1988,7 +1990,7 @@ GeckoDriver.prototype.isElementSelected = function*(cmd, resp) {
let win = this.getCurrentWindow();
let el = this.curBrowser.seenEls.get(id, {frame: win});
resp.body.value = yield interaction.isElementSelected(
el, this.sessionCapabilities.raisesAccessibilityExceptions);
el, this.a11yChecks);
break;
case Context.CONTENT:
@ -2036,7 +2038,7 @@ GeckoDriver.prototype.sendKeysToElement = function*(cmd, resp) {
let win = this.getCurrentWindow();
let el = this.curBrowser.seenEls.get(id, {frame: win});
yield interaction.sendKeysToElement(
el, value, true, this.sessionCapabilities.raisesAccessibilityExceptions);
el, value, true, this.a11yChecks);
break;
case Context.CONTENT:

View File

@ -90,10 +90,9 @@ class TestAccessibility(MarionetteTestCase):
element = self.marionette.find_element(By.ID, id)
testFn(element)
def setup_accessibility(self, raisesAccessibilityExceptions=True, navigate=True):
def setup_accessibility(self, enable_a11y_checks=True, navigate=True):
self.marionette.delete_session()
self.marionette.start_session(
{"raisesAccessibilityExceptions": raisesAccessibilityExceptions})
self.marionette.start_session({"moz:accessibilityChecks": enable_a11y_checks})
# Navigate to test_accessibility.html
if navigate:
test_accessibility = self.marionette.absolute_url("test_accessibility.html")

View File

@ -48,6 +48,9 @@ class TestCapabilities(MarionetteTestCase):
self.assertEqual(self.caps["moz:profile"], current_profile)
self.assertEqual(self.marionette.profile, current_profile)
self.assertIn("moz:accessibilityChecks", self.caps)
self.assertFalse(self.caps["moz:accessibilityChecks"])
def test_we_can_pass_in_capabilities_on_session_start(self):
self.marionette.delete_session()
capabilities = {"desiredCapabilities": {"somethingAwesome": "cake"}}

View File

@ -634,7 +634,7 @@ function singleTap(id, corx, cory) {
throw new ElementNotVisibleError("Element is not currently visible and may not be manipulated");
}
let a11y = accessibility.get(capabilities.raisesAccessibilityExceptions);
let a11y = accessibility.get(capabilities["moz:accessibilityChecks"]);
return a11y.getAccessible(el, true).then(acc => {
a11y.assertVisible(acc, el, visible);
a11y.assertActionable(acc, el);
@ -1157,7 +1157,7 @@ function clickElement(id) {
let el = seenEls.get(id, curContainer);
return interaction.clickElement(
el,
!!capabilities.raisesAccessibilityExceptions,
!!capabilities["moz:accessibilityChecks"],
capabilities.specificationLevel >= 1);
}
@ -1216,7 +1216,7 @@ function getElementTagName(id) {
function isElementDisplayed(id) {
let el = seenEls.get(id, curContainer);
return interaction.isElementDisplayed(
el, capabilities.raisesAccessibilityExceptions);
el, capabilities["moz:accessibilityChecks"]);
}
/**
@ -1269,7 +1269,7 @@ function getElementRect(id) {
function isElementEnabled(id) {
let el = seenEls.get(id, curContainer);
return interaction.isElementEnabled(
el, capabilities.raisesAccessibilityExceptions);
el, capabilities["moz:accessibilityChecks"]);
}
/**
@ -1281,7 +1281,7 @@ function isElementEnabled(id) {
function isElementSelected(id) {
let el = seenEls.get(id, curContainer);
return interaction.isElementSelected(
el, capabilities.raisesAccessibilityExceptions);
el, capabilities["moz:accessibilityChecks"]);
}
function* sendKeysToElement(id, val) {
@ -1291,7 +1291,7 @@ function* sendKeysToElement(id, val) {
yield interaction.uploadFile(el, path);
} else {
yield interaction.sendKeysToElement(
el, val, false, capabilities.raisesAccessibilityExceptions);
el, val, false, capabilities["moz:accessibilityChecks"]);
}
}