如何在测试用例失败时在量角器中截取屏幕截图 [英] How to take screenshot in protractor on failure of test cases

查看:154
本文介绍了如何在测试用例失败时在量角器中截取屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是量角器的新手,想在浏览器中截取我失败的测试用例的截图。

I am new to the protractor and would like to take screenshots of my failed test cases in browsers.

你能告诉我该如何去帮助我吗?关于它?

Can you please help me out by advising how should I go about it?

谢谢:)

推荐答案

你可以使用 protractor-jasmine2-screenshot-reporter 模块,它有一些很好的功能可以满足你的需要。

You can use protractor-jasmine2-screenshot-reporter module for this, it has some good features which would serve your purpose.

 var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');

 var reporter = new HtmlScreenshotReporter({
 dest: 'target/screenshots',
 filename: 'my-report.html',
 captureOnlyFailedSpecs: true
});

这将捕获您的规格失败时的截图,您还有更多选项,您可以查看此链接: https://www.npmjs.com/package/protractor-jasmine2-screenshot-记者

This will capture screenshots when your specs have failed, you have many more options, you can checkout this link : https://www.npmjs.com/package/protractor-jasmine2-screenshot-reporter

这篇关于如何在测试用例失败时在量角器中截取屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆