Saturday, December 15Be an Automation Engineer

TypeScript

async / await to avoid control flow

async/await, Protractor, TypeScript

Many of us might have heard of control flow while using selenium based automation tools like selenium-webdriver(Javascript), protractor etc..

A brief idea about control flow for those who does not know about control flow.

What is control flow? “WebDriverJS (and thus, Protractor) APIs are entirely asynchronous. All functions return promises. WebDriverJS maintains a queue of pending promises, called the control » Continue Reading.

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.