teerapap/grunt-protractor-runner — pull request #30 by facultymatt (2013-12-07 19:35:19+00:00)
Title: Features/feature multiple browsers

**Overview**
This Pull Request introduces the ability to run tests against multiple browsers. To do this, set `capabilities` to be an array in your config file. For example:

```
capabilities: [{'browserName': 'chrome' }, {'browserName': 'firefox'},{'browserName': 'safari'}],
```

If using sauce labs, you can be more specific using the following syntax:

```
{
browserName: '',
version: '',
platform: ''
}
```

**How it works:**
`configFile` is no longer passed to protractor. Instead we parse the `configFile`, determine if multiple browsers are configured, and then pass all the config parameters using the protractor cli syntax. The reason we do this is because we start multiple protractor tests, and we pass the same config parameters for each test, except the current browser parameter which we change each time. If we passed the `configFile` then protractor would read this and use the first browser in the array, ignoring our other configurations.

We use `async.queue` to manage tests. `queue.drain` runs the grunt `done()` callback, telling grunt to move onto the next multitask item. If 3 browsers are configured, for example, we `queue` all three tests. Then, when the queue is drained we move onto the next grunt task by calling `done()`.

Currently the queue limit is set to `1` making each browser complete before the next. However I've tested this with a higher limit and it works - although the logs get a bit cluttered because the tests are running and logging at the same time so there is overlap.

Note this PR was based off https://github.com/teerapap/grunt-protractor-runner/pull/26 - which should be resolved one way or another before merging this PR. Although it looks like the need for a local install was resolved with https://github.com/teerapap/grunt-protractor-runner/pull/29 which works with either.