Running Protractor

Hammer uses Angular's Protractor for End-to-End (E2E) testing. Even though Protractor is an E2E framework for AngularJS applications, applications are not required to use Angular. In this tutorial, we will cover the common tasks used to test against.


Each Hammer project contains a tests folder. This folder in the seed-exam has been scaffolded with some sample files that can be used to run Jasmine Unit Tests and Protractor E2E tests.

Selenium Server

The Grunt task grunt-contrib-protractor should have been installed when you ran npm install in your project. To run Protractor, you will need a Selenium server. If you don't have one setup already, you can install a local standalone version with this command within your project root:


You can run your project directly from WebStorm or PhpStorm. Right-click the HTML file in "tests/unit/spec_runner.html" and select "Open in Browser" under the menu options.

Running E2E Tests

As stated above, Protractor is the platform used for running e2e tests.

Run Local HTTP Server

From the terminal, run:

http-server -p 32002

This launches a small server that we can use to deliver content on a specific port from our localhost. We use port 32002 for our tests.

To run the sample E2E tests using Protractor, you will need to find your IP address

Obtaining IP Address on Windows
Obtaining IP Address on Mac
ifconfig | grep "inet " | grep -v

Run Protractor

Run the following line, replacing YOUR_IP_ADDR with the address of your computer.

grunt protractor --baseUrl=http://YOUR_IP_ADDR:32002

The result will look like this when you run:

Protractor results

In our current tests, we can see that 3 specs ran with 0 failures.