简体   繁体   English

gulp-protractor e2e任务无法运行

[英]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. 他们在他们的github页面上将其归档为bug,并将对其进行调查。 Source: https://github.com/mllrsohn/gulp-protractor/issues/64 资料来源: 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. 所以我试图开始一个Aurelia项目,包括前端单元测试。 Here is where the problem starts. 这是问题开始的地方。 When I try to run the e2e gulp task I get the following error: 当我尝试运行e2e gulp任务时,出现以下错误:

[10:45:44] using gulpfile ~\\Documents\\Visual Studio 2013\\Projects\\ProjectX\\ProjectX\\gulpfile.js [10:45:44]使用gulpfile〜\\ Documents \\ Visual Studio 2013 \\ Projects \\ ProjectX \\ ProjectX \\ gulpfile.js
[10:45:44] Starting 'build-e2e'... [10:45:44]开始“ build-e2e” ...
[10:45:44] Finished 'build-e2e' after 207 ms [10:45:44] 207毫秒后完成了“ build-e2e”
[10:45:44] Starting 'e2e'... [10:45:44]开始“ 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”识别为内部或外部命令,可操作程序或批处理文件。

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

Error: protractor exited with code 1 错误:量角器以代码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: 这是我的e2e.js文件现在的样子:

 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. 问题在于使用configFile选项的e2e任务中。
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. 如果您知道在configFile路径中包含空格的解决方法,我将很高兴听到它。

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);

}); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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