Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.5 to 5.0.0-beta.6

7

CHANGELOG.md
# Changelog
## 5.0.0-beta.6 pre-release (2018-01-16)
* Add the `navigate-url` action
* Correct documentation on `isValidAction`
* Update dependencies
* puppeteer: ^0.13.0 to ^1.0.0
## 5.0.0-beta.5 pre-release (2017-12-11)

@@ -5,0 +12,0 @@

@@ -51,2 +51,17 @@ 'use strict';

// Action to navigate to a url
// E.g. "navigate to http://pa11y.org"
{
name: 'navigate-url',
match: /^navigate to( url)? (.+)$/i,
run: async (browser, page, options, matches) => {
const navigateTo = matches[2];
try {
await page.goto(navigateTo);
} catch (error) {
throw new Error(`Failed action: Could not navigate to "${navigateTo}"`);
}
}
},
// Action to click an element

@@ -53,0 +68,0 @@ // E.g. "click .sign-in-button"

4

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

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

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

@@ -42,0 +42,0 @@ },

@@ -338,4 +338,4 @@

```js
pa11y.validateAction('click element #submit'); // true
pa11y.validateAction('open the pod bay doors'); // false
pa11y.isValidAction('click element #submit'); // true
pa11y.isValidAction('open the pod bay doors'); // false
```

@@ -672,3 +672,4 @@

'wait for url to be https://example.com/',
'wait for #my-image to emit load'
'wait for #my-image to emit load',
'navigate to https://another-example.com/'
]

@@ -785,3 +786,15 @@ });

### Navigate To URL
This action allows you to navigate to a new URL if, for example, the URL is inaccessible using other methods. This action takes the form `navigate to <url>`. E.g.
```js
pa11y('http://example.com/', {
actions: [
'navigate to http://another-example.com'
]
});
```
Examples

@@ -788,0 +801,0 @@ --------

@@ -134,2 +134,74 @@ 'use strict';

describe('navigate-url action', () => {
let action;
beforeEach(() => {
action = runAction.actions.find(foundAction => {
return foundAction.name === 'navigate-url';
});
});
it('has a name property', () => {
assert.strictEqual(action.name, 'navigate-url');
});
it('has a match property', () => {
assert.instanceOf(action.match, RegExp);
});
describe('.match', () => {
it('matches all of the expected action strings', () => {
assert.deepEqual('navigate to http://pa11y.org'.match(action.match), [
'navigate to http://pa11y.org',
undefined,
'http://pa11y.org'
]);
});
});
it('has a `run` method', () => {
assert.isFunction(action.run);
});
describe('.run(browser, page, options, matches)', () => {
let matches;
let resolvedValue;
beforeEach(async () => {
matches = 'navigate to http://pa11y.org'.match(action.match);
resolvedValue = await action.run(puppeteer.mockBrowser, puppeteer.mockPage, {}, matches);
});
it('clicks the specified element on the page', () => {
assert.calledOnce(puppeteer.mockPage.goto);
assert.calledWithExactly(puppeteer.mockPage.goto, matches[2]);
});
it('resolves with `undefined`', () => {
assert.isUndefined(resolvedValue);
});
describe('when the click fails', () => {
let navigateError;
let rejectedError;
beforeEach(async () => {
navigateError = new Error('navigate to error');
puppeteer.mockPage.goto.rejects(navigateError);
try {
await action.run(puppeteer.mockBrowser, puppeteer.mockPage, {}, matches);
} catch (error) {
rejectedError = error;
}
});
it('rejects with a new error', () => {
assert.notStrictEqual(rejectedError, navigateError);
assert.instanceOf(rejectedError, Error);
assert.strictEqual(rejectedError.message, 'Failed action: Could not navigate to "http://pa11y.org"');
});
});
});
});
describe('click-element action', () => {

@@ -136,0 +208,0 @@ let action;

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