Recently we have configured our e2e-tests to be on Jenkins & soon we realized that we have to use shared test files: true options as complete suite run is taking very lo
Solution from Aditya works fine for me. My example config file: var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = { framework: 'jasmine2', seleniumAddress: 'http://localhost:4444/wd/hub', /multiCapabilities: [ { 'browserName': 'chrome', 'shardTestFiles': true, 'maxInstances': 2, chromeOptions: { args: ['chrome.switches', '--disable-extensions'] } }, { 'browserName': 'firefox' } ],/ capabilities: { 'browserName': 'chrome', 'shardTestFiles': true, 'maxInstances': 2, chromeOptions: { args: ['chrome.switches', '--disable-extensions'] } }, suites: { loginpage: 'login.js', addproduct: 'addproduct.js' }, //specs: ['addproduct.js'], jasmineNodeOpts: { onComplete: null, isVerbose: false, includeStackTrace: true, showColors: true, defaultTimeoutInterval: 30000 },
onPrepare: function() {
return new Promise(function(fulfill, reject) {
browser.getCapabilities().then(function(value) {
reportName = value.get(Math.random(8,2)) + '_' + value.get('browserName') + '_' + Math.floor(Math.random() * 1E16);
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
//cleanDestination: false,
savePath: 'target/',
//docTitle: 'Web UI Test Report',
screenshotsFolder: 'image',
//takeScreenshots: true,
//takeScreenshotsOnlyOnFailures: true,
consolidate: true,
consolidateAll: true,
// preserveDirectory: true,
//fixedScreenshotName: true,
filePrefix: reportName + ".html"
})
);
fulfill();
});
});
},
afterLaunch: function afterLaunch() {
var fs = require('fs');
var output = '';
fs.readdirSync('target/').forEach(function(file) {
if (!(fs.lstatSync('target/' + file).isDirectory()))
output = output + fs.readFileSync('target/' + file);
});
fs.writeFileSync('target/ConsolidatedReport.html', output, 'utf8');
}
}