taiko-accessibility
v0.3.3
Published
A Taiko plugin to for accessability testing
Downloads
2,127
Readme
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');
const LONG_TIMEOUT = 20000;
describe('accessibility', () => {
beforeEach(async () => {
await openBrowser();
}, LONG_TIMEOUT);
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