2

Has anybody figured out how to take screenshot for every step of a scenario in cucumberjs, and attach it to the json report?

AlexandrosD
  • 505
  • 4
  • 13

1 Answers1

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
  • 2
    Could you please give more information about how you implemented step hook to take screenshots? – Navin Nov 16 '17 at 04:03