2016-09-02 00:02:43 +02:00
|
|
|
import _, { keys } from 'lodash';
|
2016-11-16 01:11:03 +01:00
|
|
|
|
2017-06-06 19:11:59 +02:00
|
|
|
import { run } from '../utilities/visual_regression';
|
2016-06-10 06:36:09 +02:00
|
|
|
|
2014-02-11 00:09:04 +01:00
|
|
|
module.exports = function (grunt) {
|
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();
|
2017-06-06 19:11:59 +02:00
|
|
|
run(done);
|
2016-06-10 06:36:09 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2016-11-16 01:11:03 +01:00
|
|
|
grunt.registerTask('test:server', [
|
|
|
|
'checkPlugins',
|
|
|
|
'simplemocha:all',
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:browser', [
|
|
|
|
'checkPlugins',
|
|
|
|
'run:testServer',
|
|
|
|
'karma:unit',
|
|
|
|
]);
|
|
|
|
|
2016-09-02 00:02:43 +02:00
|
|
|
grunt.registerTask('test:browser-ci', () => {
|
|
|
|
const ciShardTasks = keys(grunt.config.get('karma'))
|
|
|
|
.filter(key => key.startsWith('ciShard-'))
|
|
|
|
.map(key => `karma:${key}`);
|
|
|
|
|
|
|
|
grunt.log.ok(`Running UI tests in ${ciShardTasks.length} shards`);
|
|
|
|
|
|
|
|
grunt.task.run([
|
|
|
|
'run:testServer',
|
|
|
|
...ciShardTasks
|
|
|
|
]);
|
|
|
|
});
|
2016-11-16 01:11:03 +01:00
|
|
|
|
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',
|
2017-04-06 03:24:01 +02:00
|
|
|
'test:jest',
|
2015-11-20 18:58:58 +01:00
|
|
|
'test:browser',
|
|
|
|
'test:api'
|
2015-08-18 23:51:31 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:dev', [
|
2016-11-16 01:11:03 +01:00
|
|
|
'checkPlugins',
|
2015-08-18 23:51:31 +02:00
|
|
|
'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', [
|
2016-11-16 01:11:03 +01:00
|
|
|
'checkPlugins',
|
2015-09-02 21:28:35 +02:00
|
|
|
'esvm:ui',
|
2015-09-02 21:56:07 +02:00
|
|
|
'run:testUIServer',
|
2017-05-18 03:53:45 +02:00
|
|
|
'functional_test_runner:functional',
|
2015-09-17 16:56:02 +02:00
|
|
|
'esvm_shutdown:ui',
|
|
|
|
'stop:testUIServer'
|
2015-09-02 21:07:20 +02:00
|
|
|
]);
|
|
|
|
|
2017-04-21 18:08:36 +02:00
|
|
|
grunt.registerTask('test:uiRelease', [
|
|
|
|
'checkPlugins',
|
|
|
|
'esvm:ui',
|
|
|
|
'run:testUIReleaseServer',
|
2017-05-18 03:53:45 +02:00
|
|
|
'functional_test_runner:functional',
|
2017-04-21 18:08:36 +02:00
|
|
|
'esvm_shutdown:ui',
|
|
|
|
'stop:testUIReleaseServer'
|
|
|
|
]);
|
|
|
|
|
2015-09-11 21:08:35 +02:00
|
|
|
grunt.registerTask('test:ui:server', [
|
2016-11-19 19:08:43 +01:00
|
|
|
'checkPlugins',
|
2015-09-11 21:08:35 +02:00
|
|
|
'esvm:ui',
|
2016-11-01 16:44:12 +01:00
|
|
|
'run:testUIDevServer:keepalive'
|
2015-09-11 21:08:35 +02:00
|
|
|
]);
|
|
|
|
|
2015-11-17 19:01:45 +01:00
|
|
|
grunt.registerTask('test:api', [
|
|
|
|
'esvm:ui',
|
|
|
|
'run:apiTestServer',
|
2017-05-18 03:53:45 +02:00
|
|
|
'functional_test_runner:apiIntegration',
|
2015-11-17 19:01:45 +01:00
|
|
|
'esvm_shutdown:ui',
|
|
|
|
'stop:apiTestServer'
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test:api:server', [
|
|
|
|
'esvm:ui',
|
2017-06-02 23:26:58 +02:00
|
|
|
'run:devApiTestServer:keepalive'
|
2015-11-17 19:01:45 +01:00
|
|
|
]);
|
|
|
|
|
2017-05-18 03:53:45 +02:00
|
|
|
grunt.registerTask('test:api:runner', () => {
|
2017-07-06 09:02:35 +02:00
|
|
|
grunt.fail.fatal('test:api:runner has moved, use: `node scripts/functional_test_runner --config test/api_integration/config.js`');
|
2017-05-18 03:53:45 +02:00
|
|
|
});
|
2015-11-17 19:01:45 +01:00
|
|
|
|
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([
|
2017-11-14 18:24:00 +01:00
|
|
|
!grunt.option('quick') && 'run:eslint',
|
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
|
|
|
};
|