bbc / a11y-tests-web Goto Github PK
View Code? Open in Web Editor NEWRuns automated accessibility tests against configurable lists of webpages
License: Other
Runs automated accessibility tests against configurable lists of webpages
License: Other
It would be good to be able to install a11y-tests-web as a node script from npm.
npm run coverage
results in a failing test on branch master
Tests should pass
output from npm run coverage
is:
1) bbcA11y build() Paths and baseUrl and visit and options outputs the basic config for the paths, with the defined baseUrl, and with the visit function:
AssertError: expected writeFileSync to be called with arguments
a11y.js
page(
"http://base.url/path/1",
{
visit: function (){/* Do something */cov_17hr8di7tb.f[0]++;},
"some":"option"
}
)
page(
"http://base.url/path/2",
{
visit: function (){/* Do something */cov_17hr8di7tb.f[0]++;},
"some":"option"
}
)
match()
at Object.fail (node_modules/sinon/lib/sinon/assert.js:96:21)
at failAssertion (node_modules/sinon/lib/sinon/assert.js:55:16)
at Object.assert.(anonymous function) [as calledWith] (node_modules/sinon/lib/sinon/assert.js:80:13)
at Context.it (test/lib/bbcA11y.js:175:24)
Need to update the package.json file to use the latest version of lighthouse
Lighthouse version should be latest
a11y-tests-web uses lighthouse v2.7.0 - see here https://github.com/bbc/a11y-tests-web/blob/master/package.json#L27
We should update to use the latest version of lighthouse
Running npm audit
today gives found 62 vulnerabilities (24 low, 3 moderate, 33 high, 2 critical) in 1921 scanned packages
. We should fix as many of these as possible.
Google Lighthouse job needs a pretty output option as at the moment, the only option is junit which isn't very human readable.
bbc-a11y v2.0.0 is currently in pre-release.
Once it's released, this project should be updated to work with v2.0.0
Work for this has been started on the update-to-bbc-a11y-v2 branch
If you are testing a URL with and without some pre-test steps, the JUnit results have no way of distinguishing these results.
npm run start:lighthouse:junit-headless
sometimes hangs and doesn't exit
npm run start:lighthouse:junit-headless
will finish successfully or unsuccessfully and exit every time.
npm run start:lighthouse:junit-headless
sometimes hangs and doesn't exit
Might be fixed by #26
Seen on our Jenkins and on some Macbooks
The visit
option in options
does not work on in a11y-tests-web.
Assuming a minimal config where are not using signedInPaths
:
module.exports = {
options: {
visit: function (frame) {
/* code */
},
hide: [],
skip: []
},
baseUrl: 'http://localhost:3000',
paths: [ '/' ],
signedInPaths: [ ]
};
The visit
option works in bbc-a11y but does not work in a11-tests-web. It would be great to have this because we would like to inject a script to wait for the page to fully render.
The output sent to bbc-a11y would ideally be like this:
page( "http://localhost:3000/", { "hide":[],"skip":[], "visit": function() { ... } })
The visit option is currently not getting passed to bbc-a11y. This is because a JSON.stringify
is stripping out the function. The built-in behaviour of JSON.stringify is to remove functions:
If undefined, a Function, or a Symbol is encountered during conversion it is either omitted (when it is found in an object) or censored to null (when it is found in an array).
The output sent to bbc-a11y currently looks like:
page( "http://localhost:3000/", { "hide":[],"skip":[] })
There's probably a nicer way, but this, for example, seems to fix the problem:
return `
page(
"${baseUrl}${path}",
{
${visitOptions}
+ visit: ${options.visit.toString()},
${JSON.stringify(options).slice(1, -1)}
}
)
`;
We make a change to what pathToOutput
returns โ we explicitly take the function body of options.visit
and convert it to a string, outside of the JSON.stringify
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.