Skip to content
The helper for using Axe in TestCafe tests
JavaScript
Branch: master
Clone or download
Latest commit 2f64185 Jun 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore ingore lock files Jun 22, 2018
README.md fix typo in README.md Mar 7, 2019
errors.png update error image Mar 7, 2019
index.d.ts adding typings Apr 2, 2019
index.js refactoring Mar 7, 2019
package.json Bump version Jun 11, 2019

README.md

axe-testcafe

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

Installation

npm install axe-core axe-testcafe --save-dev

How to use

You can write a TestCafe test with automated accessibility checks like this.

import { axeCheck, createReport } from 'axe-testcafe';

fixture `TestCafe tests with Axe`
    .page `http://example.com`;

test('Automated accessibility testing', async t => {
    const { error, violations } = await axeCheck(t);
    await t.expect(violations.length === 0).ok(createReport(violations));
});

If any accessibility issues are found, you will see a detailed report generated by the createReport function.

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 () => {
    const axeContext = { exclude: [['select']] };
    const axeOptions = { rules: { 'html-has-lang': { enabled: false } } };
    const { error, violations } = await axeCheck(t, axeContext, axeOptions);
    await t.expect(violations.length === 0).ok(createReport(violations));
});
You can’t perform that action at this time.