Closed pauldcollins closed 7 years ago
It looks like there are at least two problems here.
withRules
takes a rule ID to ONLY run that rule, not an object to disable it. Your object is also not a valid structure.
aria-required
is not a rule id in axe-core. I think the rule you're after is aria-allowed-attr
.
Except it's worth pointing out that required
is a better choice for an input element because of its native support in HTML5 forms. That's why axe-core flags it as an issue.
Here is how you can disable a single rule in axe-webdriverjs:
AxeBuilder(driver)
.options({rules: {'aria-allowed-attr': {enabled: false}} })
.analyze(function(results) {
expect(results.violations.length).toBe(0);
done();
})
Hi Marcy
Thanks for your prompt and in-depth reply. Now I see I was using it the wrong way around and you are correct, it's the aria-allowed-attr
rule I'm after.
We are using a form library with the aria-required
attribute, so it's out of our hands in the short term. I've raised an issue with the developers however and hopefully between us we can get it fixed and then remove this condition in our tests.
Thanks again for such a great library.
Hi there,
I have noticed that when we use .withRules, it excludes the whole element from being tested. For example, if I use this line of code:
<input type="radio" aria-required="true">
and this testing code in my Protractor test:
.withRules({'aria-required': 'enabled': false})
When there is no label associated with the input, it should still fail the test, but it's passing. My assumption is this is because the entire input has been excluded from the validation.
Is there a way around this? I want to still validate the input, just not for that specific attribute (aria-required)
Thanks for any help