问题
Has anybody figured out how to take screenshot for every step of a scenario in cucumberjs, and attach it to the json report?
回答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'
});
});
来源:https://stackoverflow.com/questions/40832067/cucumberjs-take-screenshot-after-each-step