2016-06-10 06:36:09 +02:00
|
|
|
const _ = require('lodash');
|
|
|
|
const visualRegression = require('../utilities/visual_regression');
|
|
|
|
|
2014-02-11 00:09:04 +01:00
|
|
|
module.exports = function (grunt) {
|
2016-06-22 01:59:43 +02:00
|
|
|
grunt.registerTask('test:visualRegression', [
|
|
|
|
'intern:visualRegression:takeScreenshots',
|
|
|
|
'test:visualRegression:buildGallery'
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:visualRegression:takeScreenshots', [
|
|
|
|
'clean:screenshots',
|
|
|
|
'intern:visualRegression'
|
|
|
|
]);
|
|
|
|
|
2016-06-10 06:36:09 +02:00
|
|
|
grunt.registerTask(
|
2016-06-22 01:59:43 +02:00
|
|
|
'test:visualRegression:buildGallery',
|
2016-06-10 06:36:09 +02:00
|
|
|
'Compare screenshots and generate diff images.',
|
|
|
|
function () {
|
|
|
|
const done = this.async();
|
|
|
|
visualRegression.run(done);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2015-09-11 01:44:56 +02:00
|
|
|
grunt.registerTask('test:server', [ 'esvm:test', 'simplemocha:all', 'esvm_shutdown:test' ]);
|
2015-08-18 23:51:31 +02:00
|
|
|
grunt.registerTask('test:browser', [ 'run:testServer', 'karma:unit' ]);
|
2015-08-25 02:10:21 +02:00
|
|
|
grunt.registerTask('test:coverage', [ 'run:testCoverageServer', 'karma:coverage' ]);
|
2015-08-18 23:51:31 +02:00
|
|
|
|
|
|
|
grunt.registerTask('test:quick', [
|
|
|
|
'test:server',
|
2015-09-09 17:12:45 +02:00
|
|
|
'test:ui',
|
2015-11-20 18:58:58 +01:00
|
|
|
'test:browser',
|
|
|
|
'test:api'
|
2015-08-18 23:51:31 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:dev', [
|
|
|
|
'run:devTestServer',
|
2015-08-19 00:36:00 +02:00
|
|
|
'karma:dev'
|
2015-08-18 23:51:31 +02:00
|
|
|
]);
|
|
|
|
|
2015-12-22 15:24:23 +01:00
|
|
|
grunt.registerTask('test:ui', [
|
2015-09-02 21:28:35 +02:00
|
|
|
'esvm:ui',
|
2015-09-02 21:56:07 +02:00
|
|
|
'run:testUIServer',
|
2016-06-13 23:03:40 +02:00
|
|
|
'run:chromeDriver',
|
2016-06-10 06:36:09 +02:00
|
|
|
'clean:screenshots',
|
2015-09-17 16:56:02 +02:00
|
|
|
'intern:dev',
|
|
|
|
'esvm_shutdown:ui',
|
2016-06-13 23:03:40 +02:00
|
|
|
'stop:chromeDriver',
|
2015-09-17 16:56:02 +02:00
|
|
|
'stop:testUIServer'
|
2015-09-02 21:07:20 +02:00
|
|
|
]);
|
|
|
|
|
2015-09-11 21:08:35 +02:00
|
|
|
grunt.registerTask('test:ui:server', [
|
|
|
|
'esvm:ui',
|
|
|
|
'run:testUIServer',
|
2016-06-13 23:03:40 +02:00
|
|
|
'run:devChromeDriver:keepalive'
|
2015-09-11 21:08:35 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:ui:runner', [
|
2016-06-10 06:36:09 +02:00
|
|
|
'clean:screenshots',
|
2015-09-11 21:08:35 +02:00
|
|
|
'intern:dev'
|
|
|
|
]);
|
|
|
|
|
2015-11-17 19:01:45 +01:00
|
|
|
grunt.registerTask('test:api', [
|
|
|
|
'esvm:ui',
|
|
|
|
'run:apiTestServer',
|
|
|
|
'intern:api',
|
|
|
|
'esvm_shutdown:ui',
|
|
|
|
'stop:apiTestServer'
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:api:server', [
|
|
|
|
'esvm:ui',
|
|
|
|
'run:apiTestServer:keepalive'
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:api:runner', [
|
|
|
|
'intern:api'
|
|
|
|
]);
|
|
|
|
|
2016-06-10 06:36:09 +02:00
|
|
|
grunt.registerTask('test', subTask => {
|
2015-08-18 23:51:31 +02:00
|
|
|
if (subTask) grunt.fail.fatal(`invalid task "test:${subTask}"`);
|
|
|
|
|
2015-07-28 02:13:45 +02:00
|
|
|
grunt.task.run(_.compact([
|
2015-08-19 22:13:16 +02:00
|
|
|
!grunt.option('quick') && 'eslint:source',
|
2016-05-02 18:55:55 +02:00
|
|
|
'licenses',
|
2016-06-22 01:59:43 +02:00
|
|
|
'test:quick'
|
2015-07-28 02:13:45 +02:00
|
|
|
]));
|
2014-09-20 00:41:25 +02:00
|
|
|
});
|
|
|
|
|
2015-08-18 23:51:31 +02:00
|
|
|
grunt.registerTask('quick-test', ['test:quick']); // historical alias
|
2014-02-24 23:14:31 +01:00
|
|
|
};
|