Has anybody figured out how to take screenshot for every step of a scenario in cucumberjs, and attach it to the json report?
Asked
Active
Viewed 1,956 times
2
-
Look [here](https://github.com/cucumber/cucumber-js/issues/124) – MikeJRamsey56 Nov 28 '16 at 02:31
-
I am aware of this - but this takes screenshot after the scenario completes, and not after *EACH* step – AlexandrosD Nov 28 '16 at 11:14
-
See my answer. You can apply the techniques described in the link to solve your problem. The only difference is where the snapshot is made not how. – MikeJRamsey56 Nov 28 '16 at 11:24
1 Answers
1
Apparently this can be done via a custom reporter, using Cucumber event handlers.
browser.takeScreenshot().then((png: any) => {
var decodedImage = new Buffer(png, 'base64');
currentStep.embeddings.push({
data: decodedImage.toString('base64'),
mime_type: 'image/png'
});
});

AlexandrosD
- 505
- 4
- 13
-
2Could you please give more information about how you implemented step hook to take screenshots? – Navin Nov 16 '17 at 04:03