简体   繁体   中英

gulp-protractor e2e task fails to run

Update: Seems like this is a bug in gulp-protractor. On their github page they filed it as a bug and will take a look into it. Source: https://github.com/mllrsohn/gulp-protractor/issues/64

Only possible workaround you can do until the bug is resolved is change the directory of your project to something that doesn't include spaces.


So I'm trying to get an Aurelia project started including front end unit testing. Here is where the problem starts. When I try to run the e2e gulp task I get the following error:

[10:45:44] using gulpfile ~\\Documents\\Visual Studio 2013\\Projects\\ProjectX\\ProjectX\\gulpfile.js
[10:45:44] Starting 'build-e2e'...
[10:45:44] Finished 'build-e2e' after 207 ms
[10:45:44] Starting 'e2e'...
'C:\\Users\\jorisd\\Documents\\Visual' is not recognized as an internal or external command, operable program or batch file.

C:\\Users\\jorisd\\Documents\\Visual Studio 2013\\Projects\\ProjectX\\ProjectX\\build\\tasks\\e2e.js:34
.on('error', function(e) {throw e; });

Error: protractor exited with code 1

Basically it's the highlighted code that has the problem. Since my path includes a space, it'll stop there for some reason.

Here's how my e2e.js file looks like right now:

 var gulp = require('gulp'); var paths = require('../paths'); var to5 = require('gulp-babel'); var plumber = require('gulp-plumber'); var webdriverUpdate = require('gulp-protractor').webdriver_update; var webdriverStandalone = require("gulp-protractor").webdriver_standalone; var protractor = require('gulp-protractor').protractor; // for full documentation of gulp-protractor, // please check https://github.com/mllrsohn/gulp-protractor gulp.task('webdriver-update', webdriverUpdate); gulp.task('webdriver-standalone', ['webdriver-update'], webdriverStandalone); // transpiles files in // /test/e2e/src/ from es6 to es5 // then copies them to test/e2e/dist/ gulp.task('build-e2e', function() { return gulp.src(paths.e2eSpecsSrc) .pipe(plumber()) .pipe(to5()) .pipe(gulp.dest(paths.e2eSpecsDist)); }); // runs build-e2e task // then runs end to end tasks // using Protractor: http://angular.github.io/protractor/ gulp.task('e2e', ['build-e2e'], function(cb) { return gulp.src(paths.e2eSpecsDist + '/*.js') .pipe(protractor({ configFile: '/protractor.conf.js', args: ['--baseUrl', 'http://127.0.0.1:9000'] })) .on('end', function() { process.exit(); }) .on('error', function(e) { throw e; }); }); 

The problem is situating in the e2e task with the configFile option.
I tried change the line into the following:

 configFIle: __dirname + '/protractor.conf.js', 

But this aswell without result. If any of you know a workaround for including spaces in the configFile path, I'll be happy to hear it.

For me its working fine.

var angularProtractor = require('gulp-angular-protractor');

gulp.task('test', function (callback) {

 gulp
     .src([__dirname+'/public/apps/adminapp/**/test/**_test.js'])
     .pipe(angularProtractor({
         'configFile': 'public/apps/adminapp/app.test.config.js',
         'debug': false,
         'args': ['--suite', 'adminapp'],
         'autoStartStopServer': true
     }))
     .on('error', function(e) {
         console.log(e);
     })
    .on('end',callback);

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM