forked from appium/appium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
139 lines (137 loc) · 5.3 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
133
134
135
136
137
138
139
"use strict";
var path = require('path')
, gruntHelpers = require('./grunt-helpers.js')
, startAppium = gruntHelpers.startAppium
, authorize = gruntHelpers.authorize
, downloadUICatalog = gruntHelpers.downloadUICatalog
, tail = gruntHelpers.tail
, buildApp = gruntHelpers.buildApp
, signApp = gruntHelpers.signApp
, setupAndroidBootstrap = gruntHelpers.setupAndroidBootstrap
, setupAndroidApp = gruntHelpers.setupAndroidApp
, buildAndroidBootstrap = gruntHelpers.buildAndroidBootstrap
, buildAndroidApp = gruntHelpers.buildAndroidApp
, installAndroidApp = gruntHelpers.installAndroidApp
, generateServerDocs = gruntHelpers.generateServerDocs
, generateAppiumIo = gruntHelpers.generateAppiumIo
, runTestsWithServer = gruntHelpers.runTestsWithServer;
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
all: ['*.js', 'app/*.js', 'app/test/unit/*.js', 'instruments/*.js', 'test/functional/*.js', 'test/unit/*.js', 'test/functional/appium/*.js', 'test/functional/testapp/*.js', 'test/functional/uicatalog/*.js', 'test/functional/webview/*.js', 'test/helpers/*.js', 'test/functional/safari/*.js', 'test/functional/prefs/*.js', 'app/uiauto/appium/app.js', 'app/uiauto/appium/binding.js', 'app/uiauto/element.js', 'app/uiauto/appium/utility.js', 'app/uiauto/lib/instruments_client.js', 'app/uiauto/lib/status.js']
, options: {
laxcomma: true
, es5: true
, trailing: true
, node: true
, strict: true
}
}
, mochaTest: {
unit: ['app/test/unit/*.js']
, appiumutils: ['test/functional/appium/appiumutils.js']
}
, mochaTestWithServer: {
TestApp: ['ios', {
functional: ['test/functional/testapp/*.js']
, server: ['test/functional/appium/appium.js'
, 'test/functional/appium/jsonwp.js']
}]
, UICatalog: ['ios', {
functional: ['test/functional/uicatalog/*.js']
}]
, WebViewApp: ['ios', {
functional: ['test/functional/webview/*.js']
}]
, ApiDemos: ['android', {
functional: ['test/functional/apidemos/*.js']
}]
, Safari: ['ios', {
functional: ['test/functional/safari/*.js']
}]
, Preferences: ['ios', {
functional: ['test/functional/prefs/*.js']
}]
}
, mochaTestConfig: {
options: {
timeout: 60000,
reporter: 'spec'
}
}
});
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('functional', "Run functional tests", function(log) {
runTestsWithServer(grunt, null, 'functional', null, log === "log", this.async());
});
grunt.registerTask('servertest', "Run functional server tests", function(log) {
runTestsWithServer(grunt, 'TestApp', 'server', null, log === "log", this.async());
});
grunt.registerTask('android', "Run functional android tests", function(log) {
runTestsWithServer(grunt, null, 'functional', 'android', log === "log", this.async());
});
grunt.registerTask('ios', "Run functional ios tests", function(log) {
runTestsWithServer(grunt, null, 'functional', 'ios', log === "log", this.async());
});
grunt.registerTask('test', ['jshint', 'unit', 'appiumutils', 'functional', 'servertest']);
grunt.registerTask('unit', 'mochaTest:unit');
grunt.registerTask('appiumutils', 'mochaTest:appiumutils');
grunt.registerTask('default', ['test']);
grunt.registerTask('travis', ['jshint', 'unit']);
grunt.registerTask('appium', "Start the Appium server", function(appName) {
if (typeof appName === "undefined") {
appName = null;
}
startAppium(appName, true, function() {}, this.async());
});
grunt.registerTask('downloadApp', "Download UICatalog", function() {
downloadUICatalog(this.async());
});
grunt.registerTask('buildApp', "Build the test app", function(appDir, sdk) {
buildApp(appDir, this.async(), sdk);
});
grunt.registerTask('signApp', "Sign the test app", function(certName) {
signApp("TestApp", certName, this.async());
});
grunt.registerTask('authorize', "Authorize developer", function() {
authorize(grunt, this.async());
});
grunt.registerTask('log', "Tail appium.log", function() {
tail(grunt, path.resolve(__dirname, "appium.log"), this.async());
});
grunt.registerTask('configAndroidBootstrap', function() {
var cb = this.async();
setupAndroidBootstrap(grunt, function(exitCode) {
cb(exitCode === 0);
});
});
grunt.registerTask('buildAndroidBootstrap', function() {
var cb = this.async();
buildAndroidBootstrap(grunt, function(exitCode) {
cb(exitCode === 0);
});
});
grunt.registerTask('configAndroidApp', function(appName) {
var cb = this.async();
setupAndroidApp(grunt, appName, function(exitCode) {
cb(exitCode === 0);
});
});
grunt.registerTask('buildAndroidApp', function(appName) {
var cb = this.async();
buildAndroidApp(grunt, appName, function(exitCode) {
cb(exitCode === 0);
});
});
grunt.registerTask('installAndroidApp', function(appName) {
installAndroidApp(grunt, appName, this.async());
});
grunt.registerTask('docs', function() {
generateServerDocs(grunt, this.async());
});
grunt.registerTask('generateAppiumIo', function() {
generateAppiumIo(grunt, this.async());
});
};