50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
/*******************************************************************************
|
|
* Copyright (c) 2015-2016 Codenvy, S.A.
|
|
* All rights reserved. This program and the accompanying materials
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
* which accompanies this distribution, and is available at
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
*
|
|
* Contributors:
|
|
* Codenvy, S.A. - initial API and implementation
|
|
*******************************************************************************/
|
|
|
|
'use strict';
|
|
|
|
var path = require('path');
|
|
var gulp = require('gulp');
|
|
var conf = require('./conf');
|
|
|
|
var browserSync = require('browser-sync');
|
|
|
|
var $ = require('gulp-load-plugins')();
|
|
|
|
// Downloads the selenium webdriver
|
|
gulp.task('webdriver-update', $.protractor.webdriver_update);
|
|
|
|
gulp.task('webdriver-standalone', $.protractor.webdriver_standalone);
|
|
|
|
function runProtractor (done) {
|
|
var params = process.argv;
|
|
var args = params.length > 3 ? [params[3], params[4]] : [];
|
|
|
|
gulp.src(path.join(conf.paths.e2e, '/**/*.js'))
|
|
.pipe($.protractor.protractor({
|
|
configFile: 'protractor.conf.js',
|
|
args: args
|
|
}))
|
|
.on('error', function (err) {
|
|
// Make sure failed tests cause gulp to exit non-zero
|
|
throw err;
|
|
})
|
|
.on('end', function () {
|
|
// Close browser sync server
|
|
browserSync.exit();
|
|
done();
|
|
});
|
|
}
|
|
|
|
gulp.task('protractor', ['protractor:src']);
|
|
gulp.task('protractor:src', ['serve:e2e', 'webdriver-update'], runProtractor);
|
|
gulp.task('protractor:dist', ['serve:e2e-dist', 'webdriver-update'], runProtractor);
|