I have 10 test cases, In which first 8 test cases should run in Chrome browser and next 2 test cases should run in Firefox browser.
I have tried below code: in conf.js
var jasmineReporters = require('jasmine-reporters-master');
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
framework: 'jasmine2', //framework Used
seleniumPort: 4444, // selenium port address
specs: ['./Spec/Master.spec.js'], //Spec -> consists of test suite/ test cases
allScriptsTimeout: 50000,
jasmineNodeOpts: { //jasmine framework details
isVerbose: true,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 260000,
print: function() {}
},
multiCapabilities: [{
browserName: 'chrome',
'args':['incognito','--start-maximized'], // this line is for maximize the window and incognito view
prefs: {
'profile:managed_default_content_settings.notifications': 1
},
exclude: ['./Spec/RestCall/ShowGeoLocation.js'],
},
{
browserName: 'firefox',
specs: ['./Spec/RestCall/ShowGeoLocation.js']
// Spec files to be excluded on this capability only.
//exclude: ['spec/doNotRunInChromeSpec.js'], //YOUR SPEC NAME THAT YOU WANT TO EXCLUDE/SKIP
}],
maxSession:1,
onPrepare: function (config_) { // before starting the actual TC execution, setup the things we define here
require('./Data/waitReady.js');
//browser.manage().window().maximize();
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: false,
savePath: './Reports/JunitXMLprotractor-result/',
filePrefix: 'xmloutput'
}));
}
};
./Spec/Master.spec.js' has:
var showGeoloca = require('./RestCall/ShowGeoLocation');
describe('REPORTING USER ROLE - ',function () {
Reporting.start(); contains actual spec
});
describe('Rest Call - ',function () {
showGeoloca.start(); contains actual spec
});
In Simple, Reporting.start() should run in Chrome browser. ShowGeoloca.start should run in Firefox browser.
Note: Inside Each Spec code, I didn’t specify any new instance of creating new browser
But didn't work as expected.
How can we achieve this? Can we create a new instance of Firefox browser on the go? (while a test case is running)
specs
values, not the sample ones. Directory structure showing how your tests are organized would also help a lot.