From a9e2268b1878a8749cb6669bbc5ba593e59ea6ac Mon Sep 17 00:00:00 2001 From: Gunther Brunner Date: Wed, 4 Jun 2014 15:00:40 +0900 Subject: [PATCH] Added gulp protractor task. --- gulpfile.js | 34 +++++++++++++++++++------- protractor.conf.js | 5 ---- res/common/status/maintenance.jade | 1 - res/common/status/partials/styles.jade | 1 - res/test/protractor.conf.js | 9 +++++++ 5 files changed, 34 insertions(+), 16 deletions(-) delete mode 100644 protractor.conf.js create mode 100644 res/test/protractor.conf.js diff --git a/gulpfile.js b/gulpfile.js index 47dbdc78..9107f82b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,35 +8,51 @@ var webpackConfig = require('./webpack.config.js') var gettext = require('gulp-angular-gettext') var jade = require('gulp-jade') var clean = require('gulp-clean') +var protractor = require("gulp-protractor") + gulp.task('jshint', function () { return gulp.src([ - 'lib/**/*.js' + 'lib/**/*.js' , 'res/app/**/*.js' , 'res/auth-ldap/**/*.js' , 'res/auth-mock/**/*.js' , '*.js' - ]) + ]) .pipe(jshint()) .pipe(jshint.reporter('jshint-stylish')) }) gulp.task('jsonlint', function () { return gulp.src([ - '.jshintrc' + '.jshintrc' , 'res/.jshintrc' , '.bowerrc' , '.yo-rc.json' , '*.json' - ]) + ]) .pipe(jsonlint()) .pipe(jsonlint.reporter()) }) gulp.task('lint', ['jshint', 'jsonlint']) -gulp.task('test', ['lint']) +gulp.task('test', ['lint', 'protractor']) gulp.task('build', ['translate', 'webpack:build']) +gulp.task('webdriver_update', protractor.webdriver_update) +gulp.task('webdriver_standalone', protractor.webdriver_standalone) + +gulp.task('protractor', ['webdriver_update'], function (callback) { + gulp.src(["./res/test/**/*.js"]) + .pipe(protractor.protractor({ + configFile: './res/test/protractor.conf.js' + })) + .on('error', function (e) { + console.log(e) + }).on('end', callback) +}) + + // For production gulp.task("webpack:build", function (callback) { var myConfig = Object.create(webpackConfig) @@ -68,19 +84,19 @@ gulp.task('translate', ['jade', 'translate:extract', 'translate:compile']) gulp.task('jade', function () { return gulp.src([ - './res/**/*.jade' + './res/**/*.jade' , '!./res/bower_components/**' - ]) + ]) .pipe(jade()) .pipe(gulp.dest('./tmp/html/')) }) gulp.task('translate:extract', function () { return gulp.src([ - './tmp/html/**/*.html' + './tmp/html/**/*.html' , './res/**/*.js' , '!./res/bower_components/**' - ]) + ]) .pipe(gettext.extract('stf.pot')) .pipe(gulp.dest('./res/common/lang/po/')) }) diff --git a/protractor.conf.js b/protractor.conf.js deleted file mode 100644 index b6ad856c..00000000 --- a/protractor.conf.js +++ /dev/null @@ -1,5 +0,0 @@ -// Reference: https://github.com/angular/protractor/blob/master/referenceConf.js - -exports.config = { - specs: ['res/test/e2e/*spec.js'] -} diff --git a/res/common/status/maintenance.jade b/res/common/status/maintenance.jade index 9830f00a..6c0b91eb 100644 --- a/res/common/status/maintenance.jade +++ b/res/common/status/maintenance.jade @@ -6,7 +6,6 @@ html meta(name='viewport', content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui') include partials/styles body(ng-cloak).forofour.bg-danger - script(src='/static/bower_components/stf-analytics/analytics.js') div(ng-view) .forofour-container h1 diff --git a/res/common/status/partials/styles.jade b/res/common/status/partials/styles.jade index f21b94b7..0f383b66 100644 --- a/res/common/status/partials/styles.jade +++ b/res/common/status/partials/styles.jade @@ -1,4 +1,3 @@ -link(href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700', media='all', rel='stylesheet', type='text/css') link(rel='stylesheet', href='/static/bower_components/se7en-bootstrap-3/build/stylesheets/bootstrap.min.css') link(rel='stylesheet', href='/static/bower_components/se7en-bootstrap-3/build/stylesheets/se7en-font.css') link(rel='stylesheet', href='/static/bower_components/se7en-bootstrap-3/build/stylesheets/style.css') diff --git a/res/test/protractor.conf.js b/res/test/protractor.conf.js new file mode 100644 index 00000000..a01ea31f --- /dev/null +++ b/res/test/protractor.conf.js @@ -0,0 +1,9 @@ +// Reference: https://github.com/angular/protractor/blob/master/referenceConf.js + +exports.config = { + specs: ['res/test/e2e/*spec.js'], + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000 + } +}