Skip to content

Commit

Permalink
Bug #8, add .pa11yci.conf.js dynamic configuration [iet:10308781][c…
Browse files Browse the repository at this point in the history
…i skip]
  • Loading branch information
nfreear committed Mar 7, 2018
1 parent 11329cd commit 11f65a8
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ node_modules

phantomjs
rasterize.js
.pa11yci.json
/*.png

# End.
49 changes: 49 additions & 0 deletions .pa11yci.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*!
Pa11y-ci Configuration.
Dynamically generate a '.pa11yci' JSON config object, using an environment variable.
© Nick Freear, 07-March-2018.
https://gist.github.com/nfreear/cece86bf6d5d4d531bf0646417a868fb
https://github.com/pa11y/pa11y-ci
USAGE:
export TEST_SRV=https://example.edu/moodle
pa11y-ci -c .pa11yci.js
*/

// Was: const substitute = require('shellsubstitute');

var defaults = {
screenCapture: './_pa11y-screen-capture.png',
standard: 'WCAG2AA',
ignore: [ 'notice' ],
timeout: 5000,
wait: 1500
};

var urls = [
'${TEST_SRV}/course/?_ua=pa11y',
'${TEST_SRV}/auth/ouopenid/?_ua=pa11y',
'${TEST_SRV}/survey-end/?_ua=pa11y#!-Missing-param-error'
];

module.exports = (function my_pa11y_ci_config () {

console.error('Env:', process.env.TEST_SRV, process.env.MDL_SRV);

for (var idx = 0; idx < urls.length; idx++) {
urls[ idx ] = urls[ idx ].replace('${TEST_SRV}', process.env.TEST_SRV); // substitute(urls[ idx ]);
}

return {
defaults: defaults,
urls: urls
}
})();

/* {
"urls": [
"${MDL_SRV}/course/"
]
} */
13 changes: 5 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ php: 7
git:
depth: 8

before_install:
# "$ npm --version // ERROR: npm is known not to run on Node.js v4.4.7"
#- nvm install v4.4
- nvm install v8.1
- npm -v
# "$ npm --version // ERROR: npm is known not to run on Node.js v4.4.7"
before_install: nvm install v8.1

install:
- composer install
- composer npm-install

before_script:
#- composer eslint-config # Not needed!
- composer jshint-config
- composer write-ignore-xml
Expand All @@ -29,8 +28,6 @@ script:

after_script:
- ls -al
- npm run pa11y
- npm run pa11y-2
- npm run pa11y-3
- npm run pa11y-ci

# End.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[![Build status — Travis-CI][travis-icon]][travis]
[![js-semistandard-style][semi-icon]][semi]
[![OU-OpenID moodle plugin][browse-icon]][gh]
[![Accessibility testing][pa11y-icon]][pa11y-ci]


# moodle-auth_ouopenid
Expand Down Expand Up @@ -123,5 +124,8 @@ Developed for the [TeSLA project][].
[browse]: https://npmjs.com/package/browserify
[browse-icon]: https://img.shields.io/badge/built_with-browserify-blue.svg
"Built with browserify"
[pa11y-ci]: https://github.com/pa11y/pa11y-ci
"Automated accessibility testing - via 'pa11y-ci'"
[pa11y-icon]: https://img.shields.io/badge/accessibility-pa11y--ci-blue.svg
[End]: //.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"uncomment-cli": "https://github.com/nfreear/uncomment-cli.git#0.9.0"
},
"x-deps": {
"envify": "^4.1.0",
"shellsubstitute": "^1.2.0",
"eslint": "^4.3.0",
"eslint-plugin-react": "^7.1.0"
},
Expand All @@ -29,12 +31,9 @@
"uglify-2": "uglifyjs js/src/_comment.js dist.js --comments -co dist.min.js",
"uglify": "uglifyjs user/*.js --comments='/^!/' -bo ouop.min.js",
"less": "lessc style/*.less style/ouop-styles.css",
"pa11y-ci-demo": "source .env; pa11y-ci -c .pa11yci.conf.js # envify pa11yci.DIST.json",
"pa11y-ci": "pa11y-ci -c .pa11yci.conf.js",
"eslint": "eslint js/ js/src/ user/*.js && echo eslint OK!",
"export-env": "export MDL_SRV=https://example.edu/moodle",
"pa11y": "pa11y -s WCAG2AA -w 2000 ${MDL_SRV}/course/?_ua=pa11y",
"pa11y-2": "pa11y ${MDL_SRV}/auth/ouopenid/?_ua=pa11y",
"pa11y-3": "pa11y ${MDL_SRV}/survey-end/?_ua=pa11y#!-Missing-param-error",
"pa11y-ci": "pa11y-ci --config .pa11yci.json # Not in use.",
"semi": "semistandard"
},
"eslintConfig": {
Expand Down

0 comments on commit 11f65a8

Please sign in to comment.