webdriverio-boneyard / gulp-webdriver

gulp-webdriver is a gulp plugin to run selenium tests with the WebdriverIO testrunner
http://webdriver.io
MIT License
76 stars 33 forks source link

gulp end event not firing in 2.0.0 #41

Closed stevejhiggs closed 8 years ago

stevejhiggs commented 8 years ago

In v1.0.3 I use the gulp 'end' event to shutdown my selenium server:

return gulp.src('./wdio.conf.js'))
    .pipe(webdriver({
      wdioBin:  path.join(__dirname, 'node_modules', '.bin', wdioCommand)
    })).once('end', () => {
      selenium.child.kill();
    });`

however in 2.0.0 the 'end' event never fires. Is this intentional?

christian-bromann commented 8 years ago

@stevejhiggs yeah that was unfortunate implemented. I fixed it and published a new version v2.0.1

azaslavsky commented 8 years ago

Hi, I'm using 2.0.1, and I am still experiencing the error described above. My code:

  gulp.src('wdio.conf.js')
      .pipe(wdio({
        host: 'localhost',
        port: 1234,
        logLevel: args.verbose ? 'verbose' : 'error',
        capabilities: capabilities
      }))
      .on('error', function(e) {
        //throw e;
      })
      .on('end', function() {
        console.log('I\'m finished!');
        if (!args.serverless) {
          servers.forEach(function(server) {
            server.kill();
          });
        }
        done();
      });

Any thoughts as to what I am doing wrong?

christian-bromann commented 8 years ago

Why can't you use the selenium-webdriver service? It seems that the end event is not propagated correctly

azaslavsky commented 8 years ago

I use appium for tests under certain configurations, so sometimes I need a plain old selenium server, whereas in other cases I need an appium server, or sometimes both. I just run shells scripts to create my own as child processes as needed, then kill them once the test runner has done its thing.

Either way, the "end" event should be fired for a gulp plugin.

azaslavsky commented 8 years ago

Is there a workaround I could use in the meantime, something that will be able to pick up when the test suite is over at least? If that were the case, I could kill the process myself.

christian-bromann commented 8 years ago

Let's continue the conversation in #47