Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
BREAKING CHANGE: new paths for command & assertion
  • Loading branch information
Ahmad Nassri committed Dec 19, 2022
1 parent 8327960 commit 0c69a1d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ Nightwatch.js utility assertion for accessibility testing with aXe.
npm install nightwatch-accessibility
```

## Usage
## Usage (Nightwatch \>= 2.x)

Update your nightwatch config:
add `nightwatch-accessibility` to the plugins array

``` js
{
custom_commands_path: ["./node_modules/nightwatch-accessibility/commands"],
custom_assertions_path: ["./node_modules/nightwatch-accessibility/assertions"]
plugins: ['nightwatch-accessibility']
}

## Usage (Nightwatch <= 1.x)

```js
{
custom_commands_path: ["./node_modules/nightwatch-accessibility/nightwatch/commands"],
custom_assertions_path: ["./node_modules/nightwatch-accessibility/nightwatch/assertions"]
}
```

Expand All @@ -29,14 +36,16 @@ Use in your tests:
module.exports = {
'Test': function (browser) {
browser
.initAccessibility()
// initiate aXe
.initAccessibility()
// execute accessibility check
.assert.accessibility('#app', {
verbose: true,
rules: {
'color-contrast': { enabled: false }
}
})
.end()
}
}
```
Expand All @@ -58,8 +67,8 @@ Analyzes the defined `context` against applied `aXe` rules

> In addition to the standard `options`:

- `options.verbose` set to `true` will log all successful `aXe` tests.
- `options.timeout` configures the nightwatch timeout, default value is `500 milliseconds`
- `options.verbose` set to `true` will log all successful `aXe` tests.
- `options.timeout` configures the nightwatch timeout, default value is `500 milliseconds`

[`aXe`]: https://www.npmjs.com/package/axe-core
[aXe Context]: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#context-parameter
Expand Down
21 changes: 15 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
npm install nightwatch-accessibility
```

## Usage
## Usage (Nightwatch >= 2.x)

Update your nightwatch config:
add `nightwatch-accessibility` to the plugins array

```js
{
custom_commands_path: ["./node_modules/nightwatch-accessibility/commands"],
custom_assertions_path: ["./node_modules/nightwatch-accessibility/assertions"]
plugins: ['nightwatch-accessibility']
}

## Usage (Nightwatch <= 1.x)

```js
{
custom_commands_path: ["./node_modules/nightwatch-accessibility/nightwatch/commands"],
custom_assertions_path: ["./node_modules/nightwatch-accessibility/nightwatch/assertions"]
}
```

Expand All @@ -22,14 +29,16 @@ Use in your tests:
module.exports = {
'Test': function (browser) {
browser
.initAccessibility()
// initiate aXe
.initAccessibility()
// execute accessibility check
.assert.accessibility('#app', {
verbose: true,
rules: {
'color-contrast': { enabled: false }
}
})
.end()
}
}
```
Expand Down

0 comments on commit 0c69a1d

Please sign in to comment.