I am using CucumberJS/Protractor, and successfully manage to generate html report with screenshots upon failure (after encoding screenshot image to base64). This is on local machine. However Jenkins does not insert this image into the report, due to Content Security settings. As of course, I don't want to compromise security on the build server, is there a way round this issue? The save screenshot code is below.
if (scenario.isFailed()) {
browser.takeScreenshot().then(function (png) {
var decodedImage = new Buffer(png.replace(/^data:image\/(png|gif|jpeg);base64,/,''), 'base64');
scenario.attach(decodedImage, 'image/png');
});
}