-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
92 lines (82 loc) · 2.52 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
'use strict';
module.exports = function (grunt) {
if (grunt.option('help')) {
require('load-grunt-tasks')(grunt);
} else {
require('jit-grunt')(grunt, {
protractor: 'grunt-protractor-runner'
});
}
grunt.initConfig({
config: {
files: {
e2eTests: 'tests/e2e/**/*.js',
features: 'tests/features/**/*.feature',
featureHelpers: 'tests/features/**/*.js'
}
}
});
grunt.registerTask('default', ['test']);
grunt.registerTask('test', ['protractor:e2e', 'protractor:features']);
// DRY protractor args between using Jasmine and Cucumber.
// Common args.
var protractorArgs = {
baseUrl: 'http://localhost:9000/',
capabilities: {
browserName: 'chrome'
}
};
// Jasmine specific.
var protractorJasmineArgs = {
allScriptsTimeout: 11000,
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
// Cucumber specific from http://angular.github.io/protractor/#/frameworks#using-cucumber.
var protractorCucumberArgs = {
// set to 'custom' instead of cucumber.
framework: 'custom',
// path relative to the current config file
frameworkPath: require.resolve('protractor-cucumber-framework'),
// relevant cucumber command line options
cucumberOpts: {
format: 'summary',
require: '<%= config.files.featureHelpers %>'
}
};
// Build protractor spec args for e2e tests (using Jasmine).
var e2eArgs = {
specs: [
'<%= config.files.e2eTests %>'
]
};
Object.assign(e2eArgs, protractorArgs, protractorJasmineArgs);
// Build protractor spec args for feature tests (using Cucumber).
var featureArgs = {
specs: [
'<%= config.files.features %>'
]
};
Object.assign(featureArgs, protractorArgs, protractorCucumberArgs);
grunt.config.merge({
protractor: {
options: {
keepAlive: false,
webdriverManagerUpdate: true,
// Place all config here in Grunt so file expansion can be used.
configFile: 'protractor-empty.conf.js'
},
e2e: {
options: {
args: e2eArgs
}
},
features: {
options: {
args: featureArgs
}
}
}
});
};