-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
132 lines (123 loc) · 4.56 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
* k3po.js
* https://github.com/kaazing/k3po.js
*
* Copyright (c) 2014 Kaazing
* Licensed under the APACHE 2 license.
*/
'use strict';
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'test/**/*.js',
'lib/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
clean: {
dist: {
src: ['build/']
}
},
k3po: {
start: {
options: {
goal: "start",
scripts: "test/scripts"
}
},
stop: {
options: {
goal: "stop"
}
},
daemon: {
options: {
goal: "start",
scripts: "test/scripts",
daemon: false
}
}
},
mochaTest: {
testBase: {
options: {
reporter: 'spec',
require: 'lib/testFrameworks/mocha-k3po.js',
captureFile: "build/mochaTest.txt",
quiet: false
},
src: ['test/base/*spec.js']
},
testMochaK3po: {
options: {
reporter: 'spec',
ui: 'mocha-k3po',
require: 'lib/testFrameworks/mocha-k3po.js',
captureFile: "build/testMochaK3po.txt"
},
src: ['test/testFrameworks/mocha-k3po*.js']
},
testMochaK3poLocalBrowserSupport: {
options: {
reporter: 'spec',
ui: 'mocha-k3po',
require: 'lib/testFrameworks/mocha-k3po.js',
captureFile: "build/testMochaK3po.txt",
// timeout: 5000,
browser: {
// debug: true,
desiredCapabilities: {
browserName: 'firefox'
}
}
},
src: ['test/testFrameworks/mocha-k3po*.js']
},
testMochaK3poSauceBrowserSupport: {
options: {
reporter: 'spec',
ui: 'mocha-k3po',
require: 'lib/testFrameworks/mocha-k3po.js',
captureFile: "build/testMochaK3po.txt",
timeout: 10000,
ignoredBrowsers : ['internet explorer 8.0', 'internet explorer 9.0'],
browser: {
// debug: true,
desiredCapabilities: {
browserName: process.env.browser,
platform: process.env.platform,
version: process.env.version,
deviceName: process.env.device,
tags: [process.env.browser,process.env.platform],
name: 'k3po.js spec tests on '+process.env.browser+"/"+process.env.version+"/"+process.env.platform,
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER
},
host: 'localhost',
port: '4445',
user: process.env.SAUCE_USERNAME,
key: process.env.SAUCE_ACCESS_KEY
}
},
src: ['test/testFrameworks/mocha-k3po*.js']
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-k3po');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('runRobot', ['k3po:daemon']);
grunt.registerTask('default', ['clean', 'jshint', 'mochaTest:testBase', 'k3po:start', 'mochaTest:testMochaK3po']);
// Task to run tests locally in firefox(you need to start a local selenium server beforehand)
grunt.registerTask('localTest', ['clean', 'jshint', 'mochaTest:testBase', 'k3po:start', 'mochaTest:testMochaK3poLocalBrowserSupport']);
// Task to run tests using SauceLabs and Travis CI
grunt.registerTask('sauceTest', ['clean', 'jshint', 'mochaTest:testBase', 'k3po:start', 'mochaTest:testMochaK3poSauceBrowserSupport']);
};