title: Running webdriver-start and protractor-start using grunt and protractor is not starting as webdriver-start command doesn't let next process to start
body: <p>I am using Grunt to run protractor end to end test cases. I have following three tasks (I am using windows 7 machine)</p>
  
  <ol>
  <li>webdriver-stop</li>
  <li>webdriver-start</li>
  <li>protractor-start</li>
  </ol>
  
  <p>I am trying to run these three tasks as mentioned above order. However problem is grunt stuck at #webdriver-start process and doesn't let #protractor-start process to run. Following is my grunt config. Please help.</p>
  
  <pre><code>/**
   * New node file
   */
  module.exports = function(grunt){
  
      //globalConfig and paths which will used in the grunt script
  
      var config={
  
              srcFolderName: 'src',
              distFolderName: 'dist',
              appFileName: 'server.js',
              nodeModuleFolderName: 'node_modules',
                          testSourceFolderName: 'src-test',
                          testDestFolderName: 'Test',
              //change this command based on project requirement
              apiDocCommand:'apidoc -i src/server -o apidoc',
              npmInstallCommand: 'npm install --prefix ./dist/&lt;%= pkg.name %&gt;/node_modules',
                          protractorPath:'./node_modules/protractor'
  
      }
  
      //init
      grunt.initConfig({
          config:config,
          pkg: grunt.file.readJSON('package.json'),
          copy: {
  
              //copy all source files to distribution folder
              sourceFiles: {
                cwd: '&lt;%= config.srcFolderName %&gt;',
                src: [ '**' ],
                dest: '&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;',
                expand: true
              },
              //copy main app file to dist folder
              mainAppFile: {
                  src: '&lt;%= config.appFileName %&gt;',
                  dest: '&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/&lt;%= config.appFileName %&gt;'
              },
              copyPackage:{
                  src: 'package.json',
                  dest: '&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/package.json'
              },
              //copy all source test files to distribution folder
              testFiles: {
                cwd: '&lt;%= config.testSourceFolderName %&gt;',
                src: [ '**' ],
                dest: '&lt;%= config.distFolderName %&gt;/&lt;%= config.testDestFolderName %&gt;',
                expand: true
              }
            },
            clean : {
                build : {
                    src : [ '&lt;%=config.distFolderName%&gt;/','apidoc/' ]
                },
                pkgJson : {
                    src : ['&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/package.json']
                }
            },
            uglify: {
                serverCode:{
                    files: [{
                        expand:true,
                        cwd:'&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/server',
                        src:'**/*.js',
                        dest:'&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/server'
                    }]
                },
                clientCode:{
                    files: [{
                        expand:true,
                        cwd:'&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/client/js/application',
                        src:'**/*.js',
                        dest:'&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/client/js/application'
                    }]
                },
                mainAppFile: {
                    files: {
                         '&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/&lt;%= config.appFileName %&gt;':['&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/&lt;%= config.appFileName %&gt;']
                    }
                }
            },
            jshint:{
                serverCode:{
                    files:[{
                        expand:true,
                        cwd:'&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/server',
                        src:'**/*.js'
                    }]
                },
                clientCode:{
                    files: [{
                        expand:true,
                        cwd:'&lt;%= config.distFolderName %&gt;/&lt;%= pkg.name %&gt;/client/js/application',
                        src:'**/*.js'
                    }]
                },
                    clientTestCode:{
                    files: [{
                        expand:true,
                        cwd:'&lt;%= config.distFolderName %&gt;/&lt;%= config.testDestFolderName %&gt;/unit/client/js',
                        src:'**/*.js'
                    }]
                },
                    serverTestCode:{
                    files: [{
                        expand:true,
                        cwd:'&lt;%= config.distFolderName %&gt;/&lt;%= config.testDestFolderName %&gt;/server',
                        src:'**/*.js'
                    }]
                }
            },
            //mocha is used to automate unit testing of server side nodejs/express code.
            simplemocha: {
              options: {
                  globals: ['expect'],
                  timeout: 3000,
                  ignoreLeaks: false,
                  ui: 'bdd',
                  reporter: 'tap'
              },
              all: { src: ['dist/Test/unit/server/**/*.js'] }
          },
          //karma is used to automate unit testing of client side angular/javascript test cases writtin in jasmine.
          karma: {
              unit: {
                  configFile: 'dist/Test/unit/client/config/karma.conf.js',
                  background: false
              }
          },
          protractor: {
                      options: {
                            configFile: "protractor-config.js", //your protractor config file
                            keepAlive: true, // If false, the grunt process stops when the test fails.
                            noColor: false, // If true, protractor will not use colors in its output.
                            args: {
                                // Arguments passed to the command
                            }
                        },
                      chrome: {
                          options: {
                                args: {
                                      browser: "chrome"
                                }
                            }
                      },
                      safari: {
                          options: {
                              args: {
                                  browser: "safari"
                              }
                          }
                      },
                      firefox: {
                          options: {
                              args: {
                                  browser: "firefox"
                              }
                          }
                      }
                  },
           exec: {
                    generateAPIDoc : {
                        command: '&lt;%= config.apiDocCommand %&gt;'
                    },
                    buildDependencies :{
                        command: '&lt;%= config.npmInstallCommand %&gt;'
                    },
                    webdriverStart :{
                        command: 'node &lt;%= config.protractorPath %&gt;/bin/webdriver-manager start &amp;'
                    },
                            webdriverSop :{
                        command: 'start http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer'
                    },
  
                    protractorStart :{
                        command: 'node &lt;%= config.protractorPath %&gt;/bin/protractor ./dist/Test/integration/config/protractor-config.js'
                    }
  
            }
      });
  
      // load our tasks
      grunt.loadNpmTasks('grunt-contrib-copy');
      grunt.loadNpmTasks('grunt-contrib-clean');
      grunt.loadNpmTasks('grunt-contrib-uglify');
      grunt.loadNpmTasks('grunt-contrib-jshint');
      grunt.loadNpmTasks('grunt-simple-mocha');
      grunt.loadNpmTasks('grunt-karma');
      grunt.loadNpmTasks('grunt-protractor-runner');
      //for running executables
      grunt.loadNpmTasks('grunt-exec');
  
      grunt.registerTask('start-server', 'Start a custom web server', function() {
          grunt.log.writeln('Started web server on port 3000');
          require('./dist/ThemeLibrary/server.js');
      });
  
      //                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            the tasks
      grunt.registerTask('build',
              'Compiles all of the assets and copies the files to the build directory for Dev', 
              [ 'clean:build', 'clean:pkgJson','copy','exec:buildDependencies','jshint','exec:generateAPIDoc','uglify:serverCode','uglify:clientCode','uglify:mainAppFile','simplemocha','start-server', 'karma:unit']
      );
      grunt.registerTask('build-dev',
              'Only copies the source files for Dev', 
              [ 'copy:sourceFiles','copy:mainAppFile', 'copy:testFiles', 'jshint', 'simplemocha','start-server','karma:unit','exec:webdriverSop','exec:webdriverStart', 'exec:protractorStart']
      );
  };
  </code></pre>