Gulp protractor says: "The range of patterns does not match any files"

I am trying to run end-to-end tests written by protractor and jasmine. It works fine when I call protractor protractor.config.js directly.

However, when I use gulp -protractor, I get the error "Pattern templates do not match any files" all the time and the tests do not run.

This is my gulp prototype 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 a mistake:

 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?

+5
source share
2 answers

I managed to get it to work. Providing an empty readable stream. Then you specify your specification files in the configuration file.

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

also do not forget that webdriverUpdate

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

and in the configuration file:

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

With this, I stopped getting the error.

Update

issue No. 2551 is closed and fixed since version 2.5.0

+4
source

I enabled this in gulpfile, which runs protractor tests by putting the file path in the gulp.src parameter (['file_path_goes_here']). The task that I tried to run did not have a file path between the brackets and made an error.

 gulp.task('works', 'Run some tests', function() { gulp.src(['path/to/test.spec.js']) .pipe(protractor({ configFile: __dirname + '/../test/protractor.conf.js', args: ['--baseUrl', 'http://localhost:9099'] })) }); gulp.task('error', 'Run feature tests locally', function() { gulp.src(['']) .pipe(protractor({ configFile: __dirname + '/../test/protractor_local.conf.js', args: ['--baseUrl', 'http://localhost:9099'] })) }); 
0
source

Source: https://habr.com/ru/post/1232532/


All Articles