3
votes

We are using protractor for Integration test. But for our chat application, we need two cookie isolated browser windows where we can switch between browsers and test the result.

Below is multiCapabilities part in my conf.js

multiCapabilities: [{
    'browserName': 'firefox',
    'maxInstances': 4,
    'shardTestFiles': true
}, {
    'browserName': 'chrome',
    'maxInstances': 4,
    'shardTestFiles': true
}],

And below is the code we used to invoke tests in single browser.

onPrepare: function() {
    var app = require('./wrapper.js');
    browser.driver.manage().timeouts().implicitlyWait(app.iwait);
    browser.driver.manage().timeouts().setScriptTimeout(app.lwait);
    browser.driver.manage().window().setPosition(0, 0);
    browser.driver.manage().window().setSize(1280, 1000);
}

Now, I am unable to proceed further on how to launch a browser window on demand and do some actions with it and close browser window whenever is required. I have tried following steps mentioned here at https://github.com/angular/protractor/issues/381 but none of them worked and gave usage overview clearly.

Please help me on this.

1

1 Answers

1
votes

I wrote an example that does exactly what you want (i.e. test an instant messenger) =)

See https://github.com/angular/protractor/blob/master/spec/interactionConf.js and https://github.com/angular/protractor/blob/master/spec/interaction/interaction_spec.js#L51

To run the instant messenger test app that I'm testing against, checkout the protractor github project and run npm start