Skip to content

Commit

Permalink
Merge pull request #1 from lpelypenko/lpelypenko-docs-1
Browse files Browse the repository at this point in the history
docs: improved example for runAxe()
  • Loading branch information
lpelypenko authored Oct 14, 2020
2 parents 91bf5f3 + f78f956 commit 05d86e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,21 @@ If you prefer to use a custom reporter for axe results you can get result object

```js
import { runAxe } from '@testcafe-community/axe';
import { createHtmlReport } from 'axe-html-reporter'; // example of custom html report for axe results

fixture `TestCafe tests with Axe`
.page `http://example.com`;

test('Automated accessibility testing', async t => {
const { error, results } = await runAxe(t);
// results constant contains full axe Results object (https://www.deque.com/axe/core-documentation/api-documentation/#results-object)
const { error, results } = await runAxe(); // "context" and "options" parameters are optional
// "results" constant contains full axe Results object (https://www.deque.com/axe/core-documentation/api-documentation/#results-object)
await t.expect(error).eql(null, `axe check failed with an error: ${error}`);
createHtmlReport({
violations: results.violations,
passes: results.passes,
incomplete: results.incomplete,
url: results.url,
projectKey: 'EXAMPLE',
}); // creates HTML report with the default file name `accessibilityReport.html`
});
```

0 comments on commit 05d86e6

Please sign in to comment.