GithubHelp home page GithubHelp logo

kryndex / protractor-accessibility-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from angular/protractor-accessibility-plugin

0.0 2.0 0.0 208 KB

Runs a set of accessibility audits

License: MIT License

JavaScript 71.11% HTML 28.89%

protractor-accessibility-plugin's Introduction

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'
      }]
    }

protractor-accessibility-plugin's People

Contributors

angela-choo avatar contolini avatar evilaliv3 avatar sjelin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.