npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

protractor-accessibility-plugin

v0.3.0

Published

Runs a set of accessibility audits

Downloads

1,474

Readme

Accessibility Plugin

Protractor comes with support for three accessibility testing options:

  • Accessibility Developer Tools
  • aXe Accessibility Engine
  • Tenon.io

Protractor will run each set of audits (depending on your configuration) on your existing end-to-end tests to ensure your site is free of obvious errors. In this kind of testing, there is no concept of "warnings"–only pass or fail. In your configuration, you can decide whether warnings should pass or fail your build.

To understand how each of these tools can be used, see this support matrix:

| Testing Library | Pricing | API Key | External Request | No. of Tests | Info | |--------------------------------------|-------------------------------------------|---------|------------------|--------------|-------------------------------------------------------------------------| | Chrome Accessibility Developer Tools | Free | No | No | 14 | GitHub | | aXe Accessibility Engine | Free | No | No | 53 | GitHub
| Tenon.io | Free limited accounts, paid subscriptions | Yes | Yes | 63 | Tenon.io | |

Protractor now supports the Accessibility Developer Tools, the same audit library used by the Chrome browser extension. Protractor runs an audit locally by injecting the Dev Tools script into WebDriver pages, and it can diagnose issues including missing labels, incorrect ARIA attributes and color contrast. This is a great starting point if you can't send source code over the wire through an API.

aXe operates similarly to Chrome's Accessibility Developer Tools by injecting axe-core into all frames and checking the content against 53 accessibility rules.

Tenon.io has a more robust set of tests to help you find accessibility issues, but it requires registering for an API key and making an external request for each test, which may not work for everyone. Some people use Tenon with introspection services like ngrok or localtunnel to securely test local web servers. Protractor takes the options you provide in the plugin configuration and sends them with the page source to the Tenon API. One limitation of this approach is that all scripts must be reachable from the page source as a string, for example, by using a CDN. For projects with an MIT license, Tenon is free but with a limited daily API limit. Paid subscriptions are available for enterprise and commercial projects.

Enable this plugin in your config file:

  // Chrome Accessibility Dev Tools only:
  exports.config = {
      ...
      plugins: [{
        chromeA11YDevTools: {
          treatWarningsAsFailures: true,
          auditConfiguration: {
            auditRulesToRun: [
              'audioWithoutControls',
              'badAriaAttributeValue',
              'badAriaRole',
              'controlsWithoutLabel',
              'elementsWithMeaningfulBackgroundImage',
              'focusableElementNotVisibleAndNotAriaHidden',
              'imagesWithoutAltText',
              'linkWithUnclearPurpose',
              'lowContrastElements',
              'mainRoleOnInappropriateElement',
              'nonExistentAriaLabelledbyElement',
              'pageWithoutTitle',
              'requiredAriaAttributeMissing',
              'unfocusableElementsWithOnClick',
              'videoWithoutCaptions'
            ],
            auditRulesToSkip: []
          }
        },
        package: 'protractor-accessibility-plugin'
      }]
    }
  // aXe only:
  exports.config = {
      ...
      plugins: [{
        axe: true,
        package: 'protractor-accessibility-plugin'
      }]
    }
  // Tenon.io only:
  exports.config = {
      ...
      plugins: [{
        tenonIO: {
          options: {
            // See http://tenon.io/documentation/understanding-request-parameters.php
            // options.src will be added by the test.
          },
          printAll: false, // whether the plugin should log API response
        },
        chromeA11YDevTools: true,
        package: 'protractor-accessibility-plugin'
      }]
    }