/axe-testcafe

The helper for using Axe in TestCafe tests

Primary LanguageJavaScript

axe-testcafe

The TestCafe module that allows you to use the aXe accessibility engine in TestCafe tests.

Installation

npm install axe-testcafe

How to use

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.

Accessibility errors

aXe options

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);
});