Our automated accessibility testing is conducted using the Jenkins CI tool with the help of pa11y. Below is the Jenkinsfile used to execute these tests:
node('mypod') {
container('centos') {
def NODEJS_HOME
env.NODEJS_HOME = "${tool 'Node-12.0.0'}"
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
sh "'${env.NODEJS_HOME}'/bin/node --version"
sh "npm install -g pa11y --unsafe-perm"
sh "pa11y -V"
sh '''curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum -y install ./google-chrome-stable_current_*.rpm
yum -y install libXScrnSaver
yum -y install atk java-atk-wrapper at-spi2-atk gtk3 libXt'''
withCredentials([file(credentialsId: '***', variable: 'pa11yconfig')]) {
sh "cat $pa11yconfig > config.json"
sh "pa11y --config config.json --ignore WCAG2AA.Principle3.Guideline3_2.3_2_2.H32.2 --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G145.Fail --ignore WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail --threshold 6 --reporter cli https://$URL > results.json"
}
}
}
This setup allows us to run pa11y tests against a specified URL on a Linux-based node, as Windows can be more complicated. To facilitate browser launching, we utilize a config.json file for pa11y to operate effectively.
{
"chromeLaunchConfig": {
"args": [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-dev-shm-usage"
]
}
}
The current configuration works seamlessly for any given URL. However, we are looking to enhance the testing process by incorporating Actions provided by pa11y. How can the Actions code be integrated into the JSON configuration file to achieve this? More information about Actions can be found here: https://github.com/pa11y/pa11y#actions
Any assistance or recommendations on this matter would be highly appreciated!