Monday, October 15Be an Automation Engineer

Tag: Typescript

Take screenshot for every failed spec in protractor+jasmine

Jasmine, Protractor, TypeScript
Why we need screenshots?

Generally we need screenshot of the browser where the protractor got failed. It would increase our chances to quickly figure out the issue before getting into the code debug. 

How to take a screen shot in protractor?

Below is the code to take a screenshot using protractor.

browser.takeScreenshot().then(function (png) { var dirPath = './reports/screenshots/'; if (!fs.existsSync('./reports')) » Continue Reading.