<commit_before># protractor-multi-synchronizer

![Build Status](https://travis-ci.com/realglobe-Inc/protractor-multi-synchronizer.svg?token=N9bn3XyaYHv9C82Qt4Hu&branch=master)

Protractor helper lib for real-time web app.

## Installation

```sh
npm install protractor-multiple-synchronizer
```

## Usage

`protractor.conf.js`

```js
var synchronizer = require('protractor-multiple-synchronizer');
synchronizer.setConfig({
    multiplicity: 3, // number of multiCapabilities. default is 2
    port: 8765, // socket.io port. default is 8765
    wait: true  // wait other processes on synchronizer.run(). default is true.
});

exports.config = {
    // ...

    multiCapabilities: [
        {
            browserName: 'firefox',
            specs: [
                '/path/to/spec/for/firefox.js'
            ]
        },
        {
            browserName: 'chrome',
            specs: [
                '/path/to/spec/for/chrome.js'
            ]
        },
        {
            browserName: 'safari',
            specs: [
                '/path/to/spec/for/safari.js'
            ]
        }
    ],
    beforeLaunch: function() {
        synchronizer.init(); // initialize parent process.
    },
    onPrepare: function() {
        synchronizer.init(); // initialize child processes.
    }

    // ...
}
```

`/path/to/spec/for/firefox.js`

```js
"use strict";

var synchronizer = require('protractor-multiple-synchronizer');
synchronizer.role = 'firefox';

require('./shared_test');
```

`/path/to/spec/for/chrome.js`

```js
"use strict";

var synchronizer = require('protractor-multiple-synchronizer');
synchronizer.role = 'chrome';

require('./shared_test');
```

`/path/to/spec/for/safari.js`

```js
"use strict";

var synchronizer = require('protractor-multiple-synchronizer');
synchronizer.role = 'safari';

require('./shared_test');
```

`/path/to/spec/for/shared_test.js`

```js
"use strict";

var synchronizer = require('protractor-multiple-synchronizer');

describe('test for real-time chat app.', function() {
    beforeEach(function() {
        // wait for all children is ready.
        synchronizer.run({wait: true}, function() {
            browser.get('http://test.example.com');
        });<commit_msg>fix README.md<commit_after># protractor-multi-synchronizer

![Build Status](https://travis-ci.com/realglobe-Inc/protractor-multi-synchronizer.svg?token=N9bn3XyaYHv9C82Qt4Hu&branch=master)

Protractor helper lib for real-time web app.

## Installation

```sh
npm install protractor-multi-synchronizer
```

## Usage

`protractor.conf.js`

```js
var synchronizer = require('protractor-multi-synchronizer');
synchronizer.setConfig({
    multiplicity: 3, // number of multiCapabilities. default is 2
    port: 8765, // socket.io port. default is 8765
    wait: true  // wait other processes on synchronizer.run(). default is true.
});

exports.config = {
    // ...

    multiCapabilities: [
        {
            browserName: 'firefox',
            specs: [
                '/path/to/spec/for/firefox.js'
            ]
        },
        {
            browserName: 'chrome',
            specs: [
                '/path/to/spec/for/chrome.js'
            ]
        },
        {
            browserName: 'safari',
            specs: [
                '/path/to/spec/for/safari.js'
            ]
        }
    ],
    beforeLaunch: function() {
        synchronizer.init(); // initialize parent process.
    },
    onPrepare: function() {
        synchronizer.init(); // initialize child processes.
    }

    // ...
}
```

`/path/to/spec/for/firefox.js`

```js
"use strict";

var synchronizer = require('protractor-multi-synchronizer');
synchronizer.role = 'firefox';

require('./shared_test');
```

`/path/to/spec/for/chrome.js`

```js
"use strict";

var synchronizer = require('protractor-multi-synchronizer');
synchronizer.role = 'chrome';

require('./shared_test');
```

`/path/to/spec/for/safari.js`

```js
"use strict";

var synchronizer = require('protractor-multi-synchronizer');
synchronizer.role = 'safari';

require('./shared_test');
```

`/path/to/spec/for/shared_test.js`

```js
"use strict";

var synchronizer = require('protractor-multi-synchronizer');

describe('test for real-time chat app.', function() {
    beforeEach(function() {
        // wait for all children is ready.
        synchronizer.run({wait: true}, function() {
            browser.get('http://test.example.com');
        });
{'fraction_non_alphanumeric': 0.1589778380823157, 'fraction_numerical': 0.007236544549977386, 'mean_word_length': 2.4964426877470354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2574304', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1412, 'n_words': 257}