So far, we have covered testing the backend functionality of our projects as well as ensuring that the server returns the correct HTTP responses by using supertest
. To achieve the holy grail of programming, we can go even further and test our client-side code.
We will not focus on test frameworks or how to write client-side tests and run them step-by-step, but instead, we will see what our toolbox contains so that we have our options clear.
There are different types of tools that can help us in our quest by either spinning up a real browser or simulating their environment, such as the following ones:
Those that try to emulate a browser, such as the NPM module Zombie.js (https://www.npmjs.org/package/zombie), which used jsdom (https://www.npmjs.org/package/jsdom) under the hood to simulate a browser environment
Those that launch headless browsers and have a custom API for interacting with it, such as PhantomJS (http://www.phantomjs.org)
Those that launch native browsers and...