Protractor For AngularJS
- Glasdon Falcao
- Aug 16, 2016
- 2 min read

The Two W's Of AngularJS
What is AngularJS?
AngularJS is a toolset for building the framework most suited to your application development. It is fully extensible and works well with other libraries. Every feature can be modified or replaced to suit your unique development workflow and feature needs.
Why AngularJS?
HTML is great for declaring static documents, but it falters when we try to use it for declaring dynamic views in web-applications. AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop.
Protractor For AngularJS
Protractor is a Node.js program, and runs end-to-end tests that are also written in JavaScript and run with node. Protractor uses WebDriver to control browsers and simulate user actions.
Understanding Protractor

Protractor is a specially designed wrapper around WebDriverJS to automate e2e testing for angular apps. The WebDriverJS API is based on promises, which are managed by a control flow and adapted for Jasmine. This particular testing framework is built with AngularJS apps in mind and can test elements that are specific to the development structure. It is also smart enough to automatically wait for pending tasks to finish.
Promise!.. What is it?
A promise represents the result of an asynchronous operation. A promise is in one of three different states:
pending - The initial state of a promise.
fulfilled - The state of a promise representing a successful operation.
rejected - The state of a promise representing a failed operation.
Once a promise is fulfilled or rejected, it is immutable (i.e. it can never change again). In order to use a promise, we must somehow be able to wait for it to be fulfilled or rejected.
Protractor comes with Jasmine as the default framework, so our related topics would revolve around examples using Jasmine. The simplistic form of using Protractor - Jasmine for testing

However if you are a fan of behavior driven development, Protractor supports Jasmine, Mocha, Cucumber, and adapters for custom frameworks. Jasmine and Mocha both have an active development community and great support. Documentation for Cucumber is currently a little more limited, but its development community is actively updating the codebase with bug fixes and new features – worth checking out.
Some Common Protractor FAQ's
Q. How do I deal with my log-in page?
A. Please refer to link ""
Q. Which browsers are supported?
A. Please click on link "".
Q. How can I get screenshots of failures?
A. Please click on link "".
Q. Debugger is not pausing the text. What should I do?
A. Do not panic. Please refer to link " " for complete understanding.
Q. getText () is returning empty string.
A. Do not forget your basic. Protractor is build on top of Selenium. You have .getAttribute('value') to help you out here.
Comments