pierzapin / testcafe-axe-example

Helper for using Axe in TestCafe tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

testcafe-axe-example

Helper for using Axe in TestCafe tests

How to install it?

Just copy axe-helper.js and axe.min.js and put them in some dir in your project.

How to use it?

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.

Accessibility errors

Axe options

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

About

Helper for using Axe in TestCafe tests


Languages

Language:JavaScript 100.0%