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

aatt

v1.0.2

Published

Automated Accessibility Testing Tool

Downloads

53

Readme

Automated Accessibility Testing Tool (AATT)

Browser-based accessibility testing tools and plugins require manually testing each page, one at a time. Tools that can crawl a website can only scan pages that do not require login credentials, and that are not behind a firewall. Instead of developing, testing, and using a separate accessibility test suite, you can now integrate accessibility testing into your existing automation test suite using AATT.

AATT tests web applications regarding conformance to the Web Content Accessibility Guidelines (WCAG) 2.1 (for axe engine).

AATT provides an accessibility API and custom web application for HTML CodeSniffer, Axe and Chrome developer tool. Using the AATT web application, you can configure test server configurations inside the firewall, and test individual pages.

AATT includes HTML CodeSniffer, Axe and Chrome developer tool with Express and PhantomJS, which runs on Node.

For example, it can be used to test Java web applications using SeLion automation test frameworks.

For node applications, it can be integrated into NemoJS testing framework to run accessibility testing during automated unit testing .For Nemo framework use [Nemo-Accessibility plugin] (https://github.com/paypal/nemo-accessibility)

Set up

$ git clone https://github.com/paypal/AATT.git
$ cd AATT
$ npm i
$ DEBUG=AATT* http_port=3000 node app.js . (If you want to run in Debug mode printing logs)

$sudo node app.js will run in default port 80 without printing log information

You can now access the running instance of AATT from http://localhost:3000

Integration with AATT API

AATT provides an API for evaluating HTML Source code from other servers. The API EndPoint is: https://your_nodejs_server/evaluate

  • Accepts the following OPTIONAL parameters:

    1. "source" to send the HTML source of the page. Can be a whole page or partial page source. Defaults to document

    2. "engine" E.g. engine=htmlcs. This is the engine which will scan the code. It accepts a single value of "axe", chrome" or "htmlcs". Defaults to axe

    3. "ouput" to get the jsonified string. E.g. output=json. If this parameter is not set or left empty, it will return a string with table data that can be parsed or appended directly into your page. Defaults to json.

    4. "errLevel" Error level like Error, Warning or Notices . Mapped to 1, 2 and 3 respectively. E.g. "1,2,3" . (For HTMLCS engine)

    5. "level" This option applies only for the default htmlcs evaluation engine. Options can be either of the following WCAG2AA, WCAG2A, WCAG2AAA, Section508 . Defaults to "WCAG2A" (For HTMLCS engine)

  • Set the Request Header Content-type as application/x-www-form-urlencoded

Example

Here is a sample ajax script which would initiate the request:

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","http://your_nodejs_server/evaluate",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("source=" + document.getElementById('source').value + "&priority=" + document.getElementById('priority').value);

How to Use with nemo-accessibility as a plugin

Nemo is a node.js based automation framework for browser automation. It's plugin-architecture helps switch on/off different capabilities. The nemo-accessibility plugin performs accessibility scanning while running browser automation using Nemo framework.

Learn more about nemo

nemo-accessibility plugin uses the AATT accessibility API to evaluate HTML source. Therefore you must specify the API url under as a plugin argument like below.

  "nemo-accessibility":{
       "module":"nemo-accessibility",
       "arguments": ["https://your_nodejs_accessibility_server/evaluate"]
   }

How to Use with nightwatchJS

Nightwatch JS is another UI automated testing framework powered by Node.js and uses the Selenium WebDriver API. To call AATT, you need to use the request module. NightwatchJs has call back functions like before and after hooks that would be called before or after executing a test case. Request to AATT API should be done in after hook passing the source code of the page to the API. Here is an example commit on how to do this with Nightwatch.

How to use as a node module

The AATT evaluate function can be used directly as a node module, without the need for using a web API.

Installation

Add the module to your project

npm install --save aatt

Usage Example

This takes the same options as the web /evaluate HTTP endpoint.

const { evaluate } = require('aatt');

evaluate({
    source: "<html xml:lang='en-gb'><head><title>Foo</title></head><body><p>Bar</p></body></html>",
    output: "json",
    engine: "htmlcs",
    level: "WCAG2A"
}).then(result => {
    console.log('Results', JSON.parse(result));
});

Copyright and License

Copyright 2021, PayPal under the BSD license.

Contributors

Feedback

We welcome your feedback. Please file issues and/or enhancement requests.