I need to reduce the run time of my Protractor tests, so I want them to run parallel on multiple app servers.

Protractor can by multiCapabilities to open multiple instances of webdriver, but for all of them the "baseUrl" is the same. In my application, 2 suites that run at the same time against same app server, can influence each other. So I need a way to manage a queue of "baseUrl"s and every suite that start to run will get another baseUrl from that queue.

And I want to be sure that if 2 test ask for baseUrl from the queue at the same time, they will get 2 different url's and not the same one. Can someone give me a direction?

1 Answer 1


You can approach this in multiple ways but you need to think beyond the conf.js file. You should look into using a build tool such as gulp, grunt or even npm (if you like shell scripting). All of which allow you to pass an external baseUrl and set the order in which your tests run. Personally I use gulp with gulp-protractor and runSequence (for executing tests in parallel). An example of how I run gulp protractor is below

gulp.task('sauce', function(cb) {
            configFile: './conf.js',
            args: [
                '--baseUrl', '',
                '--specs' , 'todo-spec.js',
                '--maxSessions', '1', 
                '--params.environment', 'sauce',
                '--params.version', 1
        })).on('error', function(e) { throw e; })
        .on('end', cb);

Run Sequence is pretty straight forward once you read the documentation. In the least object oriented implementation you would copy the above task 5+ times and change the gulp task name, baseUrl and spec. Then make a runSequence task and include each of the tasks in the same line per the runSequence documentation. It would be to your benefit to remove the baseUrl,specs and any parallel execution settings from your conf.js file such as sharding, maxSessions etc. If you have multiple browsers/devices set up it will run them sequentially. Meaning once the todo-spec.js is done running in Chrome it will run in Firefox. If you have any questions please let me know in a comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.