Rfranca
Rfranca

Reputation: 53

How to use Xvfb + protractor + Gulp

I need to use gulp to execute xvfb and protractor. Gulp runs xvfb, but when gulp run protractor it don't use the xvfb that I started. Another thing that I don't know is how to stop a task that is running, for example xvfb task to stop after run protractor tests.

My code is:

// Include gulp and gulp-angular-protractor
 var gulp = require('gulp');
 var angularProtractor = require('gulp-angular-protractor');
 var shell = require('gulp-shell');
 var runSequence = require('run-sequence');

 gulp.task('xvfb-start', shell.task([
     "Xvfb :99 -ac -screen 0 1600x1200x24",
     "export DISPLAY=:99"
 ]));


 gulp.task('protractor-run', shell.task([
     "Xvfb :99 -ac -screen 0 1600x1200x24",
     "protractor ../../e2e-tests/protractor.conf.js"
 ]));


 gulp.task('default', ['xvfb-start', 'protractor-run']);

Upvotes: 2

Views: 1002

Answers (1)

Rick O'Shea
Rick O'Shea

Reputation: 1449

I assume this is a headless machine, hence the need for the X Window System virtual frame buffer? If so, simply run XVFB as a service. That solves the problem. If you needed to (not sure why) you could then start and stop the service from gulp.

Upvotes: 1

Related Questions