Helper for using Axe in TestCafe tests
Just copy axe-helper.js
and axe.min.js
and put them in some dir in your project.
You can write TestCafe test like this:
import axeCheck from './axe-helper';
fixture `TestCafe tests with Axe`
.page `http://localhost/testcafe/index.html`;
test('Automated accessibility testing', async () => {
await axeCheck();
});
If some accessibility problems will be found you will see corresponding error.
Please see Axe run method API.
You can define context
and options
in TestCafe test:
test('Automated accessibility testing', async () => {
var axeContext = { exclude: [['select']] };
var axeOptions = { rules: { 'html-has-lang': { enabled: false } } };
await axeCheck(axeContext, axeOptions);
});