The directive influences user navigation or the UI appearance. We will test it at the integration level.
- [Voiceover] In the previous videos of this section,…we created an accordion directive,…and then wrote some unit tests for it.…In this video, we'll be adding interaction…with the accordion directive to the End2End Test…for placing an order.…Sometimes the directives you use in your templates and views…will have an impact on the End2End user experience.…In the previous video, we added the accordion directive…to the select pizza template html.…We open the End2End Test for placing an order.…
And let's click on the panel headings a few times…before we place an order.…We select all panel headings by tag name.…Then we click the second panel heading,…and the browser sleeps for one second.…This makes it easy to see what's happening…as Protractor and Selenium run through the test…in the browser.…Then we click on the first panel heading,…and again the browser sleeps for one second.…Then we click on the second panel heading,…and wait another second.…
Don't forget that we first run the web server for the site.…And then we run the Selenium server.…
AngularJS offers the perfect balance between layout and code, making the framework a favorite of developers around the world. But what you might not know is that Angular also provides an outstanding infrastructure for testing, for developing bug-free and easily maintainable applications. Learning AngularJS Testing helps you to understand the different aspects involved in testing Angular components, including controllers and directives, with the help of a practical pizza-ordering application.
Author Rudolf Olah starts by installing and initializing various helpful testing tools, such as Karma, Jasmine, and Grunt. Then he creates controllers for ordering the pizza and reviewing the order, and tests them with and without dependencies. Chapter 3 shows how to create accordion directives for the application, unit test them, and resolve the errors if these tests fail. Rudolf also goes through testing of the navigation between two controllers with the help of End2End testing. Finally, learn how to modify services to use the $resource module and interact with REST API web services, as well as unit test them with the help of mocks and spies. Rudolf also shows how to create and test directives and controllers that fetch information from the service and display it.
- Configuring Angular, Grunt, Karma, and Jasmine for testing
- Testing controllers
- Testing directives
- Inspecting the navigation between components with End2End testing
- Creating REST API services and unit testing them to make your app compelling and user friendly