Using Protractor for End-to-End tests
As we saw earlier with Karma, we can write unit tests that will make sure that our code in the controllers is working well; however, it would fall short if you wanted to run automated
User Acceptance Tests (UAT) or run tests that simulate user-driven interactions with the browser. For running such tests, we'll need to use another new tool called Protractor.
Protractor replaces the earlier AngularJS scenarios as the default End-to-End testing framework for testing AngularJS apps.
Protractor runs on WebDriver.js, which in turn makes use of the
Selenium Server. Selenium is one of the most popular browser-automation tools. In this section, we will see how to set up a standalone instance of Selenium Server, install Protractor, and run a default set of End-to-End tests with it.
Let's first install Protractor by running the following command in the terminal:
This will install Protractor globally.
This completes our chapter on setting up your rig. We worked through quite a few tools, namely Node.js, Grunt, Yeoman, Karma, and Protractor. While I strongly recommend making use of all of them when you build your AngularJS projects, you may feel free to choose the ones that suit your project the best.
Another thing to note is that most of these tools such as Node.js, ExpressJS, and Grunt can be used for any non-AngularJS projects. So getting familiar with these tools is surely beneficial for all frontend developers.
In the next chapter, we are going to see how to quickly build a clickable prototype using Angular-UI.