Reputation: 21169
For e.g., I have 5 TCs and need to run all the 5 test cases on both Firefox and Chrome. So, once the Chrome finished executing 5 TCs, I need the Firefox browser to initiate and do that same job sequentially.
When I use multiCapabilities, it launches both the Firefox and Chrome at a time.
Upvotes: 2
Views: 2861
Reputation: 2000
This has been tested and working fine in protractor Version 5.4.2 and as per Adolfo's answer I added maxSessions: 1, so it runs in sequential mode . In other words, firefox specs get executed first and then chrome .
exports.config = {
framework: 'jasmine',
directConnect: false,
multiCapabilities: [{
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['--verbose'],
binary: 'C:/Program Files/Mozilla Firefox/firefox.exe'
//Need to start cmd via admin mode to avoid permission error
},
specs: ['src/com/sam/scriptjs/draganddrop.spec.js']
},
{
browserName : 'chrome',
chromeOptions: {
args: [ "--start-maximized" ]
},
specs: ['src/com/sam/scriptjs/iframes.spec.js']
}],
maxSessions: 1,//To run in sequential mode so first Firefox then chrome
//without max session it will open two windows at the same time for both browsers
seleniumAddress: 'http://localhost:4444/wd/hub'
}
Upvotes: 1
Reputation: 595
You can use the maxSessions
var inside protractor configuration conf.js
// Maximum number of total browser sessions to run. Tests are queued in
// sequence if number of browser sessions is limited by this parameter.
// Use a number less than 1 to denote unlimited. Default is unlimited.
maxSessions: -1
More info https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L198
Example conf.js
(firefox, safari, chrome, chrome device simulators):
multiCapabilities: [
{
browserName: 'firefox'
},
{
browserName: 'safari'
},
{
browserName: 'chrome'
},
{
browserName: 'chrome',
// List of devices https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome/mobile_device_list.cc
'deviceName': 'Google Nexus 5'
},
{
browserName: 'chrome',
'deviceName': 'Apple iPhone 6'
},
{
browserName: 'chrome',
'deviceName': 'Apple iPad'
},
{
browserName: 'chrome',
'deviceName': 'Samsung Galaxy S4'
}
],
maxSessions: 1
More examples and testing in real devices https://github.com/aluzardo/protractor-cucumber-tests
Upvotes: 3