-
Notifications
You must be signed in to change notification settings - Fork 8
/
axe.js
28 lines (25 loc) · 896 Bytes
/
axe.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// load the axe-core script
const axeSource = require('axe-core').source;
const assert = require('assert');
describe('axe test', function () {
it('should return results', function () {
browser.url('./');
// inject the script
browser.execute(axeSource);
// browser.debug();
var theOptions;
theOptions = {runOnly: {type: "rule", values: ['link-name']}};
// run inside browser and get results
let results = browser.executeAsync(function (options, done) {
axe.run(options, function (err, results) {
if (err) done(err);
done(results);
});
}, theOptions);
// assert there are no violations
console.log(results.value, 'values')
console.log(results.value.violations, 'vol')
console.log(results.value.violations.length, 'len')
assert.equal(results.value.violations.length, 0, 'Expected no a11y violations');
})
})