nightwatch-accessibility v2.0.4
Nightwatch Accessibility
Nightwatch.js utility assertion for accessibility testing with aXe.
Install
npm install nightwatch-accessibilityUsage
Nightwatch >= 2.x
add nightwatch-accessibility to the plugins array
{
plugins: ['nightwatch-accessibility']
}Nightwatch \<= 1.x
{
custom_commands_path: ["./node_modules/nightwatch-accessibility/nightwatch/commands"],
custom_assertions_path: ["./node_modules/nightwatch-accessibility/nightwatch/assertions"]
}Use in your tests:
module.exports = {
'Test': function (browser) {
browser
// initiate aXe
.initAccessibility()
// execute accessibility check
.assert.accessibility('#app', {
verbose: true,
rules: {
'color-contrast': { enabled: false }
}
})
}
}API
browser.initAccessibility()
Injects the aXe library into the current test page.
browser.assert.accessibility(context, options)
Analyzes the defined context against applied aXe rules
| Name | Type | Default | Description |
|---|---|---|---|
context | String | 'html' | aXe Context Parameter |
options | Object | null | aXe Options Parameter |
In addition to the standard
options:
options.verboseset totruewill log all successfulaXetests.options.timeoutconfigures the nightwatch timeout, default value is500 millisecondsaXe: https://www.npmjs.com/package/axe-coreaXe Context: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#context-parameter
aXe Options: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#options-parameter
Author: Ahmad Nassri • Twitter: @AhmadNassri
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago