Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Build: add accessibility testing #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ cache:
directories:
- node_modules
before_script:
- "export DISPLAY=:99.0"
- sh -e /etc/init.d/xvfb start - nohup bash -c
- npm install -g grunt-cli
script:
- "grunt"
2 changes: 1 addition & 1 deletion demos/typography.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Chassis - Typography</title>
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@
},
"dependencies": {},
"devDependencies": {
"grunt-axe-webdriver": "0.0.2",
"browser-perf": "1.2.3",
"chromedriver": "2.13.0",
"commitplease": "2.0.0",
"ejs-template": "0.1.0",
"grunt": "0.4.5",
"grunt-autoprefixer": "2.1.0",
"grunt-contrib-cssmin": "0.10.0",
"grunt-contrib-connect": "0.9.0",
"grunt-contrib-csslint": "0.4.0",
"grunt-contrib-cssmin": "0.10.0",
"grunt-contrib-jshint": "0.10.0",
"grunt-contrib-connect": "0.9.0",
"grunt-contrib-watch": "0.6.1",
"grunt-csscomb": "3.0.0",
"grunt-git-authors": "2.0.0",
Expand Down
4 changes: 3 additions & 1 deletion tasks/alias.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = function( grunt ) {
grunt.registerTask( "default", [ "test" ] );
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint" ] );
grunt.registerTask( "accessibility_all", [ "connect:accessibility", "axe-webdriver"])
grunt.registerTask( "accessibility", [ "connect:accessibility", "axe-webdriver:firefox"])
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint", "accessibility" ] );
grunt.registerTask( "build", [ "variables", "svg", "sass", "csscomb", "cssmin" ] );
grunt.registerTask( "perf", [
"start-selenium-server",
Expand Down
18 changes: 18 additions & 0 deletions tasks/options/axe-webdriver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = function( grunt ) {
return {
firefox: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only firefox? We do chrome and firefox for the performance testing id like to do the same here if possible

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chrome does not work on Travis. I could add a chrome target for use locally.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please. We use browserstack for cross browser testing on travis. Can axe-webdriver use browserstack? We don't run the performance stuff on browserstack because browserstack is not consistent enough for performance testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding chrome will crash travis ?. Maybe we could have two tests, one for travis and another with chrome to run locally.

options: {
threshold: 0
},
urls: ['http://localhost:4200/demos/typography.html'],
dest: 'tmp/gu.json'
},
chrome: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we want to remove chrome?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would we not want chrome?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The travis will crash otherwise. We should have a separate test that uses chrome, that test will not be a part of travis.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not be running this at all on travis directly it should be on browserstack.

options: {
threshold: 0,
browser: 'chrome'
},
urls: ['http://localhost:4200/demos/typography.html']
}
};
};
50 changes: 27 additions & 23 deletions tasks/options/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@ var template = require( "ejs-template" ),
module.exports = {
options: {
port: 4200,
base: ".",
middleware: [
template.middleware({ basedir: __dirname }),
function( req, res ) {
var data, i,
url = urlParser.parse( req.url, true ),
query = {},
parts = url.pathname.split( "/" ),
file = req.url.replace( /^\//, "" ).split( "?" )[ 0 ];
base: "."
},
perf: {
options: {
middleware: [
template.middleware({ basedir: __dirname }),
function( req, res ) {
var data, i,
url = urlParser.parse( req.url, true ),
query = {},
parts = url.pathname.split( "/" ),
file = req.url.replace( /^\//, "" ).split( "?" )[ 0 ];

for ( i = 1; i < parts.length; i += 2 ) {
query[ parts[ i ] ] = parts[ i + 1 ];
for ( i = 1; i < parts.length; i += 2 ) {
query[ parts[ i ] ] = parts[ i + 1 ];
}
if ( file.split( "." ).length <= 1 ) {
data = componentGenerator.generate(
query.framework,
query.component,
query.count
);
file = "../../performance/component.html";
}
res.endTemplate( file, data );
}
if ( file.split( "." ).length <= 1 ) {
data = componentGenerator.generate(
query.framework,
query.component,
query.count
);
file = "../../performance/component.html";
}
res.endTemplate( file, data );
}
]
]
}
},
perf: {},
accessibility: {},
dev: {
options: {
keepalive: true
Expand Down