Lesson 16

Setting up the Server

WARNING: This module is deprecated and no longer receives updates. Protractor is likely being removed as the default from Angular applications and Protractor itself will likely stop receiving updates and development in the future. I would recommend checking out the Test Driven Development with Cypress/Jest as a replacement.

Creating the real server for the application


Lesson Outline

Setting up the Server

With the theory of the last two lessons out of the way, we now have all the knowledge we need to finish off the rest of the tests for our application. Now we are going to focus on one of the more complex requirements that we had for the application.

  • A user should only be able to log in to the application with a valid license key from SendOwl

In order to implement this requirement, we will need to create a unit test for a service that handles checking a license key against a server - which isn't a problem because we know how to create a mocked backend now. As we know, a unit test by itself is not enough though - we will also need to implement an E2E test for this functionality. When running our E2E test we will not be mocking the backend, we will be hitting the real server.

Of course, that means we need a server to handle the request! The purpose of this module is not to get into details about how to create a a backend server for an application, so we are going to keep this as simple as possible. We are going to create a simple server with Node and Express that will just return us a "passing" response for any request we make to it.

The specific integration with SendOwl is not really important. However, if you are interested in how that integration works I will be leaving the code for that in the server setup - it will just be commented out. If you want to actually set up the integration with SendOwl you would need to create your own SendOwl account and set up a product that you want to sell.


Thanks for checking out the preview of this lesson!

You do not have the appropriate membership to view the full lesson. If you would like full access to this module you can view membership options (or log in if you are already have an appropriate membership).