Testing user registration
Let's use the setup built in the previous sections and write an actual test. Let's say that we want to make sure that our registering page works. The following are the two processes that we want to capture with our test:
- Filling the form with wrong data and making sure that the application shows an error message
- Filling the form with correct data and seeing a successful message
We are going to use PhantomJS as our headless (virtual) browser. So, all we have to do is load our registration page and simulate user interactions, such as typing in the fields and pressing the buttons.
Simulating user interaction
There are a couple of issues that we are going to resolve. The first one is the actual simulation of user actions. From ...
Get Node.js By Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.