Search code examples
gulpprotractor

How to exit protractor when done


When I run gulp-protractor it runs my tests fine but when done it doesn't exit

8 specs, 0 failures
Finished in 14.874 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
[14:40:57] Finished 'test:e2e' after 16 s

When done, I have to hit ctrl + c to continue. Is it possible to tell protractor to quit when done ?


Solution

  • Check your gulp file,

    Do you have a command to exit the process at the completion of tests?

    e.g.

    gulp.task('e2e', function() {
    gulp.src(['foo/bar'])
        .pipe(protractor({
            configFile: 'protractor.conf.js',
            args: ['--baseUrl', baseUrl],
            keepAlive: true
        }))
        .on('end', function() {
            console.log('E2E Testing complete');
            process.exit();
        })
        .on('error', function(error) {
            console.log('E2E Tests failed');
            process.exit(1);
        });
    

    });

    key line being process.exit()