angularjsgulpprotractorgulp-protractor

Gulp-protractor keep saying "Spec patterns did not match any files"


I'm trying to run my end to end tests written with protractor and jasmine. It works perfectly when I call protractor protractor.config.js directly.

However, when I use gulp-protractor, I keep getting the "Spec patterns did not match any files" error and the tests do not run.

This is my protractor runner gulp task:

gulp.task('protractor-run', function (done) {
    return gulp.src(["./e2e-tests/**/*-spec.js"])
        .pipe(protractor({
            configFile: "./config/protractor-config.js",
            args: ['--baseUrl', 'http://127.0.0.1:8000']
        }))
        .on('error', function(e) { throw e })
});

and this is the error:

WARNING - pattern C:\path\to\app\e2e-tests\login\login-spec.js did not math any files.
[launcher] Process exited with error code 1
C:\path\to\app\node_modules\protractor\node_modules\q\q.js:126
                   throw e;
                   ^

Error: Spec patterns did not match any files.

What am I missing?


Solution

  • I managed to get it working. By providing an empty readable stream. Then you specify your spec files in the config file instead.

    var protractor = require('gulp-protractor').protractor;
    
    gulp.task('protractor', ['webdriverUpdate'],function(){
          return gulp.src([])
              .pipe(protractor({
                configFile: __dirname + '/protractor.conf.js'
              }));
    });
    

    also don't forget the webdriverUpdate

    var webdriverUpdate = require('gulp-protractor').webdriver_update;
    
    gulp.task('webdriverUpdate', webdriverUpdate );
    

    and in the config file this:

    seleniumServerJar: './node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',
    

    With this I stopped getting the error.

    Update

    The issue #2551 is closed and fixed since 2.5.0