Sunday, January 21Be an Automation Engineer

Protractor

Protractor is an End-to-End test framework for AngularJS applications. It is built on top of WebDriverJS, which is an official implementation of W3C WebDriver API. Hence, Protractor extends all WebDriverJS functionalities which help in automating all end users actions against a variety of web browsers.

In addition, Protractor has additional set of functions which help in angular specific locator strategies. It also helps in waiting automatically while angular loads while without protractor one should add waits and sleeps explicitly for AngularJS apps.

Internal architecture of protractor

Our assumption is that the reader of this blog is from a testing background. Hence, the posts in here try to explain all frameworks without assuming that you know either JavaScript or any testing frameworks like Jasmine.

Setup

Before installing protractor, make sure java is installed in your machine and PATH, JAVA_HOME environment variables are set.

 

Create and execute a test
Full material

Recent Posts

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.
%d bloggers like this: