At CIGNEX Datamatics, in one of the projects, the requirement was to automate CMS application test scenarios. The client application was previously built on CodeIgnitor framework and the need was to migrate it on Drupal 8 framework of PHP where AngularJS was used extensively at the front-end. The need of the hour was to implement the tool which was lightweight as well as very AngularJS-friendly. Considering the short timespan, the quick test execution was very much required. The end-users were from Finance and Insurance domain where the tools also required to be compatible with Behaviour Driven Frameworks.

After evaluating available open-source/free tools from the market, final decision arrived at was Protractor tool which is built on JavaScript and of course it’s lightweight. Protractor uses WebDriverJS(In java it is known as WebDriver) which is the main component of Selenium to automate functional testing. This tool is exclusively built to automate AngularJS application but it can be used to automate any non-AngularJS application as well.

The primary reason for Protractor being the choice for application automation was because it directly updates the gecko driver and chrome driver (which are required for browser automation) from internet by just simply hit the command “webdriver-manager update” on command line.   . This is useful when compared to Selenium Java where one has to change path every time they want to update the driver

The tool also complies with the requirement of parallel test execution on multiple browsers by using Selenium Grid internally to run multiple browsers at once. It became easy for business users to adopt behaviour driven framework like Jasmine or Cucumber with which Protractor is already compatible. The tests were made data-driven by using JSON files. Though the tool has limitation like itnot directly being compatible with Excel files, it was not the constraint for the project.

The ideal scenario is to use in Linux but it can also be configured on Windows OS with Ecliplse IDE There are two main Javascript file that needs to be configured to start the protractor.

  • Spec.Js-> In Specification file, all scripts you have to written over here
  • Conf.Js-> Configuration tells Protractor where your test files means your specification files (Spec.js) are, and where to talk to your Selenium Server (seleniumAddress : http://localhost:4444/wd/hub).

Protractor can be easily configured with Android device and iPhone with the help of Appium tool. To run it on the Android device, one has to start Selenium server on different a port (i.e. 4723) than from the fixed desktop port 4444. Please note that the mobility support is partial as it does not support native apps.

As this tool is originally built for AngularJs application, it will synchronize with locators of AngularJS and automatically wait for them to appear on web portal. One has to add explicit wait and sleeps for Non AngularJS application.

We successfully implemented the Protractor automation framework for sanity/regression testing for one of their financial and insurance services provider clients which helped in reducing testing efforts and saving time.