Socket
Socket
Sign inDemoInstall

pa11y

Package Overview
Dependencies
Maintainers
6
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pa11y - npm Package Compare versions

Comparing version 5.0.0-beta.1 to 5.0.0-beta.2

.npmignore

12

bin/pa11y.js

@@ -12,14 +12,2 @@ #!/usr/bin/env node

// FIXME This is a temporary hack. Currently Puppeteer rejects when
// a request that has already been cancelled is intercepted. There's
// no other way around this for now. Keep an eye on the discussion:
// https://github.com/GoogleChrome/puppeteer/issues/627
process.on('unhandledRejection', error => {
// If the error is NOT the above Puppeteer issue, then we do stuff
if (!/network.continueinterceptedrequest/i.test(error.message)) {
console.log(error.stack);
process.exit(1);
}
});
configureProgram();

@@ -26,0 +14,0 @@ runProgram();

# Changelog
## 5.0.0-beta.2 pre-release (2017-10-04)
* Output browser console messages to the debug log
* Add the `screen-capture` action
* Add the `wait-for-element-event` action
* Update dependencies
* puppeteer: ^0.10.2 to ^0.11.0
* pa11y-lint-config: ^1.2.0 to ^1.2.1
## 5.0.0-beta.1 pre-release (2017-09-11)

@@ -8,2 +17,11 @@

## 4.13.0 (2017-09-15)
* Update dependencies
* HTML CodeSniffer: 2.0.7 to 2.1.1
## 4.12.2 (2017-09-11)
* Exit with an error when using an incompatible command-line reporter
## 4.12.1 (2017-08-23)

@@ -10,0 +28,0 @@

@@ -123,2 +123,16 @@ 'use strict';

// Action to screen capture the page to a file
// E.g. "screen-capture example.png"
// E.g. "capture screen to example.png"
{
name: 'screen-capture',
match: /^(screen[ -]?capture|capture[ -]?screen)( to)? (.+)$/i,
run: async (browser, page, options, matches) => {
await page.screenshot({
path: matches[3],
fullPage: true
});
}
},
// Action which waits for the URL, path, or fragment to change to the given value

@@ -211,3 +225,41 @@ // E.g. "wait for fragment to be #example"

}
},
// Action which waits for an element to emit an event
// E.g. "wait for element .foo to emit example-event"
// E.g. "wait for .tab-panel to emit load"
{
name: 'wait-for-element-event',
match: /^wait for( element)? (.+) to emit (.+)$/i,
run: async (browser, page, options, matches) => {
const selector = matches[2];
const eventType = matches[3];
try {
/* eslint-disable no-shadow, no-underscore-dangle */
await page.evaluate((selector, eventType) => {
const target = document.querySelector(selector);
if (!target) {
return Promise.reject(new Error('No element found'));
}
target.addEventListener(eventType, () => {
window._pa11yWaitForElementEventFired = true;
}, {
once: true
});
}, selector, eventType);
await page.waitForFunction(() => {
if (window._pa11yWaitForElementEventFired) {
delete window._pa11yWaitForElementEventFired;
return true;
}
return false;
}, {
polling: 200
});
/* eslint-enable no-shadow, no-underscore-dangle */
} catch (error) {
throw new Error(`Failed action: no element matching selector "${selector}"`);
}
}
}
];

@@ -5,2 +5,3 @@ 'use strict';

const extend = require('node.extend');
const inspect = require('util').inspect;
const path = require('path');

@@ -130,2 +131,9 @@ const pkg = require('../package.json');

// Listen for console logs on the page so that we can
// output them for debugging purposes
page.on('console', (...args) => {
const message = args.map(inspect).join(' ');
options.log.debug(`Browser Console: ${message}`);
});
// Navigate to the URL we're going to test

@@ -132,0 +140,0 @@ options.log.debug('Opening URL in Headless Chrome');

6

package.json
{
"name": "pa11y",
"version": "5.0.0-beta.1",
"version": "5.0.0-beta.2",
"description": "Pa11y is your automated accessibility testing pal",

@@ -39,3 +39,3 @@ "keywords": [

"pa11y-reporter-json": "^1.0.0",
"puppeteer": "^0.10.2",
"puppeteer": "^0.11.0",
"semver": "^5.4.1"

@@ -48,3 +48,3 @@ },

"nyc": "^10.1.2",
"pa11y-lint-config": "^1.2.0",
"pa11y-lint-config": "^1.2.1",
"proclaim": "^3.4.4",

@@ -51,0 +51,0 @@ "sinon": "^3.2.0"

@@ -35,6 +35,10 @@

💭 We'd like to find out how you use Pa11y and what you think about it. Please [fill in our survey][survey] to let us know your thoughts!
We're pleased to announce the Pa11y 5.0 beta is now available! We're switching from PhantomJS to Headless Chrome, as well as many other changes. See the [migration guide][migration-5] for further details.
✨ 🔜 ✨ The Pa11y team is very excited to announce plans for the successor to Pa11y Dashboard and Pa11y Webservice, codename "Sidekick". Help us define the features that you want to see by visiting the [proposal][sidekick-proposal]. ✨
If you'd like to try out the Pa11y 5.0 beta you can do so with
`npm install -g pa11y@beta`
Feedback is greatly appreciated 😊
---

@@ -624,5 +628,7 @@

'uncheck field #subscribe-to-marketing',
'screen capture example.png',
'wait for fragment to be #page-2',
'wait for path to not be /login',
'wait for url to be https://example.com/'
'wait for url to be https://example.com/',
'wait for #my-image to emit load'
]

@@ -672,2 +678,14 @@ });

### Screen Capture
This allows you to capture the screen between other actions, useful to verify that the page looks as you expect before the Pa11y test runs. This action takes the form `screen capture <file-path>`. E.g.
```js
pa11y('http://example.com/', {
actions: [
'screen capture example.png'
]
});
```
### Wait For Fragment/Path/URL

@@ -715,3 +733,16 @@

### Wait For Element Event
This allows you to pause the test until an element on the page (matching a CSS selector) emits an event. This will wait until Pa11y times out so it should be used after another action that would trigger the event. This action takes the form `wait for element <selector> to emit <event-type>`. E.g.
```js
pa11y('http://example.com/', {
actions: [
'click element #tab-2',
'wait for element #tab-panel-to to emit content-loaded'
]
});
```
Examples

@@ -805,3 +836,3 @@ --------

[brew]: http://mxcl.github.com/homebrew/
[htmlcs-wcag2aaa-ruleset]: https://github.com/squizlabs/HTML_CodeSniffer/blob/master/Standards/WCAG2AAA/ruleset.js
[migration-5]: https://github.com/pa11y/pa11y/blob/5.x/MIGRATION.md#migrating-from-40-to-50
[node]: http://nodejs.org/

@@ -816,3 +847,2 @@ [npm]: https://www.npmjs.com/

[sniff-issue]: https://github.com/squizlabs/HTML_CodeSniffer/issues/109
[survey]: https://goo.gl/forms/AiMDJR2IuaqX4iD03
[windows-install]: https://github.com/TooTallNate/node-gyp#installation

@@ -819,0 +849,0 @@

Sorry, the diff of this file is too big to display

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