Compare commits

..

18 Commits
2.0.1 ... 2.1.1

Author SHA1 Message Date
Rowan Manning
5bc32fc68e Version 2.1.1 2016-11-20 18:56:21 +00:00
Frank van Gemeren
c2fbcf4fa1 Use arrows instead of plus and minus for collapsibles/expanders (#153) 2016-11-19 00:18:24 +00:00
Una Kravets
f60d1ca0ce more detailed 500 message (#159) 2016-11-19 00:17:34 +00:00
Rowan Manning
227de3638a Version 2.1.0 2016-11-07 15:03:19 +00:00
Rowan Manning
79c849d42b Use the latest Pa11y webservice 2016-11-07 14:58:15 +00:00
Rowan Manning
8195c5d2c5 Fix lint errors 2016-11-07 14:58:15 +00:00
Rowan Manning
568e068613 Parse task headers as HTTP headers rather than JSON 2016-11-07 14:58:15 +00:00
Rowan Manning
ee729d1d55 Write integration tests for hideElements and headers 2016-11-07 14:58:15 +00:00
Rowan Manning
509914d19a Fix the hideElements option
I broke this with my incorrect advice :D
2016-11-07 14:58:15 +00:00
Laura Carvajal
9df456c7c1 hide-elements and placeholders 2016-11-07 14:58:15 +00:00
Laura Carvajal
36dad55bb8 restore config filename 2016-11-07 14:58:15 +00:00
Laura Carvajal
39435f37e4 header and hide fields 2016-11-07 14:58:15 +00:00
Rowan Manning
c562bb07f3 Make optional fields optional (#154)
This fixes an issue that required people to manually specify a timeout
and wait for their tasks when they're created.
2016-11-07 14:06:12 +00:00
Frank van Gemeren
2976d5e391 Better client-side validation (#152) 2016-11-07 13:36:20 +00:00
Laura Carvajal
344efb9da3 allow for .js config 2016-10-20 14:15:55 +01:00
Hollie Kay
c2b1b1d1a1 Merge pull request #148 from pa11y/troubleshooting
add troubleshooting guide and link on the index page
2016-10-06 17:00:44 +01:00
hollsk
8c4517c830 put the links and refs the right way around 2016-10-06 17:12:50 +01:00
hollsk
40b6e79f81 add troubleshooting guide and link on the index page 2016-10-06 16:40:22 +01:00
16 changed files with 168 additions and 22 deletions

View File

@@ -1,6 +1,20 @@
# Changelog
## 2.1.1 (2016-11-20)
* Use arrows instead of plus and minus for collapsibles/expanders
* Supply more detailed 500 messages
## 2.1.0 (2016-11-07)
* Allow for configuration files to be JavaScript rather than JSON
* Allow setting of HTTP headers for task runs
* Allow hiding/ignoring elements for task runs
* Update dependencies and devDependencies
* pa11y-webservice: ~2.0.1 to ^2.1.2
* mocha: ^3 to ^2 (temporary tests weren't running)
## 2.0.1 (2016-09-12)
* Update dependencies and devDependencies

View File

@@ -58,6 +58,8 @@ NODE_ENV=development node index.js
See [development instructions](#development) for more information about running locally (and restarting automatically when files change).
If you run into problems, check the [troubleshooting guide][troubleshooting].
Configurations
--------------
@@ -148,11 +150,12 @@ Copyright © 20132016, Springer Nature
[sidekick-proposal]: https://github.com/pa11y/sidekick/blob/master/PROPOSAL.md
[travis]: https://travis-ci.org/pa11y/dashboard
[travis-img]: https://travis-ci.org/pa11y/dashboard.png?branch=master
[troubleshooting]: https://github.com/pa11y/dashboard/blob/master/TROUBLESHOOTING.md
[info-license]: LICENSE
[info-node]: package.json
[info-build]: https://travis-ci.org/pa11y/dashboard
[shield-license]: https://img.shields.io/badge/license-GPL%203.0-blue.svg
[shield-node]: https://img.shields.io/badge/node.js%20support-46-brightgreen.svg
[shield-version]: https://img.shields.io/badge/version-2.0.0-blue.svg
[shield-version]: https://img.shields.io/badge/version-2.1.1-blue.svg
[shield-build]: https://img.shields.io/travis/pa11y/dashboard/master.svg

27
TROUBLESHOOTING.md Normal file
View File

@@ -0,0 +1,27 @@
Troubleshooting
===============
Common issues
-----
* `500` errors or `Could not connect to pa11y-webservice` messages are often related to MongoDB. Ensure that you have the [latest version of MongoDB][mongo-install] installed, and that it's running - it doesn't always start automatically.
* Error messages saying that pa11y-webservice isn't running may be due to dependency installation problems. Try deleting your `pa11y-dashboard/node_modules` directory and running `npm install` again.
Check to see if the issue has been reported
-----
* Check the [issue tracker][issues] for similar issues.
Create an issue
-----
If all else fails, [create an issue][create-issue] and we'll help you. Please include your node.js, Phantom, and MongoDB version numbers, and your operating system.
[issues]: https://github.com/pa11y/dashboard/issues?utf8=%E2%9C%93&q=is%3Aissue
[mongo-install]: https://docs.mongodb.org/manual/installation/
[create-issue]: https://github.com/pa11y/dashboard/issues/new

View File

@@ -18,9 +18,12 @@
const fs = require('fs');
const environment = (process.env.NODE_ENV || 'development');
const jsonPath = `./config/${environment}.json`;
const jsPath = `./config/${environment}.js`;
if (fs.existsSync(jsonPath)) {
module.exports = require(jsonPath);
} else if (fs.existsSync(jsPath)) {
module.exports = require(jsPath);
} else {
module.exports = {
port: Number(env('PORT', '4000')),

View File

@@ -1,6 +1,6 @@
{
"name": "pa11y-dashboard",
"version": "2.0.1",
"version": "2.1.1",
"private": true,
"description": "Pa11y Dashboard is a visual web interface to the Pa11y accessibility reporter",
@@ -27,8 +27,9 @@
"compression": "~1.6",
"express": "~4.14",
"express-hbs": "~1.0",
"http-headers": "^3.0.1",
"moment": "~2.13",
"pa11y-webservice": "^2.0.1",
"pa11y-webservice": "^2.1.2",
"pa11y-webservice-client-node": "^1.2.1",
"underscore": "~1.8"
},
@@ -38,7 +39,7 @@
"jscs": "^2",
"jshint": "^2",
"less": "~2.7",
"mocha": "^3",
"mocha": "^2",
"proclaim": "^3",
"request": "^2.74",
"uglify-js": "~2.6"

View File

@@ -77,11 +77,11 @@ $(document).ready(function(){
expandLink.click( function(){
$(this).next().slideToggle('slow', function(){});
if ($(this).hasClass('showing')) {
$(this).find('span.expander').html('+');
$(this).find('span.expander').html('');
$(this).attr('aria-expanded', false);
}
else {
$(this).find('span.expander').html('-');
$(this).find('span.expander').html('');
$(this).attr('aria-expanded', true);
}
$(this).toggleClass('showing');

File diff suppressed because one or more lines are too long

View File

@@ -13,9 +13,12 @@
// You should have received a copy of the GNU General Public License
// along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
/*jshint maxcomplexity:10*/
'use strict';
const getStandards = require('../data/standards');
const httpHeaders = require('http-headers');
module.exports = route;
@@ -36,16 +39,26 @@ function route(app) {
});
app.express.post('/new', (req, res) => {
let parsedHeaders;
if (req.body.headers) {
parsedHeaders = httpHeaders(req.body.headers, true);
}
console.log(parsedHeaders);
const newTask = {
name: req.body.name,
url: req.body.url,
standard: req.body.standard,
ignore: req.body.ignore || [],
timeout: req.body.timeout,
wait: req.body.wait,
username: req.body.username,
password: req.body.password
timeout: req.body.timeout || undefined,
wait: req.body.wait || undefined,
username: req.body.username || undefined,
password: req.body.password || undefined,
headers: parsedHeaders,
hideElements: req.body.hideElements || undefined
};
app.webservice.tasks.create(newTask, (err, task) => {
if (err) {
const standards = getStandards().map(standard => {

View File

@@ -13,10 +13,13 @@
// You should have received a copy of the GNU General Public License
// along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
/*jshint maxcomplexity:10*/
'use strict';
const presentTask = require('../../view/presenter/task');
const getStandards = require('../../data/standards');
const httpHeaders = require('http-headers');
module.exports = route;
@@ -54,7 +57,14 @@ function route(app) {
if (err) {
return next();
}
const originalHeaders = req.body.headers;
req.body.ignore = req.body.ignore || [];
req.body.timeout = req.body.timeout || undefined;
req.body.wait = req.body.wait || undefined;
req.body.username = req.body.username || undefined;
req.body.password = req.body.password || undefined;
req.body.hideElements = req.body.hideElements || undefined;
req.body.headers = httpHeaders(req.body.headers || '', true);
app.webservice.task(req.params.id).edit(req.body, err => {
if (err) {
task.name = req.body.name;
@@ -63,6 +73,8 @@ function route(app) {
task.wait = req.body.wait;
task.username = req.body.username;
task.password = req.body.password;
task.headers = originalHeaders;
task.hideElements = req.body.hideElements;
const standards = getStandards().map(standard => {
if (standard.title === task.standard) {
standard.selected = true;

View File

@@ -96,6 +96,18 @@ describe('GET /new', function() {
assert.notStrictEqual(fields.length, 0);
});
it('should have a "hideElements" field', function() {
const field = this.form.find('input[name=hideElements]').eq(0);
assert.isDefined(field);
assert.strictEqual(field.attr('type'), 'text');
assert.strictEqual(field.attr('value'), '');
});
it('should have a "headers" field', function() {
const field = this.form.find('textarea[name=headers]').eq(0);
assert.isDefined(field);
});
});
});

View File

@@ -91,6 +91,18 @@ describe('GET /<task-id>/edit', function() {
assert.strictEqual(field.attr('value'), 'access');
});
it('should have a "hideElements" field', function() {
const field = this.form.find('input[name=hideElements]').eq(0);
assert.isDefined(field);
assert.strictEqual(field.attr('type'), 'text');
assert.strictEqual(field.attr('value'), '');
});
it('should have a "headers" field', function() {
const field = this.form.find('textarea[name=headers]').eq(0);
assert.isDefined(field);
});
it('should have "ignore" fields', function() {
const fields = this.form.find('input[name="ignore[]"]');
assert.isDefined(fields);

View File

@@ -15,9 +15,13 @@ You should have received a copy of the GNU General Public License
along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
}}
<div class="col-md-8">
<h1>Eeek! 500 error. This is serious.</h1>
<p class="h2">There isn't much you can do about this.</h2>
<p class="h4">Give it another go or try the <a href="/">home page</a>.</h4>
<h1>Eeek! 500 error.</h1>
<p class="h2">Let's see what we can do here:</h2>
<ul>
<li>Do you have <a href="https://www.mongodb.com/">MongoDB</a> installed and <code>mongod</code> running?</li>
<li>Check out the <a href="https://github.com/pa11y/dashboard/blob/master/TROUBLESHOOTING.md">Troubleshooting doc</a> for more information.</li>
<li>Search for a related <a href="https://github.com/pa11y/dashboard/issues">Github issue</a>, or open one yourself.</li>
</ul>
{{#if error}}
<h2>Stack-Trace</h2>
<pre>{{error.stack}}</pre>

View File

@@ -38,7 +38,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-10">
<label class="control-label" for="new-task-name">Name</label>
<input class="form-control" id="new-task-name" type="text" placeholder="E.g. My Home Page" name="name" value="{{task.name}}"/>
<input class="form-control" id="new-task-name" type="text" required placeholder="E.g. My Home Page" name="name" value="{{task.name}}"/>
</div>
</div>
</div>
@@ -47,7 +47,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-10">
<label class="control-label" for="new-task-url">URL</label>
<input class="form-control" id="new-task-url" type="url" placeholder="E.g. http://mysite.com/" name="url" value="{{task.url}}"/>
<input class="form-control" id="new-task-url" type="url" required pattern="https?:\/\/.+" placeholder="E.g. http://mysite.com/" name="url" value="{{task.url}}"/>
</div>
</div>
</div>
@@ -102,6 +102,25 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
</div>
</div>
<div class="form-group clearfix">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="control-label" for="new-task-headers">HTTP Headers</label>
<textarea class="form-control" id="new-task-headers" name="headers" placeholder="Cookie: foo=bar">{{task.headers}}</textarea>
<em>(As key/value pairs, separated by newlines/colons)</em>
</div>
</div>
</div>
<div class="form-group clearfix">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="control-label" for="new-task-hide-elements">Hide Elements</label>
<input class="form-control" id="new-task-hide-elements" type="text" name="hideElements" value="{{task.hideElements}}" placeholder=".advert, #modal, div[aria-role=presentation]"/> <em>(CSS selector)</em>
</div>
</div>
</div>
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
<div class="standards-lists">

View File

@@ -73,7 +73,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
<div class="col-md-9" data-role="expandable-results" role="main">
{{#if mainResult.count.error}}
<div class="heading label-danger pointer showing first" id="errors" data-test="task-errors" data-role="expander" role="button" tabindex="0" aria-expanded="true" aria-controls="errors-list">
<span class="pull-right expander"> - <span class="hide">(close panel)</span></span>
<span class="pull-right expander"> <span class="hide">(close panel)</span></span>
Errors ( {{mainResult.count.error}} )
</div>
<div class="task-danger tasks-list collapse clearfix in" id="errors-list">
@@ -109,7 +109,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
{{#if mainResult.count.warning}}
<div class="heading label-warning pointer" id="warnings" data-test="task-warnings" data-role="expander" role="button" tabindex="0" aria-expanded="false" aria-controls="warnings-list">
<span class="pull-right expander"> + <span class="hide">(open panel)</span></span>
<span class="pull-right expander"> <span class="hide">(open panel)</span></span>
Warnings ( {{mainResult.count.warning}} )
</div>
<div class="task-warning tasks-list collapse clearfix" id="warnings-list">
@@ -145,7 +145,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
{{#if mainResult.count.notice}}
<div class="heading label-info pointer" id="notices" data-test="task-notices" data-role="expander" role="button" tabindex="0" aria-expanded="false" aria-controls="notices-list">
<span class="pull-right expander"> + <span class="hide">(open panel)</span></span>
<span class="pull-right expander"> <span class="hide">(open panel)</span></span>
Notices ( {{mainResult.count.notice}} )
</div>
<div class="task-info tasks-list collapse clearfix" id="notices-list">
@@ -180,7 +180,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
{{#if mainResult.ignore.length}}
<div class="heading label-default pointer" id="ignore" data-role="expander" role="button" tabindex="0" aria-expanded="false" aria-controls="ignore-list">
<span class="pull-right expander"> + <span class="hide">(open panel)</span></span>
<span class="pull-right expander"> <span class="hide">(open panel)</span></span>
Ignored Rules ( {{mainResult.ignore.length}} )
</div>
<div class="task-default tasks-list collapse clearfix" id="ignore-list">

View File

@@ -35,6 +35,13 @@ function presentTask(task) {
// Enhance the ignored rules
task.ignore = presentIgnoreRules(task.ignore);
// Change headers to a string format
if (task.headers && typeof task.headers === 'object') {
task.headers = Object.keys(task.headers).map(header => {
return `${header}: ${task.headers[header]}`;
}).join('\n');
}
// Present the last result if present
if (task.last_result) {
task.lastResult = presentResult(task.last_result);

View File

@@ -50,7 +50,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-10">
<label class="control-label" for="new-task-name">Name</label>
<input class="form-control" id="new-task-name" type="text" placeholder="E.g. My Home Page" name="name" value="{{task.name}}"/>
<input class="form-control" id="new-task-name" type="text" required placeholder="E.g. My Home Page" name="name" value="{{task.name}}"/>
</div>
</div>
</div>
@@ -59,7 +59,7 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-10">
<label class="control-label" for="new-task-url">URL</label>
<input class="form-control" id="new-task-url" type="url" placeholder="E.g. http://mysite.com/" name="url" value="{{task.url}}" disabled/>
<input class="form-control" id="new-task-url" type="url" required pattern="https?:\/\/.+" placeholder="E.g. http://mysite.com/" name="url" value="{{task.url}}" disabled/>
</div>
</div>
</div>
@@ -114,6 +114,25 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
</div>
</div>
<div class="form-group clearfix">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="control-label" for="new-task-headers">HTTP Headers</label>
<textarea class="form-control" id="new-task-headers" name="headers" placeholder="Cookie: foo=bar">{{task.headers}}</textarea>
<em>(As key/value pairs, separated by newlines/colons)</em>
</div>
</div>
</div>
<div class="form-group clearfix">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6">
<label class="control-label" for="new-task-hide-elements">Hide Elements</label>
<input class="form-control" id="new-task-hide-elements" type="text" name="hideElements" value="{{task.hideElements}}" placeholder=".advert, #modal, div[aria-role=presentation]"/> <em>(CSS selector)</em>
</div>
</div>
</div>
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
<div class="standards-lists">