Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

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

About

A plugin for accessibility testing using Taiko

Resources

License

Stars

Watchers

Forks

Packages

No packages published