forked from pa11y/pa11y
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (28 loc) · 831 Bytes
/
index.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
29
30
31
32
33
34
// An example of executing some actions before Pa11y runs.
// This example logs in to a fictional site then waits
// until the account page has loaded before running Pa11y.
'use strict';
var pa11y = require('../..');
// Create a test instance with some default options
var test = pa11y({
// Log what's happening to the console
log: {
debug: console.log.bind(console),
error: console.error.bind(console),
info: console.log.bind(console)
},
// Run some actions before the tests
actions: [
'set field #username to exampleUser',
'set field #password to password1234',
'click element #submit',
'wait for url to be http://example.com/myaccount'
]
});
// Test http://example.com/
test.run('example.com', function(error, result) {
if (error) {
return console.error(error.message);
}
console.log(result);
});