diff --git a/.gitignore b/.gitignore index 82df92a..86957fc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,6 @@ node_modules phantomjs rasterize.js -.pa11yci.json +/*.png # End. diff --git a/.pa11yci.conf.js b/.pa11yci.conf.js new file mode 100644 index 0000000..a757a39 --- /dev/null +++ b/.pa11yci.conf.js @@ -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/" + ] +} */ diff --git a/.travis.yml b/.travis.yml index 380d4cd..d22f16d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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. diff --git a/README.md b/README.md index c3939ba..8d50c9f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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]: //. diff --git a/package.json b/package.json index b8b842d..2795864 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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": {