Merge "Move Apex Verify Jobs to apex-verify-jobs file"
[releng.git] / utils / test / testapi / 3rd_party / static / testapi-ui / Gruntfile.js
1
2 module.exports = function (grunt) {
3         require('load-grunt-tasks')(grunt);
4         require('grunt-protractor-coverage')(grunt);
5         grunt.loadNpmTasks('grunt-shell-spawn');
6         grunt.loadNpmTasks('grunt-wait');
7         grunt.loadNpmTasks('grunt-contrib-copy');
8         grunt.loadNpmTasks('grunt-contrib-connect');
9         grunt.initConfig({
10                 connect: {
11                         server: {
12                                 options: {
13                                         port: 8000,
14                                         base: './',
15                                         middleware: function(connect, options, middlewares) {
16                                                 middlewares.unshift(function(req, res, next) {
17                                                         if (req.method.toUpperCase() == 'POST') req.method='GET';
18                                                         return next();
19                                                 });
20                                                 return middlewares;
21                                         }
22                                 }
23                         }
24                 },
25                 copy: {
26                         assets: {
27                           expand: true,
28                           cwd: 'assets',
29                           src: '**',
30                           dest: 'testapi-ui/assets',
31                         },
32                         components: {
33                                 expand: true,
34                                 cwd: 'components',
35                                 src: '**',
36                                 dest: 'testapi-ui/components',
37                         },
38                         shared: {
39                                 expand: true,
40                                 cwd: 'shared',
41                                 src: '**',
42                                 dest: 'testapi-ui/shared',
43                         },
44                         filesPng: {
45                                 expand: true,
46                                 src: '*.png',
47                                 dest: 'testapi-ui/',
48                         },
49                         filesIco: {
50                                 expand: true,
51                                 src: '*.ico',
52                                 dest: 'testapi-ui/',
53                         },
54                         filesJs: {
55                                 expand: true,
56                                 src: 'app.js',
57                                 dest: 'testapi-ui/',
58                         },
59                         filesJson: {
60                                 expand: true,
61                                 src: 'config.json',
62                                 dest: 'testapi-ui/',
63                         }
64                 },
65                 wait: {
66                         default: {
67                                 options: {
68                                         delay: 3000
69                                 }
70                         }
71                 },
72                 shell: {
73                         updateSelenium: {
74                                 command: 'node_modules/protractor/bin/webdriver-manager update',
75                                 options: {
76                                 async: false
77                         }
78                         },
79                         startSelenium: {
80                                 command: 'node_modules/protractor/bin/webdriver-manager start',
81                                 options: {
82                               async: true
83                             }
84                         },
85                         options: {
86                         stdout: false,
87                         stderr: false
88                     }
89                 },
90                 instrument: {
91                 files: ['components/**/*.js'],
92                 options: {
93                 lazy: false,
94                     basePath: "./testapi-ui/"
95                 }
96             },
97                 karma: {
98                         unit: {
99                                 configFile: '../../../opnfv_testapi/tests/UI/karma.conf.js'
100                         }
101                 },
102                 protractor_coverage: {
103                     options: {
104                         keepAlive: true,
105                         noColor: false,
106                         coverageDir: '../../../opnfv_testapi/tests/UI/coverage',
107                         args: {
108                             specs: ['../../../opnfv_testapi/tests/UI/e2e/podsControllerSpec.js']
109                         }
110                     },
111                     local: {
112                         options: {
113                             configFile: '../../../opnfv_testapi/tests/UI/protractor-conf.js'
114                         }
115                     }
116                 },
117                 makeReport: {
118                 src: '../../../opnfv_testapi/tests/UI/coverage/*.json',
119                 options: {
120                     print: 'detail'
121                 }
122             },
123                 protractor: {
124                         e2e: {
125                                 options: {
126                                         args: {
127                                                 specs: ['../../../opnfv_testapi/tests/UI/e2e/podsControllerSpec.js']
128                                         },
129                                         configFile: '../../../opnfv_testapi/tests/UI/protractor-conf.js',
130                                         keepAlive: true
131                                 }
132                         }
133                 }
134         });
135         grunt.registerTask('test', [
136                 'karma:unit'
137         ]);
138         grunt.registerTask('e2e', [
139                 'copy:assets',
140                 'copy:components',
141                 'copy:shared',
142                 'copy:filesPng',
143                 'copy:filesIco',
144                 'copy:filesJs',
145                 'copy:filesJson',
146                 'instrument',
147                 'connect',
148                 'shell:updateSelenium',
149                 'shell:startSelenium',
150                 'wait:default',
151                 'protractor_coverage',
152                 'makeReport'
153                 // 'protractor'
154         ]);
155 }