Nightwatch.js utility assertion for accessibility testing with aXe
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
assertions
commands
test
.codeclimate.yml
.editorconfig
.eslintrc
.gitignore
.releaserc
.remarkrc feat(scaffold): update project scaffold Oct 23, 2018
LICENSE
README.md
circle.yml
package-lock.json
package.json
renovate.json

README.md

Nightwatch Accessibility

License version Build Status

Nightwatch.js utility assertion for accessibility testing with aXe.

Install

npm install --only=production --save nightwatch-accessibility

Usage

Update your nightwatch config:

{
  custom_commands_path: ["./node_modules/nightwatch-accessibility/commands"],
  custom_assertions_path: ["./node_modules/nightwatch-accessibility/assertions"]
}

Use in your tests:

module.exports = {
  'Test': function (browser) {
    browser
      .initAccessibility()
      .assert.accessibility('#app', {
        verbose: true,
        rules: {
          'color-contrast': { enabled: false }
        }
      })
      .end()
  }
}

API

browser.initAccessibility()

Injects the aXe library into the current test page.

browser.assert.accessibility(context, options)

Analyzes the defined context against applied aXe rules

Name Type Default Description
context String 'html' aXe Context Parameter
options Object null aXe Options Parameter

In addition to the standard options:

  • options.verbose set to true will log all successful aXe tests.
  • options.timeout configures the nightwatch timeout, default value is 500 milliseconds

Author: Ahmad Nassri • Github: @ahmadnassri • Twitter: @AhmadNassri