The TestCafe module that allows you to use the aXe accessibility engine in TestCafe tests.
npm install axe-testcafe
You can write a TestCafe test with automated accessibility checks like this.
import axeCheck from 'axe-testcafe';
fixture `TestCafe tests with Axe`
.page `http://example.com`;
test('Automated accessibility testing', async t => {
await axeCheck(t);
});
If any accessibility issues are found, you will see a detailed report.
The axe-testcafe
module allows you to define the context
and options
axe.run parameters in a TestCafe test.
test('Automated accessibility testing', async () => {
var axeContext = { exclude: [['select']] };
var axeOptions = { rules: { 'html-has-lang': { enabled: false } } };
await axeCheck(t, axeContext, axeOptions);
});