New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nightwatch-axe-verbose

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nightwatch-axe-verbose

For adding custom commands to allow you to run axe accessibility tests in your NightwatchJS test cases.

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
96K
decreased by-22.95%
Maintainers
1
Weekly downloads
 
Created
Source

nightwatch-axe-verbose

Node.js CI

Verbose error reporting for axe accessibility rule violations to use in NightwatchJS

This fork of nightwatch-axe is more verbose in that it will report each passing rule run and how many elements it was run against. In addition, each rule failure will be counted individually against each failing element so downstream failures are not hidden.

Nightwatch.js custom commands for aXe allowing Nightwatch to be used as an automated accessibility testing tool.

Installation instructions

NOTE: If you are using Nightwatch 2.3.6 or greater this is now pre-included as a default plugin in the Nightwatch installation so you can skip this install section

npm install nightwatch-axe-verbose --save-dev

In nightwatch.conf.js add nightwatch-axe-verbose to the plugins property array.

nightwatch.conf.js
{
  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-plugins.html
  plugins: ['nightwatch-axe-verbose'];
}

If you are using an older Nightwatch version or prefer the prior custom_commands_path option that will still work instead, but the path has changed from src/commands to nightwatch/commands as shown below. You must update the path or use the plugin pattern above starting with v2 of nightwatch-axe-verbose.

"custom_commands_path": ["./node_modules/nightwatch-axe-verbose/nightwatch/commands"]

axeInject()

Injects the axe-core js library into your test page

axeRun(options)

Analyzes the current page against applied axe rules

Example test

AxeRun takes as a first parameter the selector of the element you want to run the axe test against. If you do it on a larger containing element such as the body all the inner elements will be scanned.

module.exports = {
    '@tags': ['accessibility'],
    'ensure site is accessible': function (browser) {
     browser
            .url('https://dequeuniversity.com/demo/mars/')
            .axeInject()
            .axeRun('body', {
                rules: {'color-contrast': { enabled: false }}
            })
            .end();
    }

Example output

Passes

√ Passed [ok]: aXe rule: aria-hidden-body (1 elements checked)
√ Passed [ok]: aXe rule: color-contrast (62 elements checked)
√ Passed [ok]: aXe rule: duplicate-id-aria (1 elements checked)

Failures

× Failed [fail]: (aXe rule: button-name - Buttons must have discernible text
        In element: .departure-date > .ui-datepicker-trigger:nth-child(4))

× Failed [fail]: (aXe rule: color-contrast - Elements must have sufficient color contrast
        In element: a[href="mars2\.html\?a\=be_bold"] > h3)

Keywords

FAQs

Package last updated on 04 Jan 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc