You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@khaipham/axe-testcafe

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khaipham/axe-testcafe

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

1.0.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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

Keywords

axe

FAQs

Package last updated on 20 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts