Book Image

Learning Yeoman

By : Jonathan Spratley
Book Image

Learning Yeoman

By: Jonathan Spratley

Overview of this book

Table of Contents (17 chapters)
Learning Yeoman
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Modern Workflows for Modern Webapps
Index

Angular generator solutions


The most common issue with Angular apps is setting up e2e testing. Well, let's cover setting up Protractor with an Angular app, so we can run e2e tests to verify that the application is functioning as it should.

Protractor e2e testing

Problem: I have an AngularJS app that was created using Yeoman and I want to add Protractor e2e testing to my project. I want to run a Grunt task that will start Protractor and execute my project's e2e test specs.

Solution: In order to properly test your AngularJS application using Protractor, you will need to perform the following steps in this order:

  1. Install protractor using npm.

  2. Install grunt-protractor-runner using npm.

  3. Configure the Grunt task.

  4. Create a Protractor configuration file.

  5. Create an e2e test spec.

  6. Start Selenium WebDriver.

  7. Start the application.

  8. Run the Grunt task.

Installing Protractor

To install Protractor, you must use npm and install it globally, as follows:

$ npm install protractor -g

Now, update the Selenium WebDriver...