Ignore Rules
You can choose to ignore specified rules while testing accessibility. We support ignoring all instances of a specific rule by name and ignoring some rules by View ID Resource Name. While we feel that all rules are essential, these customizations will let you ignore views that have yet to be fixed and focus on identifying new issues.
In the below examples, axe
refers to the AxeDevTools
object initialized when logging in.
APIs Available
To ignore a specific rule or set of rules, update the configuration before testing takes place.
Ignore Rule(s)
The code below shows how to ignore a specific rule, TouchSizeWcag
.
axe.ignoreRules(mutableListOf("TouchSizeWcag"))
Ignore by View ID Resource Name
Ignore a set of rules with an assigned View ID Resource Name, using two parameters - the name of the View ID Resource, and a list of rules to ignore.
axe.ignoreByViewIdResourceName(
"axe_button",
listOf(
"ActiveViewName"
)
)
Ignore Experimental Rules
Experimental rules are rulesets that are still in testing and development. When ignoreExperimental
is enabled, all results from the experimental rules will have the status of AxeStatus.IGNORED
.
axe.ignoreExperimental()
Reset Ignored Rules
Within your automated test suite, you may want to start a new set of tests and restore all rules. In this case you may clear any ignored rules you've set using the methods above - with the resetIgnoredRules
API.
@Before
fun setup() {
axe.resetIgnoredRules()
}
@Test
fun testButtonOnly() {
axe.ignoreRules(listOf("ScreenTitle"))
...
}
@Test
fun testScreenTitle() {
...
}