-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (54 loc) · 1.65 KB
/
gulpfile.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
'use strict';
const logger = require('./support/logger').logger;
const gulp = require('gulp');
const protractor = require("gulp-protractor").protractor;
const runSequence = require('run-sequence').use(gulp);
const shell = require('gulp-shell');
gulp.task('eslint', () => {
logger.info('Checking and fixing code by eslinter');
return gulp.src('*.js', { read: false })
.pipe(shell([
'eslint ./ --fix'
]));
});
gulp.task('update-webdriver', (done) => {
logger.info('Updating webdriver');
gulp.src('*.js', { read: false })
.pipe(shell([
'start cmd /k "node_modules\\.bin\\webdriver-manager update"'
]));
setTimeout(() => {
done();
}, 7000);
});
gulp.task('start-webdriver', (done) => {
logger.info('Starting webdriver');
gulp.src('*.js', { read: false })
.pipe(shell([
'start cmd /k "node_modules\\.bin\\webdriver-manager start"'
]));
setTimeout(() => {
done();
}, 10000);
});
gulp.task('run-test', () => {
logger.info('Running tests');
return gulp.src('./test/features/*.feature')
.pipe(protractor({
configFile: "./test/config/conf.js"
}))
.on('error', (er) => {
logger.error('Error, Tests Failed!', er);
runSequence('generate-report');
});
});
gulp.task('generate-report', () => {
logger.info('Generating tests report');
return gulp.src('*.js', { read: false })
.pipe(shell([
'.\\reports\\my-report.html'
]));
});
gulp.task('default', () => {
runSequence('update-webdriver', 'start-webdriver', 'run-test', 'generate-report');
});