Created
March 16, 2017 10:47
-
-
Save rowanmanning/bcd93ba305e561b75340596183847a07 to your computer and use it in GitHub Desktop.
Pa11y Actions GitHub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example of executing some actions before Pa11y runs. | |
// This example logs in to GitHub and runs tests on the | |
// user dashboard page. Note: this won't work if you have | |
// two-factor auth enabled. | |
'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: [ | |
'click element .site-header-menu a[href=/login]', | |
'wait for url to be https://github.com/login', | |
'set field #login_field to <YOUR-GITHUB-USERNAME>', | |
'set field #password to <YOUR-GITHUB-PASSWORD>', | |
'click element input[type=submit]', | |
'wait for url to be https://github.com/' | |
] | |
}); | |
// Test http://example.com/ | |
test.run('https://github.com/', function(error, result) { | |
if (error) { | |
return console.error(error.message); | |
} | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been looking for documentation for pa11y for node but I can't find much.
I have actions running now, but I can't find a reference for what is possible with them. All examples use #username which would suggest an id="" attribute. What about class="" or name="" ? I've tried using .classname but that does not seem to work or leaving the # absent.