Client-side tests

The client-side unit tests and end-to-end tests are available under src/test/javascript.

These tests can be run using the provided npm scripts or the provided Gradle tasks.

You can see all available Gradle tasks by running ./gradlew tasks.

Let's run them using the npm scripts. First, let's run the Karma unit tests. In the terminal, execute the following code. You can also use npm instead of yarn if you prefer:

> yarn test

It should produce a similar output in the end:

PhantomJS 2.1.1 (Linux 0.0.0): Executed 56 of 56 SUCCESS (1.672 secs / 1.528 secs)
=============================== Coverage summary ===============================
Statements : 69.25% ( 903/1304 )
Branches : 40.43% ( 112/277 )
Functions : 48.89% ( 154/315 )
Lines : 67.72% ( 795/1174 )
================================================================================
Done in 37.25s.

Now, let's run the Protractor end-to-end tests using the npm script. In order to run the e2e tests, we need to make sure that the server is running. If you have shut down the server which we started earlier, make sure to start it again by running ./gradlew in a terminal. Now, open a new terminal and navigate to the application folder and execute the following command:

> yarn e2e

This will start protractor tests, which will open a new Chrome browser instance and execute the tests there. When finished, you should see something similar to the following in the console:

Started
..........
10 specs, 0 failures
Finished in 11.776 seconds

[00:02:57] I/launcher - 0 instance(s) of WebDriver still running
[00:02:57] I/launcher - chrome #01 passed