taiko-accessibility

0.3.2 • Public • Published

Taiko Accessibility Plugin

A plugin to perform accessibility testing with Taiko. For now, the plugin is utilizing the Axe Core library (https://github.com/dequelabs/axe-core).

Install

npm install --save-dev taiko-accessibility

Example

  npm init -y
  npm install --save-dev taiko taiko-accessibility jest

Add this test in a file accessibility.test.js.

const { accessibility, closeBrowser, goto, openBrowser } = require('taiko');

describe('accessibility', () => {

    beforeEach(async () => {
        jest.setTimeout(20000);
        await openBrowser();
    });
    
    afterEach(async () => {
        await closeBrowser();
    });
    
    test('Should be accessible', async () => {
        await goto('https://taiko.dev');
        const audit = await accessibility.runAudit();

        expect(audit.violations.length).toEqual(0);
    });

});

Run script with:

jest accessibility.test.js 

Or if Jest in not installed globally:

./node_modules/jest/bin/jest.js accessibility.test.js 

API

runAudit() currently returns an object with the following keys:

score

A score between 0-100 which shows how well the page is doing in terms of accessibility. This is based on the ration of fulfilled rules to applied rules (100 is best, 0 worst).

violations

An array with detailed information of the accessibility violations.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i taiko-accessibility

Weekly Downloads

763

Version

0.3.2

License

MIT

Unpacked Size

11 kB

Total Files

11

Last publish

Collaborators

  • andreas-ku