CucumberJS: Take screenshot after each step

此生再无相见时 提交于 2021-01-29 03:21:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!