There are many tutorials available that provide insights into the use of specific testing frameworks or guidelines on how to write end-to-end tests, but very few of these cover what the end point of these tests should be. Should the end be stubbed API calls or a fake API? Or should it be a real API, but with a special test database?
Every one of the various testing approaches that are available have their own drawbacks and choosing one for your project always involves some type of trade-off. Some tests are too brittle and fail randomly, while others are too time consuming to setup and maintain. I recently discovered an approach that is somewhat of a compromise but seems to require little effort to setup and has proven itself capable of finding real application bugs.
This article describes the end-to-end testing of single page applications (SPA) that are built on an AngularJS or other JS framework. The testing of SPA differs from testing traditional web applications because SPA consists of client-side app and back-end API. This gives more seams for mocking and more testing approaches to choose from. Let’s review which options are currently available for testing SPAs.