Reputation: 173
I have been trying to get the html report and screenshots of my execution result using "protractor-jasmine2-screenshot-reporter" but HTML report is created with content like
Report
Summary
Total specs tested: 0
Total failed: 0
And no screenshots is saved at the location.
My config file is as below
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html'
});
exports.config = {
directConnect: true,
//seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {'browserName': 'chrome'},
framework: 'jasmine',
specs: ['Login_spec3.js'],
allScriptsTimeout: 180000,
getPageTimeout: 180000,
jasmineNodeOpts: {
defaultTimeoutInterval: 180000
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
// Assign the test reporter to each running instance
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
afterAll(function(done) {
process.nextTick(done);
})
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
},
onPrepare: function() {
var width = 1300;
var height = 1200;
browser.driver.manage().window().setSize(width,height);
}
};
Other details are as below: [email protected], nodeVersion: 4.2.4, npmVersion: 2.14.12, jasmine: 2.4.1, selenium-webdriver: 2.52.0
Can anybody suggest me any solution?
Upvotes: 0
Views: 1467
Reputation: 5231
@Sonal: Got the issue, you are using 2 onPrepare functions which is conflicting, use only one, so the modified working config will be:
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots'
, filename: 'my-report.html'
});
exports.config = {
directConnect: true, //seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
}
, framework: 'jasmine'
, specs: ['spec.js']
, allScriptsTimeout: 180000
, getPageTimeout: 180000
, jasmineNodeOpts: {
defaultTimeoutInterval: 180000
},
// Setup the report before any tests start
beforeLaunch: function () {
return new Promise(function (resolve) {
reporter.beforeLaunch(resolve);
});
},
// Close the report after all tests finish
afterLaunch: function (exitCode) {
return new Promise(function (resolve) {
reporter.afterLaunch(resolve.bind(this, exitCode));
});
}
, onPrepare: function () {
var width = 1300;
var height = 1200;
browser.driver.manage().window().setSize(width, height);
jasmine.getEnv().addReporter(reporter);
afterAll(function (done) {
process.nextTick(done);
})
}
};
I tested it in my system and it is working perfectly ;)
Upvotes: 1