【问题标题】:gulp-protractor e2e task fails to rungulp-protractor e2e 任务无法运行
【发布时间】:2015-12-07 10:00:27
【问题描述】:

更新:似乎这是 gulp-protractor 中的一个错误。在他们的 github 页面上,他们将其作为错误提交,并将对其进行研究。来源:https://github.com/mllrsohn/gulp-protractor/issues/64

在解决错误之前,您唯一可行的解​​决方法是将项目目录更改为不包含空格的目录。


所以我试图让一个 Aurelia 项目开始,包括前端单元测试。这是问题开始的地方。当我尝试运行 e2e gulp 任务时,出现以下错误:

[10:45:44] 使用 gulpfile ~\Documents\Visual Studio 2013\Projects\ProjectX\ProjectX\gulpfile.js
[10:45:44] 开始'build-e2e'...
[10:45:44] 207 毫秒后完成“build-e2e”
[10:45:44] 启动 'e2e'...
'C:\Users\jorisd\Documents\Visual' 未被识别为内部或外部命令、可运行程序或批处理文件。强>

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

错误:量角器以代码 1 退出

基本上是突出显示的代码有问题。由于我的路径包含一个空格,它会因为某种原因停在那里。

这是我的 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; });
});

问题在于使用 configFile 选项的 e2e 任务。
我尝试将行更改为以下内容:

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

但这也没有结果。如果你们中有人知道在 configFile 路径中包含空格的解决方法,我会很高兴听到。

【问题讨论】:

    标签: javascript visual-studio-2013 gulp aurelia gulp-protractor


    【解决方案1】:

    对我来说它工作正常。

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

    });

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-22
      • 1970-01-01
      • 1970-01-01
      • 2018-04-13
      • 2018-01-31
      • 1970-01-01
      • 2017-03-13
      • 2016-02-12
      相关资源
      最近更新 更多