WebUI accessibility audit


What is it?

Any test written using the WebUI browser test framework will now run an accessibility audit at the conclusion of each test case.

How do I disable it?

You can disable the accessibility check for a particular test case by calling disableAccessibilityChecks() during the test method.

For example,
TEST_F('SomeWebUITest', 'basicTest', function() {
   disableAccessibilityChecks();

    // rest of test code
});

You can disable the accessibility check for a test fixture by setting the runA11yChecks parameter on the fixture object.

For example,
SomeWebUITest.prototype = {
    _proto__: testing.Test.prototype,

    runAccessibilityChecks: false,

    // rest of fixture
}; 

You can then enable the accessibility check on a per-test basis using the enableAccessibilityChecks():
TEST_F('SomeWebUITest', 'aDifferentTest', function()
    enableAccessibilityChecks();

    //rest of test code
})

What does it do?

Before tearDown(), it runs all the audit rules from the accessibility-developer-tools library on the WebUI page under test. Each rule consists of a selector function which picks out the relevant elements on the page, and a test which is run on each matching element. If the test fails, the element is added to a list of failing elements. For each failing audit rule, up to five elements will be output at the end of the test, in the form of a query selector string which can be used to find the element on the page.

What do the test results mean?

The accessibility-developer-tools wiki has more information on the specific audit rules.


Comments