mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-25 06:41:21 +00:00
Build a basic framework for functional testing
This commit is contained in:
26
test/functional/setup.js
Normal file
26
test/functional/setup.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/* global before */
|
||||
/* jshint maxlen: 200 */
|
||||
'use strict';
|
||||
|
||||
var config = require('../../config/test.json');
|
||||
var createNavigator = require('./helper/navigate');
|
||||
var request = require('request');
|
||||
|
||||
// Run before all tests
|
||||
before(function (done) {
|
||||
this.baseUrl = 'http://localhost:' + config.port;
|
||||
this.last = {};
|
||||
this.navigate = createNavigator(this.baseUrl, this.last);
|
||||
assertTestAppIsRunning(this.baseUrl, done);
|
||||
});
|
||||
|
||||
// Check that the test application is running, and exit if not
|
||||
function assertTestAppIsRunning (url, done) {
|
||||
request(url, function (err) {
|
||||
if (err) {
|
||||
console.error('Error: Test app not started; run with `grunt start-test`');
|
||||
process.exit(1);
|
||||
}
|
||||
done();
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user