chimp icon indicating copy to clipboard operation
chimp copied to clipboard

How to attach screenshot to json output?

Open ashokdudhade opened this issue 11 years ago • 7 comments

I have requirement to show cucumber report and display screenshot for failed scenarios. Is there any option in chimp to attach the screenshot to scenario.

ashokdudhade avatar Aug 28 '15 20:08 ashokdudhade

not yet, but we'll add it soon, thanks for the suggestion

SamHatoum avatar Sep 18 '15 19:09 SamHatoum

if the screenshot is in the json report as base64, is this enough for you to get going?

SamHatoum avatar Sep 20 '15 07:09 SamHatoum

Note to self, this would need to go into the failure capture step

var png = global.browser.screenshotSync();
var decodedImage = new Buffer(png, 'base64').toString('binary');
scenario.attach(decodedImage, 'image/png');

SamHatoum avatar Sep 20 '15 20:09 SamHatoum

Yes, base64 in JSON report would help. Thanks

ashokdudhade avatar Sep 21 '15 21:09 ashokdudhade

@ashokdudhade you can now use either --captureAllStepScreenshots or --screenshotsOnError to get the all/failed steps in the scenario inside the JSON report.

I'm working on a html report next

SamHatoum avatar Sep 24 '15 00:09 SamHatoum

@ashokdudhade just a heads up, this is no longer default behavior. you need to set --attachScreenshotsToReport for screenshots to be added to the json report

SamHatoum avatar Oct 22 '15 18:10 SamHatoum

Was just playing around with this and the screenshots have to be saved to the same directory as the report or else the cucumber json becomes null when setting the attachScreenshotsToReport flag

StephenDavidson avatar Sep 23 '16 08:09 StephenDavidson