mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-26 15:21:28 +00:00
Reload fixtures for tests and finish testing home
This commit is contained in:
@@ -36,7 +36,7 @@ module.exports = function (grunt) {
|
|||||||
|
|
||||||
mochaTest: {
|
mochaTest: {
|
||||||
functional: {
|
functional: {
|
||||||
src: ['test/functional/*.js'],
|
src: ['test/functional/**/*.js'],
|
||||||
options: {
|
options: {
|
||||||
reporter: 'spec'
|
reporter: 'spec'
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* global beforeEach, describe, it */
|
/* global beforeEach, describe, it */
|
||||||
/* jshint maxlen: 200, maxstatements: 20 */
|
/* jshint maxlen: false, maxstatements: false */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var assert = require('proclaim');
|
var assert = require('proclaim');
|
||||||
@@ -26,6 +26,34 @@ describe('GET /', function () {
|
|||||||
assert.strictEqual(elem[0].getAttribute('href'), '/new');
|
assert.strictEqual(elem[0].getAttribute('href'), '/new');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should display all of the expected tasks', function () {
|
||||||
|
var tasks = this.last.dom.querySelectorAll('[data-test=task]');
|
||||||
|
assert.strictEqual(tasks.length, 3);
|
||||||
|
assert.match(tasks[0].textContent, /npg home\s+\(wcag2aa\)/i);
|
||||||
|
assert.match(tasks[1].textContent, /npg home\s+\(wcag2aaa\)/i);
|
||||||
|
assert.match(tasks[2].textContent, /nature news\s+\(section508\)/i);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have links to each task', function () {
|
||||||
|
var tasks = this.last.dom.querySelectorAll('[data-test=task]');
|
||||||
|
assert.strictEqual(tasks.length, 3);
|
||||||
|
assert.strictEqual(tasks[0].querySelectorAll('[href="/abc000000000000000000001"]').length, 1);
|
||||||
|
assert.strictEqual(tasks[1].querySelectorAll('[href="/abc000000000000000000002"]').length, 1);
|
||||||
|
assert.strictEqual(tasks[2].querySelectorAll('[href="/abc000000000000000000003"]').length, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display the task result counts if the task has been run', function () {
|
||||||
|
var tasks = this.last.dom.querySelectorAll('[data-test=task]');
|
||||||
|
assert.match(tasks[0].textContent, /1\s*errors/i);
|
||||||
|
assert.match(tasks[0].textContent, /2\s*warnings/i);
|
||||||
|
assert.match(tasks[0].textContent, /3\s*notices/i);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a message indicating that there are no results if the task has not been run', function () {
|
||||||
|
var tasks = this.last.dom.querySelectorAll('[data-test=task]');
|
||||||
|
assert.match(tasks[2].textContent, /no results/i);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
/* global before */
|
/* global afterEach, before */
|
||||||
/* jshint maxlen: 200 */
|
/* jshint maxlen: false, maxstatements: false */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var config = require('../../config/test.json');
|
var config = require('../../config/test.json');
|
||||||
var createNavigator = require('./helper/navigate');
|
var createNavigator = require('./helper/navigate');
|
||||||
|
var loadFixtures = require('pa11y-webservice/data/fixture/load');
|
||||||
var request = require('request');
|
var request = require('request');
|
||||||
|
|
||||||
// Run before all tests
|
// Run before all tests
|
||||||
@@ -11,7 +12,14 @@ before(function (done) {
|
|||||||
this.baseUrl = 'http://localhost:' + config.port;
|
this.baseUrl = 'http://localhost:' + config.port;
|
||||||
this.last = {};
|
this.last = {};
|
||||||
this.navigate = createNavigator(this.baseUrl, this.last);
|
this.navigate = createNavigator(this.baseUrl, this.last);
|
||||||
assertTestAppIsRunning(this.baseUrl, done);
|
assertTestAppIsRunning(this.baseUrl, function () {
|
||||||
|
loadFixtures('test', config.webservice, done);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Run after each test
|
||||||
|
afterEach(function (done) {
|
||||||
|
loadFixtures('test', config.webservice, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check that the test application is running, and exit if not
|
// Check that the test application is running, and exit if not
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{#each tasks}}
|
{{#each tasks}}
|
||||||
<li class="col-md-4 col-sm-6 task-card">
|
<li class="col-md-4 col-sm-6 task-card" data-test="task">
|
||||||
<a class="well task-card-link crunch-bottom" title="Details for URL {{simplify-url url}}" href="{{href}}">
|
<a class="well task-card-link crunch-bottom" title="Details for URL {{simplify-url url}}" href="{{href}}">
|
||||||
<p class="h3">{{name}}</p>
|
<p class="h3">{{name}}</p>
|
||||||
<p class="h5">({{standard}})</p>
|
<p class="h5">({{standard}})</p>
|
||||||
|
Reference in New Issue
Block a user